Portaudio: open file instead of using the microphone
Question
I am using PortAudio, and this is how I'm opening a stream for reading right now.
Pa_OpenDefaultStream(&stream, 1, 0, paFloat32, SAMPLE_RATE, SAMPLES, PaCallback, NULL);
As far as I know, this uses the microphone as input. How can I instead use a file as input? The Pa_OpenStream
function strangely doesn't seem to let me enter a filename?
Solution
PortAudio is for device I/O only, such as speakers, microphones, line inputs and similar devices. To do file I/O you need another library designed for that. For example, libsoundfile, libsox or libaudiofile.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow