Theodeus / tuna

An audio effects library for the Web Audio API.
1.74k stars 125 forks source link

Phaser/Tremolo Tuna nodes only audible on left channel #40

Closed joshwcomeau closed 8 years ago

joshwcomeau commented 8 years ago

First, thanks so much for building such an awesome library!

I'm having an issue where Phaser and Tremolo are both only audible on the Left channel. Bitcrusher does not share the issue.

The value I set for stereoPhase does not seem to have any effect.

To check what was going on, I set up an interval to log out the values for L/R channels, but nothing appears to be amiss:

window.setInterval(() => 
  console.log(tremoloNode.amplitudeL.gain.value, tremoloNode.amplitudeR.gain.value), 
  500
);

/*
0.10021287947893143 0.11322055757045746
0.4889722168445587 0.3630233705043793
1.0914888381958008 0.9738174676895142
1.2686258554458618 1.2976855039596558
0.7367117404937744 0.8762662410736084
*/

Beyond that, I'm pretty stumped. My setup is fairly straightforward; After creating the node I connect it to an output (either another effect node, or context.destination).

When I use Bitcrusher or native Web Audio nodes, stereo works properly. When I set bypass to 1, as well, the stereo works.

If seeing the source would help, the tremolo node is created here, and updated here.

EDIT: It appears that the issue is just with Web Audio oscillators. I updated the example pen to use a Tremolo and a simple sine oscillator, and the left-channel-only bug exists: http://codepen.io/anon/pen/JRYawk?editors=0010

joshwcomeau commented 8 years ago

Ah, apparently this is just what happens when you use a mono source (eg. an oscillator) with a stereo splitter/merger.

For anyone else using oscillators, I found a solution on StackOverflow: http://jsbin.com/ayijoy/16/edit?html,js,output

Sorry to bug you with this!