Audio - Master Pitch

BlitzMax Forums/BlitzMax Programming/Audio - Master Pitch

Retimer(Posted 2008) [#1]
I'm looking to be able to play ogg files, to be able to alter the master pitch of sound, and release my app with NO required components. That is all I need, but it seems OpenAL requires a dll, as does FMod.

Any suggestions?

ps. Master Pitch, not Rate.


Damien Sturdy(Posted 2008) [#2]
1) you can calculate the pitch from the "rate". 2) Just use blitz internal audio?


Retimer(Posted 2008) [#3]
The rate speeds up the music, rather than changing the pitch, which is not what I need. I need to change the master pitch, not the speed =(

Unless you mean something else? otherwise I would use #2.

Time


Damien Sturdy(Posted 2008) [#4]
If the rate speeds up the music then you know that 2 doubles the speed, which makes the pitch twice as high.

So if you have a 1000hz sound, and you want a 2000hz sound, double the rate.

also, what about:

New_rate=(1.0/current_pitch)*new_pitch.


Retimer(Posted 2008) [#5]
Sorry, but it seems no matter what you do with hertz and rate, the speed will change, or it will sound the exact same. In my case the speed MUST remain the same, while the pitch is altered. I really don't think blitzmax basic audio can do this, not that easily anyways.

Could I maybe alter the samples (byte ptr) somehow to achieve this?

Example, that does not work:



ziggy(Posted 2008) [#6]
That needs resampling the audio wich is a high CPU demanding task. Not sure if OpenAL can do it, but the standard MAX audio engine (and most multiemdia audio engines) can't resample several audio channels at real time.


Retimer(Posted 2008) [#7]
It's actually for a single short sound effect, so speed shouldn't be much of a problem.

I have very little understanding of how a sound is read, or how to alter the data. Can you provide some insight on how I can resample this, at load time even?


Damien Sturdy(Posted 2008) [#8]
Then what you are after is going to be rather difficult. You can't just change the pitch of a sound and have the sound play for the same amount. :-( perhaps someone else can provide you with some insite but theres more to do than I really have time for, sorry!


Perturbatio(Posted 2008) [#9]
Can't you just create the sound at the pitch you want it to be?


Retimer(Posted 2008) [#10]
I'll need it at about 30 different pitches lol. It's looking like I'll have to create seperate sounds at this rate though.


Perturbatio(Posted 2008) [#11]
perhaps you could provide an example usage for this sound? People might be able to offer alternative solutions.


ImaginaryHuman(Posted 2008) [#12]
Maybe create several pre-pitched sounds as `key pitches` and then just change the rate of each sound - it wont get very much shorter/faster as you do so, if the distance between sounds isn't too big.

Would be nice to be able to change pitch without changing speed though.