LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-25-2008, 11:42 AM   #1
bapigoo9
Member
 
Registered: Aug 2008
Posts: 107

Rep: Reputation: 16
Post 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.
 
Old 08-26-2008, 04:04 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
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.
 
Old 08-28-2008, 10:01 AM   #3
bapigoo9
Member
 
Registered: Aug 2008
Posts: 107

Original Poster
Rep: Reputation: 16
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?
 
Old 08-28-2008, 07:15 PM   #4
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
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).
 
  


Reply

Tags
linux, programming, sound


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
app to normalise sound on audio tracks? Jayla Linux - Software 4 05-28-2008 01:03 PM
Need sound card drivers for 'Sony Sound Reality - Audio Enhancer' creature124 Linux - Hardware 1 02-01-2008 07:48 AM
is the Turtle Beach Audio Advantage usb sound card compatible with Linux? 1sciroccofahrer Linux - Hardware 7 07-23-2005 06:54 PM
video, audio and windows app in linux problem fedoracore Linux - Hardware 1 01-28-2004 12:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration