问题
I've been working on a cross platform Cordova app using WebAudio for sound synthesis and have recently begun having trouble with distorted audio output after upgrading my phone to iOS 9.2. Basically, on 2 out of 3 runs of the app on my phone, oscillator output will be buzzy and sound distorted, possibly as if it's running at the wrong sample rate. Prior to the upgrade I'd never encountered the issue, but now even a simple audio chain like so will end up manifesting the problem:
this.osc = audCtx.createOscillator();
this.osc.type = 'sine';
this.oscVol = audCtx.createGain();
this.osc.connect(this.oscVol);
this.oscVol.connect(audCtx.destination);
I've seen a couple references to this or similar problems around the web, cf
Distorted audio in iOS 7.1 with WebAudio API
And a comment by Mitch Wells in the following: http://www.holovaty.com/writing/ios9-web-audio/
In the first example the problem is occurring with audio sample playback, while I'm using simple oscillators, so I'm not sure about the applicability of an already tough to implement answer. In the second, I reached out to Mitch and he had not found a resolution.
Any thoughts, ideas, workarounds?
Update: May have found an aswer: https://stackoverflow.com/a/34501159/3175029
来源:https://stackoverflow.com/questions/34697493/distortion-in-webaudio-api-in-ios9