I currently have written a code which takes in a raw file as input and does some audio processing and writes it to another different raw file.

The way I am currently inputting is

.\my_code_binary < input.raw > output.raw

as you can see, I am making the input.raw as stdin and output.raw as stdout for the execution my program.

fread(tmp, sizeof(short), channels * size_of_frame, stdin); // the way I am using the input.raw
fwrite(tmp, sizeof(short), channels * FRAME_SIZE, stdout); // the way I am using the output.raw

Now I want to make my program run real-time, as in, take my mic input as stdin and mic output as stdout. Any resources or code snippets will help me out, I am a beginner at audio processing in C.

I am using a Raspberry Pi 4

New contributor
Tharun K is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    $\begingroup$ This isn't really a signal processing question, but: instead of writing stdout to a file, you can just pipe it into an audio player (aplay, for example), and instead of reading stdin from a file, you can just pipe an audio recorder into your program (e.g. arecord) $\endgroup$ – Marcus Müller Apr 8 at 11:10

Your Answer

Tharun K is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.