Web Audio API: Pan audio (left/right) + controlling gain

I want to create a very basic AudioContext()-instance playing a sound either on the left or on the right channel.

I know, there is already an answer about this here: http://stackoverflow.com/a/20850704/1138860

My problem is, I have to control the gain via a GainNode. Whenever I conntect the GainNode, it makes the left/right channel to output sound again.

I extended the original Example from the answer with a GainNode: http://jsbin.com/cofiwugeca/4/edit?js,output


It looks like you connect the source to the gain node and then connect the gain node directly to the destination. So now your source is gets to the destination via the panner and the gain node. Connect your gain node to the panner instead of the destination. I think that will fix it.

Need Your Help

Add itemprop=“name” snippet to an image's title

html5 web microdata rich-snippets

I have a user profile image in my website and I want to tag it both as "image" and as "name" for a "person" itemtype. The name appears when the user hovers over the image, so I thought about extrac...

Uploading game scores and calculating percentile

c# windows-phone-8 azure-mobile-services

I am writing a simple mobile game at the end of which, the score of the player along with his playerid is uploaded to a database in the cloud. This database maintains the high-scores for every pla...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.