Jeroen
Jeroen

Reputation: 16825

What Format is Sound Stored in? OpenAL / SFML

I know how to make a sf::SoundBuffer and stuff like that, but how do I, for example, create a short pitch noise programmatically that SFML would be able to read. Or how would I go over creating a noise that gradually increases in volume or gets higher/lower pitched?

Upvotes: 0

Views: 361

Answers (1)

You could use sf::SoundBuffer with loadFromSamples (see the documentation).

The representation of a sound in memory is basically a large array of integers that gives the amplitude of the signal at a given time. You can provide your own array to a sf::SoundBuffer with the correct parameters, and that would give you your programmatically generated sound.

For manipulation of sound, volume etc I can't help you though, you'll have to search for the maths behind signal processing and such.

Upvotes: 1

Related Questions