2
votes

I'm fairly new to WASAPI, and I'm trying to write a program in C++ that looks at the audio stream on the primary playback device and performs a FFT on every chunk via fftw3, does something with the result, and discards the chunk. Every example I've been able to find so far on WASAPI and fftw3 involves writing to a file and then opening that file. Is it possible to process the WAVE chunks directly?

1
It sounds like your question is all to do with FFTW, and nothing to do with WASAPI?Cory Nelson
I guess it's more that I'm wondering how WASAPI returns the RIFF chunks, and what I need to know to process those.user2977512

1 Answers

1
votes

WASAPI audio capture typically fills memory buffers with "just captured" audio data and passes them back to controlling application. "Without writing to a file" - this is the way it works in first place. It requires additional effort to write the data into a media file, with or without compression.

You might be interested in the following Windows SDK samples:

  • CaptureSharedEventDriven - This sample application uses the Core Audio APIs to capture audio data from an input device, specified by the user and writes it to a uniquely named .WAV file in the current directory. This sample demonstrates event-driven buffering.
  • CaptureSharedTimerDriven - This sample application uses the Core Audio APIs to capture audio data from an input device, specified by the user and writes it to a uniquely named .WAV file in the current directory. This sample demonstrates timer-driven buffering.

Both show you how data travels from API through memory buffers, to files. You can apply FFT at the moment you have data obtained from API, before it goes to files in the samples.