• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Midi Note Length
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Midi Note Length


  • Subject: Re: Midi Note Length
  • From: "James Chandler Jr" <email@hidden>
  • Date: Fri, 7 Nov 2008 19:53:37 -0500

Hi Felipe

Apologies if I misunderstand the question so much that this answer doesn't even relate...

In all devices that conform to the MIDI spec, you turn on notes with a three-byte MIDI message (but just to make it a little more confusing, make a note to look up the topic of MIDI Running Status, where two byte messages can get used).

The first byte is the NoteOn MIDI status, a status byte range of 0x90 to 0x9F for the 16 channels.

The second byte is the chromatic pitch, in the range of 0x01 to 0x7F in semitones. A reference pitch of middle C would be 0x3C.

The third byte is the note velocity, and it must be in the range of 0x01 (minimum velocity) up to 0x7F (maximum velocity).

===

There are two ways to turn off a note:

1. Send a NoteOn message with the velocity byte set to zero.

 For instance, Middle C on channel 16, maximum velocity, 1000 ms duration
 [ON]: 0x9F  0x3C  0x7F
 [wait 1000 ms]
 [OFF]: 0x9F  0x3C  0x00

2. Send a NoteOff message, a status byte in the range of 0x80 to 0x8F. The velocity byte is interpreted as 'release velocity' and can affect actual performance in a few rare synthesizers, but usually the velocity byte seems to be ignored by most synthesizers.

For instance, Middle C on channel 16, maximum velocity, 1000 ms duration
[ON]: 0x9F 0x3C 0x7F
[wait 1000 ms]
[OFF]: 0x8F 0x3C 0x40
(using a medium-value NoteOff release velocity, in case the synthesizer cares about the velocity)


Method 1 is probably most common. Some programs' MIDI output streams might never contain 0x8x NoteOff messages, preferring to exclusively use 0x9x messages for both ON and OFF.

Sometimes if you don't notice the zero velocity values of some NoteOn messages, a message might appear to be a NoteOn, when the velocity byte of zero, signifies it as the matching OFF of a previously sent ON message.

===

An additional wrinkle-- You cannot count on how synthesizers will behave if you turn on multiple identical overlapping notes.

For instance if you send three NoteOn messages for Middle C, and wait, and then send three NoteOff messages for Middle C--

 [ON]: 0x9F  0x3C  0x7F
 [wait 100 ms]
 [ON]: 0x9F  0x3C  0x7F
 [wait 100 ms]
 [ON]: 0x9F  0x3C  0x7F
 [wait 800 ms]
 [OFF]: 0x9F  0x3C  0x00
 [wait 100 ms]
 [OFF]: 0x9F  0x3C  0x00
 [wait 100 ms]
 [OFF]: 0x9F  0x3C  0x00

Some synthesizers would assign 3 overlapped voices to play the three identical notes. Other synthesizers would automatically kill the first Middle C before it starts up the second Middle C, so that there is never more than one voice playing a Middle C at any one time.

There may be other behaviors encountered, as there is no cosmic law that all synthesizers are always bug-free (grin).

The above example string of MIDI messages should work without error on virtually all synthesizers, but what you hear in the audio might sound different in different synthesizers.

It is a good practice to keep up with all NoteOn's you send, and always match each NoteOn message with a later NoteOff message.

Sorry if this is explained poorly or if it doesn't even answer the question.

James Chandler Jr.

----- Original Message ----- From: "Felipe Mathies" <email@hidden>
To: "William Stewart" <email@hidden>
Cc: <email@hidden>
Sent: Friday, November 07, 2008 6:23 PM
Subject: Re: Midi Note Length



Hi thanks for the atention...
Im using this example...but until a play de same note...to turn that
off...the previos note have to play all the time....but this is not
happend... the note play a little and stop...without send another
message....

Is this the right behavier??

Thanks!!!!


-- Felipe Mathies msn: email@hidden skype: voorhees1986 blog : http://www.felipemathies.com



--------------------------------------------------------------------------------


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Midi Note Length
      • From: "James Chandler Jr" <email@hidden>
References: 
 >Midi Note Length (From: "Felipe Mathies" <email@hidden>)
 >Re: Midi Note Length (From: William Stewart <email@hidden>)
 >Re: Midi Note Length (From: "Felipe Mathies" <email@hidden>)

  • Prev by Date: Re: Midi Note Length
  • Next by Date: Re: Midi Note Length
  • Previous by thread: Re: Midi Note Length
  • Next by thread: Re: Midi Note Length
  • Index(es):
    • Date
    • Thread