0
0

Hi.

I am wondering how to use ‘pitchBend’ in FMOD EX

plz, tell me how to use them.

Thanks.

  • You must to post comments
0
0

[b:2wnu68i5]Time variant pitch bending:[/b:2wnu68i5]

If you’re using the low level system
FMOD::Channel::setFrequency

If you’re using the FMOD Event System
FMOD::Event::setPitch

Note: Both of these will speed up/slow down the sound to change the pitch but are very fast and don’t use much CPU time.

[b:2wnu68i5]Time invariant pitch bending:[/b:2wnu68i5]
Using our Pitch Shift DSP you can change the pitch without changing the speed of the sound, but the CPU hit is massive especially on a platform with limited hardware like the iPhone.

Hope this helps,

-Pete

  • You must to post comments
0
0

There is a group::setPitch… But I never found a channel set pitch… Is there a reason why there is no channel::setPitch? (Just asking)

  • You must to post comments
0
0

[quote:2yx6v1vu]Is there a reason why there is no channel::setPitch?[/quote:2yx6v1vu]
I think the reason there is no channel set pitch is because it give you more control to set the frequency. They are fundamentally the same thing, but if you wanted to set a specific frequency via a setPitch it would be more difficult than setting the pitch via a setFrequency.

[code:2yx6v1vu]setChannelPitch( FMOD::Channel * channel, float pitch )
{
float freq;
ERRCHECK(channel->getFrequency(&freq));
ERRCHECK(channel->setFrequency(pitch * freq));
}[/code:2yx6v1vu]

Hope that answers your question.

-Pete

  • You must to post comments
0
0

[quote="PeterStirling":fgv8l466][quote:fgv8l466]Is there a reason why there is no channel::setPitch?[/quote:fgv8l466]
I think the reason there is no channel set pitch is because it give you more control to set the frequency. They are fundamentally the same thing, but if you wanted to set a specific frequency via a setPitch it would be more difficult than setting the pitch via a setFrequency.

[code:fgv8l466]setChannelPitch( FMOD::Channel * channel, float pitch )
{
float freq;
ERRCHECK(channel->getFrequency(&freq));
ERRCHECK(channel->setFrequency(pitch * freq));
}[/code:fgv8l466]

Hope that answers your question.

-Pete[/quote:fgv8l466]
That wont do…

The problem, and correct me if I am wrong, is that I have to remember the original frequency for your pitch sln to work as the subsequent getFrequency() will return the frequency I set.

So I see a need for an new API for the channel
::getOriginalFrequency(&freq)
[code:fgv8l466]
setChannelPitch( FMOD::Channel * channel, float pitch )
{
float freq;
ERRCHECK(channel->getOriginalFrequency(&freq));
ERRCHECK(channel->setFrequency(pitch * freq));
}
[/code:fgv8l466]

::setPitch(pitch).
::getPitch(&pitch) would be a bonus too.

Perhaps a Sound::getFrequency(&freq) would be appropriate to fetch the original frequency.

Me, I can stuff the original frequency in my user data structure and grab the original frequency the moment I start a new channel. In short, I can implement these myself…

I actually like the set pitch because it’s much easier to do bullet time effects that way, without having to sneak at the frequency. I know it’s easy to implement as you showed here, that is how I do bullet time on a single channel; though, like I said, I have to remember that original frequency.

I never actually had a use for setFrequency in a game, except once for this applet that created sound tracks playing sample "wavelets" in a midi type manner where each wavelet had a single sample waveform recorded at 1 hz…

Anyway, it’s the only thing that struck me as "missing for no apparent reason" when comparing the channel group APIs to the channel APIs…

  • You must to post comments
0
0

[quote:1yz0xd4o]The problem, and correct me if I am wrong, is that I have to remember the original frequency for your pitch sln to work as the subsequent getFrequency() will return the frequency I set.[/quote:1yz0xd4o]

You are correct, that was an oversight on my part. I guess storing the original frequency is required and that does make it a bit more work.

  • You must to post comments
0
0

The reason why channels don’t have a Channel::setPitch() / Channel::getPitch() as it is unnecessary. You can however do everything you need with Channel::setFrequency(). Please look at Sound::getDefaults(), this will give you the default frequency or original frequency you require. If you only have access to the channel object, you can simply do Channel::getSound(), then use the Sound::getDefaults().

Channel groups have a set pitch because it would be silly to override all the channels with one frequency when they potentially have different default frequencies, so ChannelGroup::setPitch() provide a way to scale all the channels.

I hope this clarifies things for you.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.