Win32API::MIDI::SysEX - Perl Module for MIDI System Exclusive Message.
use Win32API::MIDI::SysEX; $se = new Win32API::MIDI::SysEX; $d = $se->turnGeneralMIDISystemOff; $d = $se->turnGeneralMIDISystemOn; $d = $se->masterVolume(0xD20);
This module is still under development and most of function are not debugged yet. And the this module may have to be renamed as MIDI::SysEX in the future, since this module is dependent with Microsoft Windows.
MIDI manufacturer's ID is distributed as follows.
not used American European Japanese Other Special 1 byte ID: 00 01 -- 1F 20 -- 3F 40 -- 5F 60 -- 7C 7D -- 7F 3 byte ID: 00 00 00 00 00 01 00 20 00 00 40 00 00 60 00 00 1F 7F 00 3F 7F 00 5F 7F 00 7F 7F 7D: non-commercial use (e.g. schools, research, etc.) 7E: Non-Real Time Universal System Exclusive ID 7F: Real Time Universal System Exclusive ID (all call device ID)
Standard MIDI System Exclusive Messages use LSB first (a kind of little endian) notation. By following this rule, a 3 byte ID "xxh yyh zzh" in MIDI specification is expressed as 0xzzyyxx in this module. By using this notation we can distinguish "01h" (Sequential: 0x01) from "00h 00h 01h" (Time Warner Interactive: 0x010000).
The following methods are provided.
Returns the manufacturer name for manufacturer's ID.
Returns the manufacturer ID whose manufacturer's name equals with name. Returns undef when no matches.
The value for device ID option (argument) should be a number from 1 to 16 (not 0 to 15).
deviceID [devID]: Device ID. If device_ID is omitted, BRD+1 broadcast, all call, 127+1) is used. The device ID is used on every method calls. You can create any numbers of object with different device ID. manufacturersID [mID]: manufacturers ID. If omitted, 0x7d (Non-commercail use) is used. manufacturerName [mName]: manufacturers name. It must be one of key of %Win32API::MIDI::mID modelID [mdlID]: MIDI device model ID modelName [mdlName]: MIDI device model name.
pp_1B:packet number (1 byte)
sample_format: # of significant bits from 8-28 sample_period_3B: 1/sample_rate in nanosecond loop_type: 00=forward only, 01=backward/forward, 7f=loop off
running_packet_count_1B: 0-127 data: 120 bytes of data
loop_type: 00 = Forwards Only (unidirectional) 01 = Backwards/Forwards (bi-directional) 7F = Off
manufacturer's_ID : 1 or 3 byte ID
parseIdentityReply() returns list of;
device ID (1 byte) manufactures ID (1 byte or 3 byte) device family code (2 byte) device family member code (2 byte) software revision level (4 byte)
Or returns NULL list if data format of identity_reply_data is illegal.
identity_reply_data
type: "MIDI" : MIDI File "MIEX" : MIDIEX File "ESEQ" : ESQ File "TEXT" : 7-bit ASCII Text File "BIN " : binary file "MAC " : Macintosh file (with MacBinary header)
Returns undef if type or file_name is illegal value.
type
file_name
type: see fileDumpRequest().
Maximum data length is 112 byte.
pn: tuning program number (0-127)
pn: tuning program number (0-127) tuning_name: 16 ASCII characters data: 3 x 128 bytes frequency data
pn: tuning program number (0-127) nc: number of changes data: 4 x nc bytes data
bar_number: 0x2000 not running 0x2001 - 0x0000 count-in 0x0001 - 0x1FFE bar number in song 0x1FFF running: bar number unknown
nbn : number of beats (numerator) of time signature bdn : beat value (denominator) of time signature (negative power of 2) nc : number of MIDI clocks in a metronome click nn : number of notated 32nd notes in a MIDI quarter note Example 3/4 : nb0 = 3, bd0 = 2 4/4 + 3/8 : nb0 = 4, bd0 = 2, nb1 = 3, bd1 = 3
volume : 0x0000 = volume off 0x3FFF = maximum volume
balance : 0x0000 = hard left 0x2000 = center 0x3fff = hard right
parameter = 0: Reverb Type 0: small room 1: medium room 2: large room 3: medium hall 4: large hall (default) 5: plate parameter = 1: Reverb Time 0: 44 (1.1s) 1: 50 (1.3s) 2: 56 (1.5s) 3: 64 (1.8s) 4: 64 (1.8s) 8: 50 (1.3s)
parameter = 0: Chorus Type 0: Chorus 1 1: Chorus 2 2: Chorus 3 3: Chorus 4 4: FB Chorus 5: Flanger parameter = 1: Modulation Rate MR = value * 0.122 (MR: modulation frequency in Hz) parameter = 2: Modulation Depth MD = (value+1) / 3.2 (MD: peak-to-peak swing of modulation in ms) parameter = 3: Feedback FB = value * 0.763 (FB: amount of feedback from Chorus output in percent) parameter = 4: Send to Reverb CTR = value * 0.787 (CTR: send level from Chorus to Reverb in percent)
Controller Destination Setting, Channel Pressure (Aftertouch)
pp rr description 00 Pitch Control 0x28-0x58 -24 - +24 semitones 01 Filter Cutoff Control 0x00-0x7f -9600 - +9450 cents 02 Amplitude Control 0x00-0x7f 0 - (127/64)*10 percent 03 LFO Pitch Depth 0x00-0x7f 0 - 600 cents 04 LFO Filter Depth 0x00-0x7f 0 - 2400 cents 05 LFO Amplitude Depth 0x00-0x7f 0 - 100 percent
Controller Destination Setting, Controller (Control Change)
cc : controller number 0x01 - 0x1f, 0x40 - 0x5f pp rr description 00 Pitch Control 0x28-0x58 -24 - +24 semitones 01 Filter Cutoff Control 0x00-0x7f -9600 - +9450 cents 02 Amplitude Control 0x00-0x7f 0 - (127/64)*10 percent 03 LFO Pitch Depth 0x00-0x7f 0 - 600 cents 04 LFO Filter Depth 0x00-0x7f 0 - 2400 cents 05 LFO Amplitude Depth 0x00-0x7f 0 - 100 percent
None by default. The following constant values can be exported.
SOX = 0xf0 # Start of System Exclusive Status
MQF = 0xf1 # MTC (MIDI Time Code) Quarter Frame SPP = 0xf2 # Song Position Pointer SSL = 0xf3 # Song Select TRQ = 0xf6 # Tune Request EOX = 0xf7 # EOX: End Of System Exclusive
CLK = 0xf8 # Timing Clock STT = 0xfa # Start CNT = 0xfb # Continue STP = 0xfc # Stop ASN = 0xfe # Active Sensing RST = 0xff # System Reset
UNM = 0x7e # Universal Non-realtime Messages URM = 0x7f # Universal Realtime Messages
BRD = 0x7f # Broadcast Device ID (all call)
Hiroo Hayashi, <hiroo.hayashi@computer.org>
If you find bugs, report to the author.
To install Win32API::MIDI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32API::MIDI
CPAN shell
perl -MCPAN -e shell install Win32API::MIDI
For more information on module installation, please visit the detailed CPAN module installation guide.