electrodyssey.net

Odyssey of Electronics and Computers

DDS sound generator with PortAudio

February 08, 2021 — Nazim

I've been looking for an easy to use and portable library to generate audio tones, so PortAudio seemed like an obvious choice. PortAudio is not only surprisingly easy to use and comes with many excellent examples, but also provides a control over the callback execution latency. You could specify how many samples to be processed with a callback, or let PortAudio decide the optimal count. Although, PortAudio is not officially called a DSP library, it's pretty much useful for DSP. Best of all, you could combine multiple audio samples by adding them together, to get a multi-tone output. Building the library on Windows with VisualStudio was quite easy and is well documented here. All you need to do is disable the console output and unneeded backends (ASIO in my case). To disable the ASIO, navitage to the project explorer and remove the Source Files->hostapi->ASIO. Then, edit the portaudio.def and comment out the exports starting with PaAsio_. Debug console output can be removed from the preprocessor definitions in the project's properties. There been some old trouble reports of Windows 10 not playing well with x86 32-bit compiled PortAudio DLL, so I've built an x64 library which worked great.

Initialization of the audio stream is well described in examples, the only thing which was not that obvious is how-to use a WASAPI output in exclusive mode, so here is the snippet:

Read more...

lboard2 sound processing dev board with spartan-6 and aic3204

March 03, 2020 — Nazim

lboard2 is my take on building a simple DSP application using Xilinx Spartan-6 FPGA and TI TLV320AIC3204 audio codec from the scratch. I thought it's far more interesting to design my own booard instead of buying a commercially available development kit which just works. Currently, lboard2 is passing a loopback test, which means that audio samples are captured with a codec, being received on the FPGA pins, then routed back to a codec's DAC and heard with a headphones. Loopback isn't the most exciting application, so I'm working on a simple Fourier transfer based VU-meter. Once it's ready, I'll post the code, but before that, I'd like to share my experience with Spartan-6 in a series of a short posts tagged with an lboard2 label.

Hoping this information would help beginners to build a working system faster and with less pain.

Tags: fpga, xilinx, spartan-6, dsp, lboard2, aic3204