Sending messages to JZZ.synth.OSC

Asynchronous MIDI library for Node.js and HTML

Sending messages to JZZ.synth.OSC

Postby rob » Sun Feb 19, 2017 6:36 pm

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>
rob
 
Posts: 1
Joined: Tue Dec 20, 2016 7:50 am

Re: Sending messages to JZZ.synth.OSC

Postby sema » Tue Feb 21, 2017 9:40 am

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.
sema
Site Admin
 
Posts: 328
Joined: Mon Oct 17, 2011 7:28 pm

Re: Sending messages to JZZ.synth.OSC

Postby sema » Mon Mar 20, 2017 6:57 pm

I have updated JZZ.synth.OSC to understand allNotesOff, allSoundOff and dumper pedal messages.
Please check out the latest version.
sema
Site Admin
 
Posts: 328
Joined: Mon Oct 17, 2011 7:28 pm


Return to JZZ.js

Who is online

Users browsing this forum: No registered users and 1 guest

cron