I am trying to capture the sound from sound card by ALSA in linux systems. Its read the data from the vector in PCM format. I need a way to find out the right way to capturing and save it to in the file and play to check the recevied data is correct or not.
Asked
Active
Viewed 1,599 times
0
-
Did you study the source code of free software similar to your goals (probably some mixer software)? – Basile Starynkevitch Apr 24 '15 at 04:54
-
Its reading the data by interleaved method[left and rigth consecutively]. – JACOB DEEPAK Apr 24 '15 at 04:57
-
i need a way to parse that data and save – JACOB DEEPAK Apr 24 '15 at 04:58
-
https://gist.github.com/albanpeignier/104902 I am using the code from the above the link for capturing the audio data from the vector and store bytes in the file i want to play that file and check data parsing correct or not. using the "Audacity" for rading as raw data but i am not hearing any valuable audio. – JACOB DEEPAK May 02 '15 at 10:42
1 Answers
2
To capture audio to a file with alsa , you can use arecord. By using this you can simply capture input audio to a file. Or you can write your own application which read PCM data. You can use snd_pcm_readi API for this purpose.

jjm
- 431
- 3
- 19
-
Yes i have used this API and reading data in the buffer . i want to save the buffer as audio file and want to play. when i tried its played as mute state not hearing any sound from the file. – JACOB DEEPAK Apr 24 '15 at 05:24
-
-
immanuel, writing to file is not important... u can use normal file write for that purpose. But playing is important.. How u played PCM data?. Also make sure that input data is not mute.. – jjm Apr 24 '15 at 05:30
-
I wrote a file and opened in the default format. Its opened in the adobe photo shop and its opened as stereo and set the other thing when its start to play its playing but getting any sound . – JACOB DEEPAK Apr 24 '15 at 05:38
-
-
did you heard about [aplay](http://linux.die.net/man/1/aplay)? u can use this command for play PCM. You can use the software **audacity** also for playing pcm. – jjm Apr 24 '15 at 05:41