Jazz-Soft.net
We make it sound!
Home » Examples » Jazz-Plugin » Set Volume

Set Volume

This example requires Jazz-Plugin v.1.2 or later.

How it works

This example shows how to use SysEx message to control volume.

NOTE: Although most MIDI devices understand common SysEx messages, some devices don't.

Page source

<!DOCTYPE html>
<html>
<head>
<title>Set Volume</title>

<style type="text/css">
.hidden {
 visibility: hidden;
 width: 0px;
 height: 0px;
 margin: 0px;
 padding: 0px;
 border-style: none;
 border-width: 0px;
 max-width: 0px;
 max-height: 0px;
}
</style>
</head>

<body>
<h1>Set Volume</h1>

<object id="Jazz1" classid="CLSID:1ACE1618-1C7D-4561-AEE1-34842AA85E90" class="hidden">
  <object id="Jazz2" type="audio/x-jazz" class="hidden">
<p style="visibility:visible;">This page requires <a href=http://jazz-soft.net>Jazz-Plugin</a> ...</p>
  </object>
</object>

<div id=selectmididiv class="hidden"><p>MIDI Out: <select id=selectmidi onchange='changemidi();'></select></p></div>

<p>
<button onmousedown='Jazz.MidiOutLong([0xF0,0x7F,0x7F,0x04,0x01,0x00,0x3F,0xF7]);'>Volume down</button>
<button onmousedown='Jazz.MidiOutLong([0x90,60,120,64,120,67,120]);' onmouseup='Jazz.MidiOutLong([0x80,60,0,64,0,67,0]);'> Play! </button>
<button onmousedown='Jazz.MidiOutLong([0xF0,0x7F,0x7F,0x04,0x01,0x7F,0x7F,0xF7]);'>Volume up</button>
</p>

<script><!--
var Jazz = document.getElementById("Jazz1"); if(!Jazz || !Jazz.isJazz) Jazz = document.getElementById("Jazz2");
function changemidi(){
 Jazz.MidiOutOpen(select.options[select.selectedIndex].value);
}
var select=document.getElementById('selectmidi');
try{
 var list=Jazz.MidiOutList();
 for(var i in list){
  select[i]=new Option(list[i],list[i],i==0,i==0);
 }
 document.getElementById('selectmididiv').className='';
}
catch(err){}
if(Jazz.isJazz){
 Jazz.MidiOutOpen(0);
}
--></script>

</body>
</html>

See also