Alsa_dev C Pb_thread_func Underrun

Sound configuration on Raspberry Pi with ALSA

  1. Alsa_dev.c Pb_thread_func Underrun
  2. Alsa_dev C Pb_thread_func Underrun Key

RetroPie, gpSP issue: ALSA lib pcm.c:7339:(sndpcmrecover) underrun occurred Hi guys and gals of r/RetroPie, I hope you can help me out with this issue - I imagine someone else must have had the same annoying bug as as me.

Search for jobs related to Linphone pjsip or hire on the world's largest freelancing marketplace with 17m+ jobs. It's free to sign up and bid on jobs. C (Cpp) PJLOG - 30 examples found. These are the top rated real world C (Cpp) examples of PJLOG extracted from open source projects. You can rate examples to. Hi all, Welcome everybody, as this is my first mail to the list. I am trying to write my first ALSA audio program, and I have intermittent issues I can't explain.

While setting up a Raspberry Pi to play streamed music usingUPnP,I have had quite a bit of trouble understanding how to configure thesound on my Raspberry Pi. This is partly because I am running it inheadless mode (no graphical desktop) and partly because sound on Linuxis fiendishlycomplicated.

Anyway, I am making progress in understanding what’s going on but I amno expert. Here are my findings on how to control the ALSA system fromthe command line. All I am focussed on here is getting control of thesound output by the 3.5mm stereo socket. If you want to control theoutput over the HDMI socket or an external USB sound card then you’llneed to do some of your own investigation.

ALSA is the lowest level of the Linux sound stack. The alsa-utilspackage comes ready installed on the debian wheezy distribution I amusing (2012-12-16-wheezy-raspbian.zip). It provides some usefulcommands: amixer, alsamixer, alsactl, aplay and speaker-test.

Testing

It’s good to be able to test things as you go a long to see what affectconfiguration changes have. You can do this with the speaker-testcommand for one, which will by default play white (actually pink) noiseout of the speakers. Press Ctrl-C to stop it.

Another command to try is aplay. This command will play WAV files forinstance as well as lots of other basic sound file types (but not thingswith complex compression such as MP3, FLAC, OGG, etc). The Pi comes withsome sound files already present, for instance in/usr/share/scratch/Media/Sounds. Try:

To get more information while the sound is playing, use the “-v” and“-V” options, e.g.

That will print a lot of info about the sound file and what device it isbeing sent to as well as a VU meter as the sound plays.

To see the available devices, use aplay -L. My machine gives thisoutput (since installing PulseAudio):

It shows that the default device to use is directly to the ALSA device.Interestingly, if I try to play via PulseAudio using aplay with aplay-D pulse then I get a bit of a pop but no sound…

amixer

Looking at the top part of the output, we can see that the playbackvolume for the left and right channels are both at maximum (65536, whichis 2^16) and are both unmuted (“on”).

To control these settings we can use the alsamixer command which gives agraphical display (in your terminal) or the amixer command. Enable auto tuning windows 10 download. Let’s lookat amixer first:

That’s the list of things you can change (control) through the command.We can look at the playback volume in more detail:

This shows the maximum and minimum values for the playback volume andthat it is actually a pair of values (for left and right channels). Forinstance, to change the playback volume we can do:

If you wanted to change the left channel to 50% and the right to 100%for some reason then this command is for you:

To mute the sound you can you control 4:

This also affects the volume values on control 3:

However, the value of the volumes must be stored somewhere because whenyou unmute it again it restores them.

I have found odd effects when changing the volume while it is muted sobest to avoid doing that.

Saving the ALSA state

The operating system saves the ALSA sound configuration when you turn itoff and restores it when you turn it on. This is done with the/etc/init.d/alsa-utils script. The state is stored and restored usingthis file: /var/lib/alsa/asound.state

This is used when you use for example Wavelab and want to process a selected portion in a wave file. PROCESS MODE:REALTIME = for live/automation use.OFFLINE = will trigger current PLAY/STOP button direction when the plugin resume is called. SPEED box:LEFT click to select DOWN speed.(green)RIGHT click to select UP speed.(red). Tapestop fx vst download. BLUE show live position in slowdown buffer.

Once you have the sound configuration as you want it you can store itthere using the alsactl command which you have to run with rootpermissions as it changes a protected file. Let’s set the volume to max,unmute it and store it:

For me, this gives this changes /var/lib/alsa/asound.state to be:

If we mute it then have another look, line 5 changes to “value -10239”,line 13 changes to “dbvalue.0 -9999999” and line 19 changes to “false”.

If we were to unmute and then set the volume to 50% (as described above)then line 5 changes to “value -1405” and line 13 to “dbvalue.0 -1405”(with line 19 being now set to “true”). Not quite sure where thesenumbers come from, they are probably the decibel volumes which arelogarithmic, but let’s not go there…

If you want to stop the current state being saved when the machine shutsdown then you need to disable the alsa-utils init script from runningwhen the machine enters runlevel 0 (halt) and 6(reboot). Aslightly hacky way of doing this is to execute these commands:

Note that the files have been renamed to have a lowercase “k” at thestart. When the machine enters runlevel 0 for instance (it does thiswhen shutting down) all the scripts starting with “K” in the /etc/rc0.dfolder are executed. By renaming it to start with a lowercase “k” thefile is ignored and the ALSA state is not saved.

alsamixer

As well as using amixer on the command line to change the volumes and soon, you can also use a slightly graphical utility called alsamixer. Justtype alsamixer and you’ll get something like the screenshot shown below:

In this utility you can move the volume up and down using the up anddown cursor keys, mute and unmute using the “m” key and move from onedevice to another (if you have them) using the left and right cursorkeys. Press the Esc key to exit. If you play with this and then typeamixer once you’ve exited then you’ll see that the changes arereflected in the output of that command as well.

Alsa_dev.c Pb_thread_func Underrun

Final thoughts

I hope that’s useful to someone like me who is struggling to understandall this. It is only one part of the stack, so I hope to look intoPulseAudio in more detail another time as I think that’s where myproblems are at the moment.

Alsa_dev C Pb_thread_func Underrun Key

One last thing: if you completely mess things up then this commandshould sort it all out and make things sane again (sets volume to 44%for me):