- From: Jan Deinhard <jan.deinhard@gmail.com>
- Date: Wed, 6 Mar 2013 10:32:55 +0100
- To: public-audio@w3.org
- Message-ID: <CAG=22kcpN51Uw59C2dePX41N=DdPtfM55dOeDGwGiY5mB9sPaA@mail.gmail.com>
Hello, when I run the following code and then change the audio output device to a device with a different sample rate the sound is distorted. var context = new webkitAudioContext(); var gain = context.createGainNode(); gain.gain.value = 0.05; var osc = context.createOscillator(); osc.type = 0; osc.frequency.value = 440; osc.connect(gain); gain.connect(context.destination); osc.noteOn(0); http://jsfiddle.net/cQswX/1/ Even if I create a new context in the same tab after I changed the output device the sound is still distorted. Only after I opened a new tab (in Chrome) Web Audio API seems to adapt to the new settings. I noticed this behavior when I plugged in head phones to my notebook which is connected to a Cinema Display. The display audio device has a sample rate of 48 kHz. The internal device has 44.1 kHz. The display was the initial output device. When I plugged in the head phone the output switched to the internal audio device. When I started playback the audio was distorted. Is there anything I can do about this in an application using Web Audio API? Is there a way to detect the changed settings? Or is it just a deficiency in WebKit? Best regards Jan
Received on Wednesday, 6 March 2013 09:59:47 UTC