Bug 127674

Summary: bufferSource's playbackRate param not controlled by oscillator (as in spec).
Product: WebKit Reporter: Jason Custer <jscuster>
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: crogers, jscuster, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.9   
Attachments:
Description Flags
html file with a similar script imbedded. When loaded, sound starts playing. When the bug is fixed, it will play with pitch oscillating. none

Description Jason Custer 2014-01-27 00:14:44 PST
Created attachment 222306 [details]
html file with a similar script imbedded. When loaded, sound starts playing. When the bug is fixed, it will play with pitch oscillating.

With this graph, vibrato should occur.
bufferSource.playbackRate < gain < oscillator.
In other words, connecting an oscillator (via gain to control depth) to the playbackRate audio parameter of a bufferSource node should change the pitch of a playing sound. 

The following script should cause the frequency of the bufferSource to range between 220Hz to 880Hz in a sinewave.

var c = window.webkitAudioContext ? new webkitAudioContext() : new AudioContext(),
b=c.createBuffer(1, 441, 44100), //one cycle of a 440Hz waveform at 44100 samples per sec
d=b.getChannelData(0), //a float32 array (to store generated data). 
n=c.createBufferSource(), //to play the buffer
amp=c.createGain(), //the amplitude of vibrato
master = c.createGain(), //so we don't blast our ears off
lfo = c.createOscillator(); //the oscillator for pitch change
n.playbackRate = 1.5; //depth will be 0.5, taking playbackRate from 1 (when osc = -0.5) to 2 (when osc is .5);
amp.gain.value = 0.5; //oscillator between -0.5 and .5
lfo.frequency.value = 4; //happens 4 times/second (you knew that)
lfo.type = "sine";
master.connect(c.destination); //keep the sound down
n.connect(master); //bufferSource
amp.connect(n.playbackRate); //***THE BUG starts here** playbackRate doesn't oscillate.
lfo.connect(amp); //lfo oscillates from -1 to 1, amp can make that larger or smaller.
//suppose we loaded a file in the buffer. Data generated below to demonstrate bug.
//generates a sort of sawtooth.
for (var i = 0; i < 441; i++) d[i] = i / 441;
master.gain.value = 0.2;
n.buffer = b; //our generated buffer
n.loop = true; //loops so get continuous sound
n.start(0); //start the sound
lfo.start(0); //start vibrato
Comment 1 Radar WebKit Bug Importer 2014-01-27 00:15:16 PST
<rdar://problem/15912715>
Comment 2 Jason Custer 2014-01-27 00:23:43 PST
Some info not sticking. This is the web audio component, I am using Version 7.0.1 (9537.73.11, 538+) Sorry for the multiple mods.