I am making a bunch of oscillators and corresponding channels in my music program.
What is the difference between changing pitch of an oscillator on the DSP using:
and changing the pitch of the channel that is hooked up to the oscillator? Are their advantages or disadvantages to doing it either way? are there different pitch ranges using either method? Is it all the same under the hood?
- dtbelobrown asked 11 years ago
I’m bringing this topic up because I’m a little confused…
What is called frequency in the setFrequency function is actually the sampling rate, and what is called rate in the DSP parameters is actually the frequency of the signal, isn’t it?
Because having a pure tone of 44.1 kHz (the default sampling rate) like in the generatetone example would not be audible…
If you divide the sampling rate by 2, it should physically mean that you only take on sample out of 2, which should slightly modify the form of the wave, but not change the perceived pitch.
But actually, what happens here, is that you keep the same number of samples (and their associated value), but you double the time between each 2. Thus, you decrease the perceived pitch.
That’s why going from a 440 Hz tone sampled at 44.1 kHz to a 440 Hz tone sampled at 22.05 kHz sounds like a 220 Hz sampled at 44.1 kHz
Is what I’m saying correct?
- loub answered 11 years ago
if you use playDSP and use setFrequency, then the oscillator will continue generating at the same rate, but it will be interpolated by fmod’s mixer. If you change the rate with DSP::setParameter as you said, it changes the shape of the oscillator at the generator level, so yes they are different.
Please login first to submit.