Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting oscilloscope with audio using tone.js and nexus ui #90

Closed
nmwenz90 opened this issue Aug 21, 2017 · 3 comments
Closed

Connecting oscilloscope with audio using tone.js and nexus ui #90

nmwenz90 opened this issue Aug 21, 2017 · 3 comments

Comments

@nmwenz90
Copy link

Hi,

I'm trying to figure out why my oscilloscope isn't working with my audio. I tried using the .connect(node) from the api but it's still not working for me. What i get back when i run the console is "InvalidAccessError: Failed to execute 'connect' on 'AudioNode': cannot connect to a destination belonging to a different audio context."

here's the body of my html file

`

    <div id="button"></div>
    <div id="visualizer"></div>
    <canvas id="waveform" width=600 height="200"></canvas>
    
    <script>
        
  	//analyse the frequency/amplitude of the incoming signal	
	var fft = new Tone.Analyser("fft", 32);
    
	//get the waveform data for the audio
	var waveform = new Tone.Analyser("waveform", 1024);  
        
    var player = new Tone.Player ({
        "url" : "https://res.cloudinary.com/dvwvkt7iq/video/upload/v1502945343/fake_aah_qxkkcr.wav",
        "loop" : true
        
    })
   
        player.fan(fft,waveform);
        player.toMaster();
        


        

    var button = new Nexus.Button('#button',{
        'size': [80,80],
        'mode': 'aftertouch',
        'state': false
    })
        
        button.on('change', function(){
            if (button.state === true){
                player.start();
            }
            
            else{
                player.stop();
            }
            
        });
 // start it right away

// var canvas = document.getElementById('tutorial');
// var ctx = canvas.getContext('2d');

        var graphic = new Nexus.Oscilloscope('#visualizer')
        
        graphic.connect(waveform);
        
    </script>
    
</body>`

To see more go to:
https://nmwenz90.github.io/oscilloscope-test/

I'm new to javascript and apis help would be greatly appreciated.
Thanks!

@taylorbf
Copy link
Contributor

taylorbf commented Aug 22, 2017 via email

@nmwenz90
Copy link
Author

Yes this worked thanks so much!!!

@taylorbf
Copy link
Contributor

There is now clearer documentation about this in the description for the .connect() method of each audio visualization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants