Hi
I try to use the pitch parameter in unity iPhone 1.7 with the following code:
function Update () {
Debug.Log(audio.pitch);
audio.pitch+=0.01;
}
I attached it to an audiosoruce object, the sound is a stereo wave file, uncompressed, 44.1kHz, 16 bit. But the sound is not shifted in pitch. What do I do wrong? Thanks for the help!
I would never change a value in Update without multiplying it by Time.deltaTime to make it frame rate independent. But I doubt that would lead to your problem.
generally, yes. Though you might use something like for certain effects:
audio.pitch = transform.position.y*0.1
Regarding the problem, please try a MONO wav file and see if the problem persists. I know MP3 pitching is not possible, but not sure about stereo wavs - have a feeling it may only work in mono, but cannot check right now.
I found out that it doesn’t work on the emulator. i.e., when using Unity Remote, the sound pitch doesn’t change. But it works fine on the built. I think it is a bug. Thanks for your help!
[quoteI found out that it doesn’t work on the emulator. i.e., when using Unity Remote[/quote]
Ah, ok. I never use Remote (I add an extra keyboard+mouse control script to all my iPhone projects so I can just play the build by running it in the editor - great for quick testing).