Setting a pitch/frequency offset for a sound channel?

GuyCockcroft

  • Posts: 193
Hi. I suspect this isn't possible at the moment, but is there some code snippet I could use to set the pitch of a given sound channel (something I could run in a "when updating" block)? I want to mimic a kind of car engine effect, but couldn't really do this with a static sound without some awkward faking. Specifically, I want to map the pitch of a sound to a variable so that when the variable reaches maximum, the sound plays at normal pitch (and is pitched down the slower the vehicle is).

Thanks in advance.

sdieters

  • Posts: 2068
this could be achieved with custom coding.
i havent worked with haXe jet, but in a quick search i found the folowing >> http://haxe.org/api/flash/media/soundtransform

im not sure if panning is the same as pitching, but if it is, it should be possible.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

SadiQ

  • Posts: 1795
Panning is the shift in volume from the left speaker to the right speaker and the other way around.
As for changing pitch... It could probably be done with custom code, but I could be wrong.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

sdieters

  • Posts: 2068
bummer. in Unity i can simply increase the pitch by using:
audio.pitch += speed/20;
it's in C# tho
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

GuyCockcroft

  • Posts: 193
Yes, I found the soundtransform thing - thanks. Unfortunately, it doesn't include any pitching, but you can send different amounts of the signal to the left and right speakers - which I might be able to use creatively. I'm not exactly sure how to go about this though. Do I have to import the flash.media.SoundTransform and then play my sound via a code block? I'm no programmer, but if I get the syntax right, I might be able to figure it out.

Thanks for any help you can offer.

sdieters

  • Posts: 2068
sending different amounts does not pitch your sound, it only gives you a stereo effect.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

GuyCockcroft

  • Posts: 193
Oh sure. But it does give me another tool to use! You could use it to create a piece of adaptive music, for instance. (Melody on the right channel, rhythmic things on the left - both steered to both speakers with varying amounts).

Actually, while thinking about this, I've come up with a slightly insane way of doing an engine sound that might actually suit my game better. We'll see...

thanks for your input!

sdieters

  • Posts: 2068
no problems.

good luck =)
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p