Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MIDI out #2

Open
whatmusicreallyis opened this issue Feb 21, 2018 · 2 comments
Open

Implement MIDI out #2

whatmusicreallyis opened this issue Feb 21, 2018 · 2 comments

Comments

@whatmusicreallyis
Copy link
Collaborator

Web MIDI API: https://www.w3.org/TR/webmidi/

A. The simple Way: ability to send MIDI note on/off messages across multiple MIDI channels.
B. The Professional Approach: ability to send real-time MIDI Tuning Standard System Exclusive messages.

A. Detailed example of multichannel MIDI mapping.

Background: use existing multichannel keyboard mapping implementation as reference.

Official support for the hardware Terpstra Keyboard includes the acclaimed physical modeling software engine Pianoteq. Their custom multichannel keyboard mapping for up to 16*128 notes implemented specifically for the Terpstra works like this:

Let's assume the simplest example with any N-tone scale and the reference frequency of 440 Hz.

  • Load your custom N-tone scale.
  • The Keymap menu has a new feature called "Extended layout for up to 16*128 notes". Tick the option "Multi-channel MIDI layout".
  • Play MIDI note 69 on channel 1, tone is 440 Hz. MIDI note 69+N gives 880 Hz, while 69-N 220.
  • Play MIDI note 69 on channel 2, tone is 880 Hz. MIDI note 69+N gives 1760 Hz, while 69-N 440.
  • Play MIDI note 69 on channel 16, tone is 220 Hz. MIDI note 69+N gives 440 Hz, while 69-N 110.
  • ... and so on.

The reference frequency changes according to the scale's Interval of Equivalence (in this case 2/1) on the same MIDI note of every subsequent MIDI channel. The scale gets expanded according to its number of tones N in both directions. Other diapasons, as well as the MIDI note for scale's 1/1 can be controlled by loading an additional *.kbm mapping file.

This approach won't need pitch bending or anything fancy, just the ability to send MIDI note on/off messages across multiple MIDI channels. It will then be up to the user to load the *.scl tuning file from the WebApp in the external sound engine.

B. Send real-time MTS SysEx signals.

«MTS 3-byte single note tuning is the most accurate method.» (Scala Relay)

The MIDI Specification's "Single Note Tuning Change (real-time)" was designed for dynamic tuning.

«The MIDI Tuning Standard was ratified by the MIDI Manufacturers' Association in January 1992. Manufacturers have the option of supporting the tuning standard partially or in full.»
http://www.microtonal-synthesis.com/MIDItuning.html

For «an addition to the MIDI specification which allows the sharing of “microtunings” ... and the
switching of these tunings during real-time performance» see page 47 (pdf 79) of
The Complete MIDI 1.0 Detailed Specification v. 96.1 third edition

@yashton
Copy link

yashton commented Oct 3, 2019

I've done a bunch of refactoring to get midi hooked in, and I have succeeded in sending standard note-on/off messages via web midi and have tried to send sysex messages for midi tuning. I've been using MainStage3 to test, but it doesn't take in sysex for tuning. I downloaded the trial for Pianoteq, and I've sent messages according to the spec, but I'm not sure if it is being interpreted correctly, if I'm looking in the wrong place to see the change, or if there's something implementation specific.

Screen Shot 2019-09-15 at 11 13 14 PM

@yashton
Copy link

yashton commented Oct 4, 2019

Okay, I was only sending one 0x7f, and some of the information on the Pianoteq forums was wrong. I got it working:

f.send([0xf0, 0x7f, 0x7f, 0x08, 0x02, 0x00, 0x01, 0x29, 0x3c, 0x34, 0x22, 0xf7]);
Screen Shot 2019-10-04 at 5 16 28 PM

Next question: is the best way to send tuning data before every note, or do a major dump on configure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants