I found that a better example for playback is the 'pcm.c' file that you can find on the alsa site. It contains many ways to deliver the data (a nice sine) to your soundcard. Playing with the parameters gives some insight (more than reading the overall poor documentation imho :(). Anyway - I "translated" the one you mention to C++; it works for me. I'll include it below. Compile like: g++ playback.cc -lasound For me, this gives a lot of buffer overruns... pcm.c doesn't suffer from that. Note that I added: dir = 0; // ??? According to valgrind, this value is USED (read) for a conditional jump! Maybe that is a bug of alsa, maybe it is just badly documented - but to be safe you should set that variable too. On Tue, Jul 22, 2003 at 11:54:49PM -0700, Tom Watson wrote: > I am attempting to write a "simple" audio playback program. Well, I > thought it would be, but... > Somehow (thru strace) the 'snd_pcm_writei' call goes and eventually > does a system 'poll' call, but it doesn't return indicating that a > write is OK to do. > I've used similar parameters in 'aplay' and I see that it works. > > The basis of the program I'm writing is the one described in _A > Tutorial on Using the ALSA API_ > (http://equalarea.com/paul/alsa-audio.html), section entitled "A > Minimal Playback Program". > > One thing I've noted: Some of the data printed out by "snd_pcm_dump" > is different between my program and 'aplay'. I suspect that there is a > clue somewhere, but what is the "magic"?? > > If necessary, I can provide the 'strace' or the output from > 'snd_pcm_dump', but in the interest of brevity... > > Any "great clue" would be appreciated. -- Carlo Wood