/* pcm_min.c * This extra small demo sends a random samples to your speakers. * sudo apt-get install libasound2 * sudo apt-get install libsound2-dev * get this file from web or * cp /afs/umbc.edu/users/s/q/squire/pub/download/pcm_min.c . * gcc pcm_min.c -l asound * a.out # you should hear noise */ #include "alsa/asoundlib.h" static char *device = "default"; /* playback device */ snd_output_t *output = NULL; unsigned char buffer[16*1024]; /* some random data */ int main(void) { int err; unsigned int i; snd_pcm_t *handle; snd_pcm_sframes_t frames; for(i=0; i 0 && frames < (long)sizeof(buffer)) printf("Short write (expected %li, wrote %li)\n", (long)sizeof(buffer), frames); } snd_pcm_close(handle); return 0; } /* end pcm_min.c */