mudcube / MIDI.js

:musical_keyboard: Making life easy to create a MIDI-app on the web. Includes a library to program synesthesia into your app for memory recognition or for creating trippy effects. Convert soundfonts for Guitar, Bass, Drums, ect. into code that can be read by the browser. Supports multiple simultaneous instruments and perfect timing.
http://mudcu.be/midi-js/
MIT License
3.79k stars 640 forks source link

Opposite of MIDI.setEffects() ? #175

Open desafinadude opened 8 years ago

desafinadude commented 8 years ago

Hi

Is there an opposite of MIDI.setEffects() to turn off an effect?

Thanks

shivrajsa commented 8 years ago

#174 Could you please share example how to use MIDI.setEffects() in MIDI.js,

desafinadude commented 8 years ago

Hi

I just put it in a function function moog() { MIDI.setEffects([{ type: "MoogFilter", bufferSize: 4096, bypass: false, cutoff: 0.065, resonance: 3.5 } ]); }

And then called it with a button click. Worked as expected.

$( "#moog" ).click(function() { moog(); $(this).addClass('on'); });

Hope this helps...now if only I can get it to stop.

shivrajsa commented 8 years ago

It did not work for me, I still don't understand. Where should I call moog() function in below code (basic example from library)? please guide.

`window.onload = function () {
MIDI.loadPlugin({
    soundfontUrl: "./soundfont/",
    instrument: "acoustic_grand_piano",
    onprogress: function(state, progress) {
        console.log(state, progress);
    },
    onsuccess: function() {
        var delay = 0; // play one note every quarter second
        var note = 50; // the MIDI note
        var velocity = 127; // how hard the note hits
        // play the note
        MIDI.setVolume(0, 127);

        MIDI.noteOn(0, note, velocity, delay);
        MIDI.noteOff(0, note, delay + 0.75);*/
    }
});
};`
desafinadude commented 8 years ago

Have you tried putting it IN the onsuccess? Before the MIDI.noteOn? That should work.

shivrajsa commented 8 years ago

Yes, it working. I tried same before, but input values of Tuna effects were small to create significant effect. After giving high input values I can hear effect.

Thank you for all your help.

shivrajsa commented 8 years ago

I am not expert but just to share my thought on your question, you can reset effect properties to turn off an effect.

desafinadude commented 8 years ago

Yip - I thought the same thing. And it probably will work. Essentially a bypass. But just thought there might be a complete remove as well. But, if not, I'll go this route. :-)

shivrajsa commented 8 years ago

In my app, I have a requirement to change (slightly) the frequency of note from standard frequency while playing with MIDI.js (noteOn, noteOff). Is it possible to achieve this with Tuna.js or with other method?

Could you please check issue #176, & guide if you have any suggestion to achieve that