alsa

Correctly sizing Alsa buffers, weird API

I'm currently working on a project that requires me to do some sampling with Alsa. I'm trying to configure correctly everything but I'm stuck on how to correctly size my reading. There are two primitives that seem to be interesting for my task: snd_pcm_hw_params_get_period_time snd_pcm_hw_params_get_buffer_size The name of the first ...

aplay / alsaplayer - sound not working for normal user

I cannot use alsa as a normal user (resulting in me not having sound in chromium). I am guessing it has something to do with permissions. Adding myself to group audio didn't help. [zarac@towelie ~]$ grep audio /etc/group audio:x:92:mpd,zarac Testing sound as normal user: [zarac@towelie ~]$ aplay /usr/share/sounds/alsa/Noise.wav ALSA...

ruby bloops crashes after a while

There is a sound library written by _why called bloops. It runs fine, but within several minutes, it crashes. Following is a sample code: #!/usr/bin/env ruby require 'bloops' loop { b = Bloops.new b.tempo = 320 b.tune(b.sound(Bloops::SAWTOOTH), "c") b.play sleep 1 until b.stopped? b.clear } The error message is like this: Expressi...

mpg123 on arm-error in writing audio

First off, I don't know if this question is relevant at SO but I'm not getting any responses (yet) from the mailing list.So here goes anyway. I am trying to get mpg123 working on my arm target board.I cross compiled and installed it but when I try to play files, I get the following error : [audio.c:596] error: Error in writing audio (I...

What is the correct type for this parameter?

This one is for all you ALSA guys. I need a sanity check here. I am using the the alsa-lib api to play sounds and the function that I am using to write the data to the driver is snd_pcm_sframes_t snd_pcm_writei (snd_pcm_t* pcm, const void* buffer, snd_pcm_uframes_t siz...

ALSA: Looping Sound Problem

I have written a small program that tests the ALSA library on an Embedded Linux board. The program configures ALSA, plays a single sound and then waits 1 minute before exiting. Here is what I am observing: after playing the sound, there is silent pause and then the sound is played again. I am 100% positive that the program itself is not...

Getting audio data every 20 milliseconds in ALSA?

I would like to call snd_pcm_readi() and get AUDIO DATA every 20 ms or every 40 ms. I want to know how to get my data synchronously ... that is every X ms ... Thanks for any responses. ...

Makefile conditional include

I'm trying to write an application that needs either ALSA or OSS headers. Basically, I want to pass a define to the compiler if /etc/oss.conf does not exist, since that probably means the soundcard.h header doesn't exist (feel free to correct me on that one, I'm still new to working with OSS). Per the OSS documentation, you would use the...

using ALSA api - sound does not start until buffer has filled

The application I'm using only plays sounds after enough sound has been generated. Say I click the mouse 10 times, with no sound, and then after those ten clicks I'll hear ten mouse click sounds (for example) The only way I've found to alleviate this problem is to set a very short buffer size, which I don't want to do. I've been trying...

ALSA: How to tell when a sound is finished playing

I have a c++ object that accepts sound requests and plays them with ALSA. There is thread that processes the sound requests. Some sounds are periodic and are rescheduled after the wav file contents have been written to the ALSA library. Is there a way I can find out when all the data has been played? The function snd_pcm_writei is a bloc...

ALSA: Power Saving Guidelines

Does anyone know of a set of power-saving guidelines for ALSA anywhere? For example... What is the best state to put the PCM stream in when not sound is being played? Is there anything that can be disabled in the lib that would save power? What NOT to do? ...

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

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 ...