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

Just a suggestion #36

Open
Enderlook opened this issue Aug 15, 2018 · 0 comments
Open

Just a suggestion #36

Enderlook opened this issue Aug 15, 2018 · 0 comments

Comments

@Enderlook
Copy link

Hi, I'm new to GitHub so I don't understand how to use it so I'm sorry if this is the wrong place to post a suggestion, I haven't found that button.
I'm new making music and I was trying to analyze the music produced by band.js but I didn't found a method to do that, so I create mine as I could, (I'm also new in this field).

This is how I make it. I was thinking maybe it could be added because with an audio context analyser is possible to make a visualization of the music (e.g: to make a visualization addon?).

On conductor.js after line 67:

    conductor.analyser = conductor.audioContext.createAnalyser();
    conductor.bufferLength = conductor.analyser.frequencyBinCount;
    conductor.dataArray = new Uint8Array(conductor.bufferLength);

On noises.js in line 20 add the parameter analyser like:

function NoisesInstrumentPack(name, audioContext, analyser) {

And change the createNote statement of line 32 to:

createNote: function(destination) {
	    let tmp;
            switch (name) {
                case 'white':
                    tmp = createWhiteNoise(destination);
		    break;
                case 'pink':
                    let tmp = createPinkNoise(destination);
                    break;
                case 'brown':
                case 'brownian':
                case 'red':
                    let tmp = createBrownianNoise(destination);
                    break;
            }
	    tmp.connect(analyser);
	    return tmp;
        }

On oscillators.js add the parameter analyser in line 18 like this:

function OscillatorInstrumentPack(name, audioContext) {

And in line 31 add:

o.connect(analyser);

On instrument.js add a parameter conductor.analyser to line 73 as:

instrument.instrument = conductor.packs.instrument[pack](name, conductor.audioContext, conductor.analyser);

And then do something on player.js, not sure exactly what but for example add an interval in play function (line 243):

setInterval(function(){
            conductor.analyser.getByteTimeDomainData(conductor.dataArray)
            console.log(conductor.dataArray);
        }, 100)

P.S: Sorry for my English.

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

1 participant