Skip to content

jazz-soft/JZZ-synth-Tiny

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
February 6, 2023 20:51
February 6, 2023 20:51
May 15, 2022 00:03
May 7, 2022 00:21
October 16, 2018 21:31
October 16, 2018 21:31
April 22, 2022 23:21
November 17, 2022 22:12
March 10, 2021 21:49
October 24, 2018 01:58

JZZ-synth-Tiny

npm npm jsDelivr build Coverage Status Try jzz-synth-tiny on RunKit

Tiny Web-Audio GM Synthesizer (g200kg/webaudio-tinysynth) wrapped for JZZ.js

Includes all General MIDI instruments, plus, you can load your own sounds.

Please check the demo...

Install

npm install jzz-synth-tiny
or yarn add jzz-synth-tiny
or get the full development version and minified scripts from GitHub

Usage

Plain HTML
<script src="JZZ.js"></script>
<script src="JZZ.synth.Tiny.js"></script>
//...
CDN (jsdelivr)
<script src="https://cdn.jsdelivr.net/npm/jzz"></script>
<script src="https://cdn.jsdelivr.net/npm/jzz-synth-tiny"></script>
//...
CDN (unpkg)
<script src="https://unpkg.com/jzz"></script>
<script src="https://unpkg.com/jzz-synth-tiny"></script>
//...
CommonJS
var JZZ = require('jzz');
require('jzz-synth-tiny')(JZZ);
//...
AMD
require(['JZZ', 'JZZ.synth.Tiny'], function(JZZ, dummy) {
  // ...
});

API

Play directly
JZZ.synth.Tiny().noteOn(0, 'C5', 127)
   .wait(500).noteOn(0, 'E5', 127)
   .wait(500).noteOn(0, 'G5', 127)
   .wait(500).noteOff(0, 'C5').noteOff(0, 'E5').noteOff(0, 'G5');
Register as a MIDI port
JZZ.synth.Tiny.register('Web Audio');

JZZ().openMidiOut('Web Audio').noteOn(0, 'C5', 127)
   .wait(500).noteOn(0, 'E5', 127)
   .wait(500).noteOn(0, 'G5', 127)
   .wait(500).noteOff(0, 'C5').noteOff(0, 'E5').noteOff(0, 'G5');

To make vitual port visible by Web MIDI API, please check the instructions at https://github.com/jazz-soft/JZZ#virtual-midi-ports

Get/Set sound
var synth = JZZ.synth.Tiny();
var tuba = synth.getSynth(58); // tuba
var drum = synth.getSynth(36, true); // bass drum
synth.setSynth(0, tuba); // set tuba to program 0 (it was piano originally);
synth.setSynth(35, drum, true); // set bass drum to percussion instrument 35;

See more details at https://github.com/g200kg/webaudio-tinysynth#timbre-object-structure

More information

Please visit https://jazz-soft.net for more information.