-
Notifications
You must be signed in to change notification settings - Fork 1
/
midi_sendMessage.lua
144 lines (112 loc) · 2.42 KB
/
midi_sendMessage.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
-- Sending MIDI messages using the sendMessage ()
--
-- The sendMessage function makes it possible to send midiMessage object
-- (data table). The workflow here is to construct a message in form of the
-- midiMessage object and then send it with midi.sendMessage function.
--
-- The midi.sendMessage function takes two parameters. The Electra's MIDI port
-- identifier and the the midiMessage.
--
-- the function sends messages to all Electra's interfaces (USB Dev, USB host,
-- MIDI IO). The idea is that this will follow the configuration of the low-level
-- Electra One system. This might change in near future.
-- Control Change
midiMessage = {
channel = 1,
type = CONTROL_CHANGE,
controllerNumber = 1,
value = 127
}
midi.sendMessage (PORT_1, midiMessage)
-- Note On
midiMessage = {
channel = 1,
type = NOTE_ON,
noteNumber = 60,
velocity = 100
}
midi.sendMessage (PORT_1, midiMessage)
-- Note Off
midiMessage = {
channel = 1,
type = NOTE_OFF,
noteNumber = 60,
velocity = 100
}
midi.sendMessage (PORT_1, midiMessage)
-- Program Change
midiMessage = {
channel = 1,
type = PROGRAM_CHANGE,
programNumber = 10
}
midi.sendMessage (PORT_1, midiMessage)
-- Pitch Bend
midiMessage = {
channel = 1,
type = PITCH_BEND,
value = 513
}
midi.sendMessage (PORT_1, midiMessage)
-- Poly Pressure
midiMessage = {
channel = 1,
type = POLY_PRESSURE,
noteNumber = 60,
pressure = 100
}
midi.sendMessage (PORT_1, midiMessage)
-- Channel Pressure
midiMessage = {
channel = 1,
type = CHANNEL_PRESSURE,
pressure = 64
}
midi.sendMessage (PORT_1, midiMessage)
-- Clock
midiMessage = {
type = CLOCK
}
midi.sendMessage (PORT_1, midiMessage)
-- Start
midiMessage = {
type = START
}
midi.sendMessage (PORT_1, midiMessage)
-- Stop
midiMessage = {
type = STOP
}
midi.sendMessage (PORT_1, midiMessage)
-- Continue
midiMessage = {
type = CONTINUE
}
midi.sendMessage (PORT_1, midiMessage)
-- Active Sensing
midiMessage = {
type = ACTIVE_SENSING
}
midi.sendMessage (PORT_1, midiMessage)
-- System Reset
midiMessage = {
type = RESET
}
midi.sendMessage (PORT_1, midiMessage)
-- Song Select
local ss = {
type = SONG_SELECT,
songNumber = 20
}
midi.sendMessage (PORT_1, ss)
-- Song Position
midiMessage = {
type = SONG_POSITION,
position = 10
}
midi.sendMessage (PORT_1, midiMessage)
-- Tune Request
midiMessage = {
type = TUNE_REQUEST
}
midi.sendMessage (PORT_1, midiMessage)