Page 1 of 1

Sending messages to JZZ.synth.OSC

PostPosted: Sun Feb 19, 2017 6:36 pm
by rob
Hello Sema and all,

Am working with JZZ.js and JZZ.synth.OSC. Very impressed so far, and learning a lot.
Am able to get it to play messages, but not to stop, or to accept any subsequent messages.

Docs say that all of the helper functions can be applied to the Midi-out port object. But it does not appear to work.
Why would port.allNotesOff(0); or port.stop() not affect anything?
I'm sure my question reveals my beginner-ness. I appreciate any help you can offer.


Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>A familiar tune...</title>
<script src='javascript/JZZ.js'></script>
<script src='javascript/JZZ.synth.OSC.js'></script>
</head>
<body>

<button style="font-size : 48px; height:100px; width:90%" onclick='play();'>Play</button>
<button style="font-size : 48px; height:100px; width:90%" onclick='stop();'>Stop</button>

<script><!--
JZZ.synth.OSC.register('Web Audio');

JZZ({sysex:true}).or('Cannot start MIDI engine!')
    .and(function(){ console.log(this.info()); });

var port = JZZ().openMidiOut().or(function(){alert('Cannot open MIDI port!');});

function stop() {
  port.send(JZZ.MIDI.allNotesOff(0));

  // port.stop();  none of the 'helpers' do anything
}

function play() {
  JZZ.util.iosSound();
  port.noteOn(0, 'e4', 30).wait(300).noteOff(0, 'e4')
       .noteOn(0, 'a3', 30).wait(300).noteOff(0, 'a3')
       .noteOn(0, 'c4', 30).wait(150).noteOff(0, 'c4')
       .noteOn(0, 'd4', 30).wait(150).noteOff(0, 'd4')
       .noteOn(0, 'e4', 30).wait(300).noteOff(0, 'e4')
       .noteOn(0, 'a3', 30).wait(300).noteOff(0, 'a3')
       .noteOn(0, 'c4', 30).wait(150).noteOff(0, 'c4')
       .noteOn(0, 'd4', 30).wait(150).noteOff(0, 'd4')
       .noteOn(0, 'e4', 30).wait(300).noteOff(0, 'e4')
       .noteOn(0, 'a3', 30).wait(300).noteOff(0, 'a3')
       .noteOn(0, 'c4', 30).wait(150).noteOff(0, 'c4')
       .noteOn(0, 'd4', 30).wait(150).noteOff(0, 'd4')
       .noteOn(0, 'e4', 30).wait(300).noteOff(0, 'e4')
       .noteOn(0, 'a3', 30).wait(300).noteOff(0, 'a3')
       .noteOn(0, 'c4', 30).wait(150).noteOff(0, 'c4')
       .noteOn(0, 'd4', 30).wait(150).noteOff(0, 'd4')
       .noteOn(0, 'e4', 100).wait(900).noteOff(0, 'e4')
       ;
}
--></script>

</body>
</html>

Re: Sending messages to JZZ.synth.OSC

PostPosted: Tue Feb 21, 2017 9:40 am
by sema
JZZ.synth.OSC is more like a demo synth, there are many MIDI messages it does not understand.
But I guess the allNotesOff message will be easy to add to the next release.

Re: Sending messages to JZZ.synth.OSC

PostPosted: Mon Mar 20, 2017 6:57 pm
by sema
I have updated JZZ.synth.OSC to understand allNotesOff, allSoundOff and dumper pedal messages.
Please check out the latest version.