electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Twyndyllyngs - starting a little late tonigh Chez Mosc
Please visit the chat
 Forum index » Discussion » Schmooze
WEB MIDI API and Browser-based javascript plug-in
Post new topic   Reply to topic
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
MusicMan11712



Joined: Aug 08, 2009
Posts: 937
Location: Upstate New York USA
Audio files: 149

PostPosted: Tue Jul 23, 2013 9:03 am    Post subject: WEB MIDI API and Browser-based javascript plug-in Reply with quote  Mark this post and the followings unread

I stumbled onto two things that might be of interest to some:

javascript browser plugin for windows and mac to enable people to do browser based midi stuff. I installed it in FF and tried some of the demos. They worked.

http://jazz-soft.net/


Evidently the Web MIDI API makes use of this plug-in.

"This JS library is a prototype polyfill and shim for the Web MIDI API (of which I am a co-author), using Jazz-Soft.net's Jazz-Plugin to enable MIDI support on Windows and OSX. You need to have at least version 1.2 of the Jazz-Plugin in order for this polyfill to work properly. This polyfill and the plugin should work on Chrome, Firefox, Safari, Opera and IE."

https://github.com/cwilso/WebMIDIAPIShim

http://www.w3.org/TR/webmidi/

Steve
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 3912
Location: Sweden
Audio files: 316
G2 patch files: 99

PostPosted: Tue Jul 23, 2013 10:47 am    Post subject: Reply with quote  Mark this post and the followings unread

Cool! I might check this out at some point. Smile
_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
MusicMan11712



Joined: Aug 08, 2009
Posts: 937
Location: Upstate New York USA
Audio files: 149

PostPosted: Wed Jul 24, 2013 5:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Jazz-soft.net's discussion board stated that they were looking to add sysex ID request replies to their database--which I think is a wonderful idea. In order to post to their forum, people need to register and activate their memberships from an e-mail. However, evidently activation e-mails were not being sent out as of yesterday. I am not sure what's up with that--whether they send those out manually, they have closed memberships, or they are starting to privatized the plugin.
Steve
Back to top
View user's profile Send private message
MusicMan11712



Joined: Aug 08, 2009
Posts: 937
Location: Upstate New York USA
Audio files: 149

PostPosted: Sat Aug 03, 2013 6:33 am    Post subject: Reply with quote  Mark this post and the followings unread

My request to join the Jazz-Soft Community has not received any response to date, so I e-mailed the site owner to see what's up. As of today, the plug-in and demos were available, but who knows what the future of this tool is.
--Steve
Back to top
View user's profile Send private message
diegohn



Joined: Nov 06, 2014
Posts: 3
Location: Spain

PostPosted: Wed May 11, 2016 2:11 pm    Post subject: Web midi API Reply with quote  Mark this post and the followings unread

A short time ago, I have learnt that MIDI instruments can also be accessed in a web browser with Javascript and the Web Midi API (https://webaudio.github.io/web-midi-api/)

In my case I am using Google Chrome and Windows.
For some reason Google Chrome does not allow me to access Microsoft GS Wavetable synth directly, so I have to use loopmidi to create a new midi port and MIDI-OX to listen to the output (both are free programs).

Having solved the configuration, if you save the following code as an html page (and specify your loopmidi port name correctly) it should produce some sound.

Code:

<html>
<head>
<style>
</style>
<script>
var midi = undefined;  // global MIDIAccess object
var midiDevice = "loopMIDI Port 1"; //the name you give to the loopmidi port you want to use
var bt = 0.1;  //baseTime (in seconds)

//AUXILIARY FUNCTIONS

function init() {
   navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );
}

function sendMidiMessage(data1,data2,data3,output) {
   var msg = [data1,data2,data3];
   output.send(msg);
}

function sendMidiMessageDelayed(data1,data2,data3,output,delay_s) {
   var msg = [data1,data2,data3];
   output.send(msg, window.performance.now() + (delay_s*1000));
}

function playSound(channel,freq,vel,time,dur) {
   var portID = findMidiPort();
   var output = midi.outputs.get(portID);
   setTimeout(function(){
   sendMidiMessage(144+channel,freq,vel,output);
   sendMidiMessageDelayed(128+channel,freq,vel,output,dur);
   },time*1000);
}

function findMidiPort() {
   for (i=0; i<midi.outputs.size; i++) {
      if (midiDevice==midi.outputs.get(i).name) {
         return midi.outputs.get(i).id;
      }
   }
   return -1;
}

function programChange(channel, instrument) {
var portID = findMidiPort();
var msg = [192+channel, instrument];
var output = midi.outputs.get(portID);
  output.send( msg ); 
}

//'SHEET MUSIC'
function onMIDISuccess( midiAccess ) {
  midi = midiAccess;
  //select instruments
 
  programChange(0,10);
  programChange(1,20);
  programChange(9,0);
 
  //score
  measureA(0);
  measureA(bt*16);
  measureA(bt*32);
  measureA(bt*48); 
 
}

function measureA(et) {
  playSound(0,60,90,et+0,bt);
  playSound(0,62,90,et+bt,bt);
  playSound(0,62,90,et+(bt*2),bt);
  playSound(0,64,90,et+(bt*3),bt);
 
  playSound(1,67,120,et+0,bt);
  playSound(1,69,120,et+bt,bt*2);
  playSound(1,67,120,et+(bt*3),bt);
   
  var z = Math.floor(Math.random()*3)+1;
  var secondNote = 64;
  if (z==2) {secondNote = 69;}
   
     
  playSound(1,66,120,et+(bt*8),bt*4);
  playSound(1,71,120,et+(bt*8),bt*4);
  playSound(1,secondNote,120,et+(bt*12),bt*4);
  playSound(1,secondNote+5,120,et+(bt*12),bt*4);
 
  //percussion
  playSound(9,60,120,et+(bt*2),bt*0.5);
  playSound(9,65,120,et+(bt*2.5),bt*0.5);
  playSound(9,62,120,et+(bt*6),bt*0.5);
  playSound(9,62,120,et+(bt*6.5),bt*0.5);
  playSound(9,62,120,et+(bt*10),bt*0.5);
  playSound(9,69,120,et+(bt*10.5),bt*0.5);
  playSound(9,62,80,et+(bt*14),bt*0.5);
  playSound(9,69,60,et+(bt*14.5),bt*0.5);
}

function onMIDIFailure(msg) {
  alert( "Failed to get MIDI access");
}

</script>
</head>
<body>
<h1>Web midi api test</h1>
<button onclick="init()">Test</button>
</body>
</html>
Back to top
View user's profile Send private message
MusicMan11712



Joined: Aug 08, 2009
Posts: 937
Location: Upstate New York USA
Audio files: 149

PostPosted: Wed May 11, 2016 2:32 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the update on the WebMIDI API. I have done some more things with the Jazz-Soft plug-in over the past several months, because a few years ago it had more functionality than the WebMIDI API and I just continued to build on what I had done. However, I had it on the back burner revisit the WebMIDI API and now I am wondering if I can port my Jazz-Soft test web pages to the WebMIDI API. One of these days, I will take another look at it. So, thanks for the reminder!
Steve
PS: I have a lot of gear specific sysex buttons on a webpage I haven't uploaded to my site yet (E-Mu mostly, some Casio). One of these days I will make it so others can use it. Also, I know of someone who did a web-based Casio VZ patch editor using the Jazz-Soft plug-in. If the WebMIDI API can be used like that, there maybe be more potential to it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [6 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Discussion » Schmooze
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use