Package jazzparser :: Package harmonical :: Package midi
[hide private]
[frames] | no frames]

Package midi

source code


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Submodules [hide private]

Functions [hide private]
tuple
tonal_space_note_events(coord, start, duration, origin_note=60, velocity=100)
Creates the MIDI events needed to play the given tonal space coordinate.
source code
tuple
tonal_space_tuning(coord, origin_note=60)
Produces MIDI single note tuning event data that will retune the equal temperament equivalent note of the given coordinate to the true pitch of that coordinate.
source code
 
frequency_note_number_floor(freq)
Given a float frequency, returns the midi note number that represents to nearest ET note below this frequency.
source code
 
tonal_space_et_note(coord, valid_note=False, origin_note=60)
Returns the MIDI note number of the note to which equal temperament maps the given 3D tonal space coordinate.
source code
 
et_note_frequency(note)
Calculates the frequency in Hz of the given MIDI note number, assuming equal temperament and 440Hz as the A above middle C.
source code
Variables [hide private]
  __package__ = 'jazzparser.harmonical.midi'
Function Details [hide private]

tonal_space_note_events(coord, start, duration, origin_note=60, velocity=100)

source code 

Creates the MIDI events needed to play the given tonal space coordinate. These will be a single-note tuning event (to retune the appropriate note), a note-on event and a note-off event.

Parameters:
  • coord (tuple) - 3D tonal space coordinate
  • start (int) - start time of note in ticks
  • duration (int) - length of the note in ticks
  • origin_note (int) - midi note number to assume the origin of the tonal space is equal to in pitch (default 60, middle C)
Returns: tuple
(tuning event, note on event, note off event)

tonal_space_tuning(coord, origin_note=60)

source code 

Produces MIDI single note tuning event data that will retune the equal temperament equivalent note of the given coordinate to the true pitch of that coordinate. This can, for example, be placed in a stream directly before a note-on event for that note to play the tonal space point.

If the resulting note number is outside the range of midi notes (0-127), it is shifted to the nearest octave that is within the range.

Parameters:
  • origin_note (int) - midi note number to assume the origin of the tonal space is equal to in pitch (default 60, middle C)
Returns: tuple
(note,semitone,cents), where note is the note to be tuned, and semitone and cents between them define the pitch to tune to. This can be used as note change data for a midi single note tuning event.

tonal_space_et_note(coord, valid_note=False, origin_note=60)

source code 

Returns the MIDI note number of the note to which equal temperament maps the given 3D tonal space coordinate.

Parameters:
  • valid_note (bool) - if True, permits only valid MIDI notes (i.e. in range 0-127). If the true note is outside this range, returns the note in the nearest octave that is in the range
  • origin_note (int) - midi note number to assume the origin of the tonal space is equal to in pitch (default 60, middle C)