I am looking for a means to play simple sine waves and other basic math functions in pure C, not C++/C#. Are there any libraries or methods to output actively to the sound card? Even more ideally to integrate soundfonts. Is this too cumbersome of an endeavor?

I am a C noob and want to learn more and expand in this area of programming. I have looked all over online and haven't found any clear examples or routes for this. Essentially I plan on making a rudimentary keyboard synth, ie: holding down q plays note A etc.

Any help or redirection would be appreciated.

1 Answer 1


It depends on which kinds of system you're targeting, but most modern Linux desktop distributions have PulseAudio installed as their highest-level audio interface, so you can use its simple API (in particular pa_simple_write()) to produce sound.

For soundfonts, I think FluidSynth's library is fairly popular.

  • Perfect, Thanks! I will read up on those libraries.
    – syn_synth
    Mar 13, 2021 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.