Hi all, I'm having a strange problem with the AUSampler on iOS. When I use it to play a long sample of a sustained note (without looping), it suddenly goes out of tune in the middle of a note.
To verify that I'm not imagining this, I created a test case using a soundfont containing a single sample of 10 seconds of 440 Hz sine wave, mapped to MIDI note 69 (A). When I load this soundfont into the AUSampler and play MIDI note 64 (F), the output has the correct pitch at first, but about 2 seconds into the note it suddenly jumps to about 6 cents sharp, and about 8 seconds into the note it jumps to about 26 cents (!) flat. This happens both in the iOS simulator and on the device. I have captured the output from this test digitally using the simulator and SoundFlower; you can listen to it here: http://www.gson.org/bugs/apple/ausampler/AUSampler-pitch-jumps.wav The soundfont I used, with the sine wave as bank 0 patch 0 is here: http://www.gson.org/bugs/apple/ausampler/Sine.sf2 Is anyone else seeing/hearing this? Is there anything that can be done about it? I suspect this may be caused by a loss of floating point precision somewhere inside AUSampler, because I once made the mistake of trying to generate a sine wave using naive C code like this: float t = 0; float dt = 1.0 / fs; for (;;) { output(sinf(w * t)); t += dt; } where the "t += dt" progressively loses precision as "t" grows, and the output exhibited jumps in pitch quite similar to the ones I'm now hearing from AUSampler. -- Andreas Gustafsson, [email protected] _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
