10

I am using Raspberry Pi 3. What I am trying to do is test my USB microphone. I first type in lsusb to see if the raspberry pi detects my device. It does, and the result is this:

BUS 001 Device oo8: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller

I then type in the command alsamixer to choose my device and increase the volume. Afterwards, I type in the command arecord -l to get a list of CAPTURE Hardware Devices:

  • card 1: Device [USB PnP Sound Device],
  • device 0: USB Audio [USB Audio]
  • Subdevices: 1/1 Subdevice #0: subdevice #0".

I can see that my microphone is recording sound but I am unable to hear it when I plug in my headphones.

  • Try to use this command to record your audio to a file then play it back later: arecord -f cd -D plughw:0 -d 10 a.wav – Mohammad Ali May 5 '16 at 3:47
  • This might help? – Sparhawk Jun 5 '16 at 0:16
  • This has helped solve the same problem for me: I used a standard switching power supply (5V,2.4A), then switched to a custom supply using an LM350 with caps at 5V. I had no PWM hooey on any pins before and after. There is now only crystal clear sound on all my USB 'soundcards', even the cheapest chinese one. I am certain that the linear regulator made the difference. – user2497 Jun 8 '17 at 3:04
1

I have also faced this issue a while ago, so I am posting two solutions that worked for me.

The first solution is if you want only audio streaming.

  • Step 1: Installing ffmpeg.
    Do not use the package ffmpeg from the Raspbian repository apt-get as it says it is obsolete.

The right way:

cd /usr/src
sudo git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
  • Step 2: Compiling ffmpeg.

Now,

sudo ./configure && sudo make && sudo make install

Go for a break it will take some time!

  • Step 3: Start Recording.

You can use some other codecs too, I have used mp2 as it reduces cpu usage by a good amount.

arecord -f cd -D plughw:1,0 | ffmpeg -re -i - -acodec mp2 -ab 32k -ac 1 -f rtp rtp://224.1.2.3:7000

Note: This ip address is a type of multicast address ([224-239].x.y.z). So don't target it to a particular network device on your lan.

  • Step 4: Listening Output.

Open Vlc on computer connected to the same network.

Go to media -> network stream -> enter the ip, here rtp://224.1.2.3:7000

The second solution is if you want both audio and video recording at the same time.

  • Follow Step 1 and 2. (Remember to be in the right directory)
  • Step3: Start Recording.

This is changed as ffmpeg provides full multimedia streaming.

ffmpeg -f alsa -ac 1 -i hw:1 -ar 44100 -f mpegts udp://10.10.0.96:1234
  • Step 4: Listening Output.

Open Vlc on computer connected to the same network.

Go to media -> network stream -> enter the ip, here udp://@:1234

0

The microphone input doesn't go to the audio output unless you write (or use) a program that tells it to do this.

0

There are some sound cards which have audio input and output on them. If you need to hear what is coming from the audio input and record at the same time, there are a few options, such as ;

  • Use a sound card which allows you to record (possibly with microphone built in) and enable the bypass option to hear directly what is input, whilst recording at the same time. This option is normally called 'bypass' and can be activated using alsamixer. A non comprehensive list of GPIO based sound cards are available here. This option is best if you want extremely low latency, i.e. to hear what you have recorded through the headphones with close to zero delay.

  • You could also try to work out how to arecord to file and do a separate arecord | aplay command from the same device. The dmix alsa device plugin allows you to record from a device which is already in use. Problems with this approach is that there will be a significant (3 to 6 ms) latency - particularly with USB sound cards, could be much lower when using a GPIO header based sound card. This is very off putting if you are trying to perform and listen at the same time.

Matt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.