LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to grab audio amplitude from sound card in Linux for programming Linux app? (https://www.linuxquestions.org/questions/programming-9/how-to-grab-audio-amplitude-from-sound-card-in-linux-for-programming-linux-app-665265/)

bapigoo9 08-25-2008 11:42 AM

how to grab audio amplitude from sound card in Linux for programming Linux app?
 
Linux 2.6.25.17
I am trying to write an audio application for Linux, and was looking for another way to write it instead of using the PulseAudio libs. This is what I want to do: play an audio file from the command line using the "play", "paplay" or "wavplay" or some similar play utility that will play the sound to the sound card speaker output. Then, I want to grab the amplitude of each sound that is played, and store it into a variable. Basically, a sound grabber application for Linux. I was thinking of writing it in the C programming language, but if you know a command line way to do this, that could help to get me started on seeing how it works in Linux.

I know that there are two devices that I can use, /dev/audio and /dev/dsp. Any answers on the capability of Linux with the 2.6.25.17 kernel (or later if capability was added) to solve this problem would be helpful.

pinniped 08-26-2008 04:04 AM

Do NOT use /dev/audio and /dev/dsp - those are OSS devices and OSS is deprecated (most if not all drivers were removed from the kernel 1 or 2 years ago).

You must study ALSA instead. Have a look at the source code for alsamixer. :)

bapigoo9 08-28-2008 10:01 AM

If you have PulseAudio on your system and are running it, can you still use ALSA or do they conflict?

What is the ALSA library that you would link with?

pinniped 08-28-2008 07:15 PM

Alsa is the low-level driver; PulseAudio is a sound server (like ESD, aRTSD, etc).

If PulseAudio locks out r/w access to the device you may not be able to change the volume directly via Alsa while a sound is being played. However, the volume control should definitely work when PulseAudio isn't actually playing any sound (otherwise there are more serious design problems).


All times are GMT -5. The time now is 10:50 PM.