OpenAL is a very powerful library for audio playback and recording. However, I just needed a minimal example on how to play a simple sine wave of a given frequency, synthesized by myself. This is basically quite easy using OpenAL as well. In a syntax similar to OpenGL, a buffer is generated and filled with samples (here a sine wave), which is then passed on to OpenAL for playback.

I've attached the sample code to this post. Now, this can be used to do fun stuff, like superimposing several sine (or, sawtooth!) waves, maybe add a LFO, some ASDR enveloping and build your own synthesizer from scratch. Though, if you like to code your sounds, you might want to take a look at ChucK, the audio programming language.