Game Development Community

Sound pitch parameter

by pastis · in Torque Game Builder · 08/30/2010 (11:21 pm) · 7 replies

Hello,

I saw somewhere it was possible to change the pitch of a sound.
But I don't understand how to use it in my code :(

For example I have my sound played:

playsound(jump01);

Is there a parameter I can add to my code for have the pitch effect.
Maybe I will add some random, but for now I just wanted to have the pitch...
Step by step, I will succeed :) Just need some help.

Thanks in advanced.

About the author

Recent Threads


#1
08/31/2010 (1:53 am)
Check the OpenAL documentation at TDN:
tdn.garagegames.com/wiki/TorqueScript_Console_Functions_1

If I remember right, you'll need the alxSourcef function.
#2
08/31/2010 (3:45 am)
Sorry for that but I am not so skilled for now.
I m not sure to understand.

Is it like that:
playsound(jump01, AL_PITCH, 0.5);

Because I don't have any error, and my sound is not played. :(
What I am supposed to do with this?
#4
08/31/2010 (5:37 am)
Make sure you read the documentation:
tdn.garagegames.com/wiki/Audio/Music
#5
09/02/2010 (3:38 am)
Ok. Thanks.
So I try those this:

alxSourcef(nameofmysound, AL_PITCH, 0.5);

or

alxPlay(nameofmysound, AL_PITCH, 0.5);

But it s not working. My sound is in 44hz and 8 bits and it s still not working.
What is wrong with my code?
#6
09/02/2010 (5:14 am)
Change nameofmysound to your soundhandle.

Example:
new AudioProfile(nameofsound) {
   filename = expandFilename("~/data/audio/sound/sound1.ogg");
   description = "AudioNonLoopingEffect";
   preload = false;
};

And then...
$testSound = alxPlay(nameofsound);

alxSourcef($testSound,AL_PITCH,0.5);
#7
09/11/2010 (5:17 pm)
Yes it's working perfectly.
Thanks for all your help.

I hope in the future it will be me who learn you something to you. ;)