this is mostly a logic problem, so i apologize for my question not
being cocoa specific.

i'm attempting to add my own continuous pitch variation effect
(vibrato) by assigning my sound's pitch to the path of a sine wave.
this is my callback method, which is repeating every 1/30 of a second.

- (void)vibratoCallBack:(NSTimer *)timer
        {
        float newPitch = 0.025 * 
sin(kDegreesToRadians(vibratoDegreeIncrements));
        self.pitch += newPitch;

        vibratoDegreeIncrements += kVibratoDegreeIncrements;  //this value is 45
        }

the default pitch is set at 1.0, so the above outputs the following
sine wave cycle:

Wrong Pitch: 1.000000
Wrong Pitch: 1.017678
Wrong Pitch: 1.042678
Wrong Pitch: 1.060355
Wrong Pitch: 1.060355
Wrong Pitch: 1.042678
Wrong Pitch: 1.017678
Wrong Pitch: 1.000000

however, if you look at those numbers they are not much of a sine
wave.  the reason, as far as i can see, is that self.pitch is adding
itself along with the sine wave increments.  i would like the pitch to
be movable while the vibrato effect is happening, but i can't seem to
find a way.  below is the proper sine wave output that i would like to
add to the current pitch:

Correct Pitch: 0.000000
Correct Pitch: 0.017678
Correct Pitch: 0.025000
Correct Pitch: 0.017678
Correct Pitch: 0.000000
Correct Pitch: -0.017678
Correct Pitch: -0.025000
Correct Pitch: -0.017678
Correct Pitch: -0.000000

therefore, if the pitch is at 1.0, i would like the output to look like this:

Desired Pitch: 1.000000
Desired Pitch: 1.017678
Desired Pitch: 1.025000
Desired Pitch: 1.017678
Desired Pitch: 1.000000
Desired Pitch: 0.917678
Desired Pitch: 0.925000
Desired Pitch: 0.917678
Desired Pitch: 1.000000

help would be greatly appreciated.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to