Speaker output

Is there a library for speaker output? I want to generate custom sound without using a .wav file. I'm hoping to (eventually) experiment with sound generation emulating the human voice.
Any audio library worth its salt has an option for streaming audio output. It usually works via a callback mechanism where you give it audio data (in the form of "samples") every so often.

Usually you obtain this audio data from a wav, mp3, or similar file. However if you want to generate your own audio, just feed it audio data you produce.

The data you give it is just normal, uncompressed PCM. Typically 16-bit signed, but there are a number of different formats you can use.
Which libraries would you recommend?
I depends on what else you'll be doing.

Options off the top of my head are:

- OpenAL
- FMod
- DirectX / DirectSound
- WinAPI's waveOut family
Doesn't SFML come with a wrapper for OpenAL?

-Albatross
Maybe. Honestly I haven't looked much at SFML's audio streaming capabilities.

It certainly would be the easiest to use of the above mentioned libs.
I'll go with ease of use to start.

http://www.sfml-dev.org/download.php

I'm assuming the Windows - MinGW download will suit my needs.
Yeah but I don't know how to stream your own audio with it. I couldn't immediately tell from the docs.

You might have to ask on those on the SFML forums about it.


EDIT:

This post seems to have a simple example:

http://www.sfml-dev.org/forum/viewtopic.php?t=3929

It looks like you just derive a class from SoundStream and implement the OnGetData function. You provide the audio data through the passed 'chunk' structure.

You then play the SoundStream through a sf::Sound (Sound::SetBuffer, then Sound::Play)
Last edited on
Topic archived. No new replies allowed.