Wednesday 15 February 2012

unix - Howto pipe raw PCM-Data from /dev/ttyUSB0 to soundcard? -


I am currently working on a small microphone, connected to a PC via a FPG. FPGA creates a raw datastream through UART / USB in my computer. I am capable of recording, playing and analyzing data.

But I can not run "live" audio stream directly

What is the datastream saved in PCM raw - format with a custom built C program, and piping the contents of the file into aplay. But it adds 10 seconds lag to theststream ... not very good for demoing or testing.

  tail -f snd.raw | Aplay -t raw -f S16_LE -r 9000 Do anyone have another idea, how does audio stream get faster in my ears? Why does  
  cat / dev / ttyUSB0 | Aplay  

Not working?

You need one API that lets you stream the audio directly into the sound card. I did not do it on Linux, But I have used it for this purpose. You can get another API in the SDL seems popular

The general idea is that you set up a streaming buffer, then your C program removes the bytes coming in a byte. In the coming stream the shape is chosen to balance the gap with jitter. When the array is complete, you pass it in the API, and start filling the second while doing the first drama.


No comments:

Post a Comment