alsa

How to record sound in buffer using ALSA

谁都会走 提交于 2019-12-01 06:33:37
问题 I'm begining to learn linux and ALSA and I was wondering if there is a way to store the sound I record from a microphone a directly to the buffer. I read here http://www.linuxjournal.com/article/6735?page=0,2 how to make my recording program. But what I need is a little more complex. I need to record sound untill I hit a key. The reason I need this is because I'm messing with a RaspberryPI(debian on it) and to see if I could turn it into a sound monitoring/detecting device. My main problem is

ALSA: Ways to prevent underrun for speaker

若如初见. 提交于 2019-12-01 05:38:37
I am playing a single channel audio in non-interleaved mode. I am getting underrun when I am writing audio data into speaker : ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred Here is how I write: printf("%d",snd_pcm_avail (spkhandle)); ret = snd_pcm_writen(spkhandle, pSpeakerBuf , framesIn18Millisec); if(ret < 0) { snd_pcm_recover(spkhandle, ret, 0); } What are the different ways/parameter configurations to prevent ALSA under run ? (I am using Linux 3.0, ARM ) Edit: Here is a buffer measurement using snd_pcm_avail() API snd_pcm_avail = 2304 << snd_pcm_writen call 1 success snd_pcm

ALSA: Ways to prevent underrun for speaker

家住魔仙堡 提交于 2019-12-01 03:33:52
问题 I am playing a single channel audio in non-interleaved mode. I am getting underrun when I am writing audio data into speaker : ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred Here is how I write: printf("%d",snd_pcm_avail (spkhandle)); ret = snd_pcm_writen(spkhandle, pSpeakerBuf , framesIn18Millisec); if(ret < 0) { snd_pcm_recover(spkhandle, ret, 0); } What are the different ways/parameter configurations to prevent ALSA under run ? (I am using Linux 3.0, ARM ) Edit: Here is a buffer

GNU Radio: Use sound output as input source

情到浓时终转凉″ 提交于 2019-11-30 23:45:20
In gnuradio-companion I'm using the audio source block as my input signal for the next blocks. All works almost fine. The only little problem is that I'm getting the signal from my microphone (this is the normal behavior off course). I would rather like to get the audio signal being played directly without having to go through my speakers, the air from my room and the microphone. All this generates signal losses and adds noise. I know there is the file source block but this isn't a real solution for me. I also know I could just plug a mini-jack cable from the output to the input from my sound

Record into WAV file

老子叫甜甜 提交于 2019-11-30 23:42:16
Since I've posted this question , I've been trying to write a valid WAV file myself from raw PCM data. I've managed to write the FLAC converter (tested and works), but it does not encode the WAV files I've been writing. I'm not sure what I'm doing wrong. I've been scouring the internet looking at other individuals source code and comparing it to my own, but I still can't get it to work. Here is the whittled down source code (sorry it's still a bit long, it takes a bit of code to record to a .wav on my own): // Compile with "g++ test.ccp -o test -lasound" // Use the newer ALSA API #define ALSA

Record into WAV file

不羁的心 提交于 2019-11-30 18:49:59
问题 Since I've posted this question, I've been trying to write a valid WAV file myself from raw PCM data. I've managed to write the FLAC converter (tested and works), but it does not encode the WAV files I've been writing. I'm not sure what I'm doing wrong. I've been scouring the internet looking at other individuals source code and comparing it to my own, but I still can't get it to work. Here is the whittled down source code (sorry it's still a bit long, it takes a bit of code to record to a

No Audio in Android-x86

半腔热情 提交于 2019-11-30 14:11:28
问题 I've setup an Android-x86 image (4.0-RC1-eeepc) in VirtualBox on a Dell Latitude D820. This particular ISO is not for the laptop, but of all available ISOs it works the best. I have worked through some of the troubles I have come across (by not having an ISO for my device), but I haven't been able to get the sound working. The Android-x86 VirtualBox tutorial and other online resources directed me to use the ALSA driver with SoundBlaster 16, but this has not worked. This question got me to

Linux ALSA/Sound-API Questions - How do you mute?

耗尽温柔 提交于 2019-11-30 10:49:14
How do I mute sound using C? Is there an ALSA function call? Are there any other function calls/APIs that can MUTE the microphone? I have written some code to do audio playback using ALSA, and I have noticed a DELAY before the sound starts playing ... how do I reduce DELAY or LATENCY on sound playback? x user1055604 #include <alsa/asoundlib.h> void SetAlsaMasterMute() { long min, max; snd_mixer_t *handle; snd_mixer_selem_id_t *sid; const char *card = "default"; const char *selem_name = "Master"; snd_mixer_open(&handle, 0); snd_mixer_attach(handle, card); snd_mixer_selem_register(handle, NULL,

ALSA tutorial required

爱⌒轻易说出口 提交于 2019-11-30 10:41:33
问题 I am New to audio programming.I want to create small application which is capable of playing and gives volume control . I am using alsa-lib. I want to know what is the purpose of switch (ex.Master Playback switch), enum in mixer elements and what value should i set to those switchs . Please suggest me some tutorial for mixer settings as well as alsa programming . 回答1: Just collecting some here, that have example code: ALSA Programming HOWTO v.1.0.0 [alsamodular.sourceforge.net] A tutorial on

ALSA Api: How to play two wave files simultaneously?

和自甴很熟 提交于 2019-11-30 05:44:39
问题 What is the required API configuration/call for playing two independent wavefiles overlapped ? I tried to do so , I am getting resource busy error. Some pointers to solve the problem will be very helpful. Following is the error message from snd_pcm_prepare() of the second wavefile "Device or resource busy" 回答1: ALSA does not provide a mixer. If you need to play multiple audio streams at the same time, you need to mix them together on your own. The easiest way this can be accomplished is by