Reputation: 25275
I have a simple synth that plays a 100hz tone using an OscillatorNode. My synth is about a whole step flat on safari iPad 4 ios 7.1.1, compared to all the other browsers I've tried (chrome iPad 4, safari ipad 2 ios 7.1.1, safari iPhone 5, chrome and safari on my mac). I've verified that the sample rate of the out-of-tune browser, iPad 4 safari, is 44100hz. The in-tune browsers report the same sample rate, 4400hz.
My code is pretty simple and I don't see how this could be a programming error on my part. Especially considering the iPad 2 and iPad 4 are running the same OS (and presumably the same version of safari). It seems like there's something weird, low-level and hardware-dependent going on.
Is this a known issue? If so, is there any way to test for it or work around it?
===== edit ========
Here's an example (safari only) -- dead simple oscillator test. Plays at one pitch on my iPhone 5s, a different pitch on my iPad 4. http://www.morganpackard.com/webaudio_test/OscillatorTest.html
var context = new webkitAudioContext();
var osc = context.createOscillator();
osc.connect(context.destination);
osc.frequency.value = 440;
osc.start(0);
Upvotes: 2
Views: 195
Reputation: 163468
This is probably due to one device playing at 44.1kHz and the other playing at 48kHz. There is probably a browser bug preventing the change of sample rate, and the subsequent misreporting of sample rate.
Chrome on Android has a similar issue where the record and playback sample rates must be identical. Since this doesn't typically happen when recording from the on-board microphone, for while it would seem that recording audio was always silent.
Upvotes: 1