Skip to content

Commit 535d48a

Browse files
Prepared midi monitor example
1 parent e7ee773 commit 535d48a

File tree

7 files changed

+421
-11
lines changed

7 files changed

+421
-11
lines changed

.github/workflows/compile-sketch.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
version: 2.0.13
3636
sketch-paths: |
3737
- examples/ml_epiano_example
38+
- examples/ml_midi_monitor
3839
- examples/ml_mod_tracker
3940
- examples/ml_synth_basic_example
4041
- examples/ml_synth_fm_example
@@ -87,6 +88,7 @@ jobs:
8788
sketch-paths: |
8889
- examples/ml_epiano_example
8990
#- examples/ml_mod_tracker
91+
- examples/ml_midi_monitor
9092
- examples/ml_synth_basic_example
9193
#- examples/ml_synth_fm_example
9294
#- examples/ml_synth_multi_saw_example
@@ -137,6 +139,7 @@ jobs:
137139
version: 3.1.2
138140
sketch-paths: |
139141
# - examples/ml_epiano_example
142+
# - examples/ml_midi_monitor
140143
- examples/ml_mod_tracker
141144
# - examples/ml_synth_basic_example
142145
# - examples/ml_synth_fm_example
@@ -192,6 +195,7 @@ jobs:
192195
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
193196
sketch-paths: |
194197
- examples/ml_epiano_example
198+
- examples/ml_midi_monitor
195199
- examples/ml_mod_tracker
196200
- examples/ml_synth_basic_example
197201
#- examples/ml_synth_fm_example
@@ -250,6 +254,7 @@ jobs:
250254
version: 2.0.0
251255
sketch-paths: |
252256
- examples/ml_epiano_example
257+
# - examples/ml_midi_monitor
253258
- examples/ml_mod_tracker
254259
- examples/ml_synth_basic_example
255260
- examples/ml_synth_fm_example
@@ -303,6 +308,7 @@ jobs:
303308
version: 1.59.0
304309
sketch-paths: |
305310
#- examples/ml_epiano_example
311+
#- examples/ml_midi_monitor
306312
#- examples/ml_mod_tracker
307313
- examples/ml_synth_basic_example
308314
- examples/ml_synth_fm_example

examples/ml_midi_monitor/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<h1 align="center">ml_midi_monitor</h1>
2+
<h3 align="center">MIDI monitor for MIDI serial hardware testing</h3>
3+
<p align="center">
4+
<img src="img/midi_monitor.jpg" alt="project picture" width="480px" height="270px"><br>
5+
</p>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<h1>Board Build Variants</h1>
2+
3+
Below you will find a list of build which can be configured and should compile without any problems
4+
5+
<hr>
6+
<a name="espressif_2.0.13_esp32_esp32"></a><b>Core:</b> <a h_ref="https://github.com/espressif/arduino-esp32">ESP32 Arduino</a><br />
7+
<b>Version:</b> 2.0.13<br />
8+
<b>Board:</b> ESP32 Dev Module<br />
9+
<br />
10+
<b>Program storage space:</b> 270297 bytes<br />
11+
<b>Dynamic memory:</b> 22132 bytes<br />
12+
<br />
13+
<b>JTAG Adapter:</b> Disabled<br />
14+
<b>PSRAM:</b> Disabled<br />
15+
<b>Partition Scheme:</b> Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)<br />
16+
<b>CPU Frequency:</b> 240MHz (WiFi/BT)<br />
17+
<b>Flash Mode:</b> QIO<br />
18+
<b>Flash Frequency:</b> 80MHz<br />
19+
<b>Flash Size:</b> 4MB (32Mb)<br />
20+
<b>Upload Speed:</b> 921600<br />
21+
<b>Arduino Runs On:</b> Core 1<br />
22+
<b>Events Run On:</b> Core 1<br />
23+
<b>Core Debug Level:</b> None<br />
24+
<b>Erase All Flash Before Sketch Upload:</b> Disabled<br />
25+
<br />
26+
<b>Used libraries:</b><br />
27+
<table>
28+
<tr>
29+
<td>Name</td>
30+
<td>Version</td>
31+
<td>Url</td>
32+
<td>Git</td>
33+
<td>Core library</td>
34+
</tr>
35+
<tr>
36+
<td>ML SynthTools</td>
37+
<td>2.0.3</td>
38+
<td>https://github.com/marcel-licence/ML_SynthTools</td>
39+
<td>https://github.com/marcel-licence/ML_SynthTools.git</td>
40+
<td>False</td>
41+
</tr>
42+
<tr>
43+
<td>ML SynthTools Libraries</td>
44+
<td>2.0.4</td>
45+
<td>https://github.com/marcel-licence/ML_SynthTools_Lib</td>
46+
<td>https://github.com/marcel-licence/ML_SynthTools_Lib.git</td>
47+
<td>False</td>
48+
</tr>
49+
</table><hr>
50+
<a name="rp2040_rp2040_rpipico2"></a><b>Core:</b> <a h_ref="https://github.com/earlephilhower/arduino-pico">Raspberry Pi RP2040</a><br />
51+
<b>Version:</b> 4.2.0<br />
52+
<b>Board:</b> Raspberry Pi Pico 2<br />
53+
<br />
54+
<b>Program storage space:</b> 68272 bytes<br />
55+
<b>Dynamic memory:</b> 11776 bytes<br />
56+
<br />
57+
<b>Flash Size:</b> 4MB (no FS)<br />
58+
<b>CPU Speed:</b> 150 MHz<br />
59+
<b>Optimize:</b> Optimize Even More (-O3)<br />
60+
<b>RTTI:</b> Disabled<br />
61+
<b>Stack Protector:</b> Disabled<br />
62+
<b>C++ Exceptions:</b> Disabled<br />
63+
<b>Debug Port:</b> Disabled<br />
64+
<b>Debug Level:</b> None<br />
65+
<b>USB Stack:</b> Pico SDK<br />
66+
<b>IP/Bluetooth Stack:</b> IPv4 Only<br />
67+
<b>Upload Method:</b> Default (UF2)<br />
68+
<br />
69+
<b>Used libraries:</b><br />
70+
<table>
71+
<tr>
72+
<td>Name</td>
73+
<td>Version</td>
74+
<td>Url</td>
75+
<td>Git</td>
76+
<td>Core library</td>
77+
</tr>
78+
<tr>
79+
<td>ML SynthTools</td>
80+
<td>2.0.3</td>
81+
<td>https://github.com/marcel-licence/ML_SynthTools</td>
82+
<td>https://github.com/marcel-licence/ML_SynthTools.git</td>
83+
<td>False</td>
84+
</tr>
85+
<tr>
86+
<td>ML SynthTools Libraries</td>
87+
<td>2.0.4</td>
88+
<td>https://github.com/marcel-licence/ML_SynthTools_Lib</td>
89+
<td>https://github.com/marcel-licence/ML_SynthTools_Lib.git</td>
90+
<td>False</td>
91+
</tr>
92+
</table><hr>
93+
<a name="rp2040_rp2040_rpipico"></a><b>Core:</b> <a h_ref="https://github.com/earlephilhower/arduino-pico">Raspberry Pi RP2040</a><br />
94+
<b>Version:</b> 4.2.0<br />
95+
<b>Board:</b> Raspberry Pi Pico<br />
96+
<br />
97+
<b>Program storage space:</b> 69964 bytes<br />
98+
<b>Dynamic memory:</b> 10900 bytes<br />
99+
<br />
100+
<b>Flash Size:</b> 2MB (no FS)<br />
101+
<b>CPU Speed:</b> 133 MHz<br />
102+
<b>Optimize:</b> Optimize Even More (-O3)<br />
103+
<b>RTTI:</b> Disabled<br />
104+
<b>Stack Protector:</b> Disabled<br />
105+
<b>C++ Exceptions:</b> Disabled<br />
106+
<b>Debug Port:</b> Disabled<br />
107+
<b>Debug Level:</b> None<br />
108+
<b>USB Stack:</b> Pico SDK<br />
109+
<b>IP/Bluetooth Stack:</b> IPv4 Only<br />
110+
<b>Upload Method:</b> Default (UF2)<br />
111+
<br />
112+
<b>Used libraries:</b><br />
113+
<table>
114+
<tr>
115+
<td>Name</td>
116+
<td>Version</td>
117+
<td>Url</td>
118+
<td>Git</td>
119+
<td>Core library</td>
120+
</tr>
121+
<tr>
122+
<td>ML SynthTools</td>
123+
<td>2.0.3</td>
124+
<td>https://github.com/marcel-licence/ML_SynthTools</td>
125+
<td>https://github.com/marcel-licence/ML_SynthTools.git</td>
126+
<td>False</td>
127+
</tr>
128+
<tr>
129+
<td>ML SynthTools Libraries</td>
130+
<td>2.0.4</td>
131+
<td>https://github.com/marcel-licence/ML_SynthTools_Lib</td>
132+
<td>https://github.com/marcel-licence/ML_SynthTools_Lib.git</td>
133+
<td>False</td>
134+
</tr>
135+
</table>
1.2 MB
Loading
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/*
2+
* Copyright (c) 2024 Marcel Licence
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
18+
* der GNU General Public License, wie von der Free Software Foundation,
19+
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
20+
* veröffentlichten Version, weiter verteilen und/oder modifizieren.
21+
*
22+
* Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
23+
* OHNE JEDE GEWÄHR,; sogar ohne die implizite
24+
* Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
25+
* Siehe die GNU General Public License für weitere Einzelheiten.
26+
*
27+
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
28+
* Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
29+
*/
30+
31+
/**
32+
* @file ml_midi_monitor.ino
33+
* @author Marcel Licence
34+
* @date 14.12.2024
35+
*
36+
* @brief This is simple testproject to test out the MIDI connection
37+
* Received short MIDI messages will be displayed and decoded
38+
*/
39+
40+
/*
41+
* The following configuration is for the RP2040, RP2350
42+
*/
43+
#ifdef ARDUINO_ARCH_RP2040
44+
45+
#define MIDI_TX2_PIN 4
46+
#define MIDI_RX2_PIN 5
47+
48+
#define MIDI_TX1_PIN 0
49+
#define MIDI_RX1_PIN 1
50+
51+
#ifdef LED_BUILTIN
52+
#define BLINK_LED_PIN LED_BUILTIN
53+
#endif
54+
55+
#endif
56+
57+
/*
58+
* the following configuration is for ESP32, ESP32S2, ...
59+
*/
60+
#ifdef ESP32
61+
#define MIDI_TX2_PIN 17
62+
#define MIDI_RX2_PIN 16
63+
#endif
64+
65+
/*
66+
* the following configuration is for Teensy
67+
*/
68+
#ifdef TEENSYDUINO // CORE_TEENSY
69+
70+
#define BLINK_LED_PIN 13 /* led pin on teensy 4.1 */
71+
72+
#define MIDI_TX1_PIN 1
73+
#define MIDI_RX1_PIN 0
74+
#endif
75+
76+
/*
77+
* Configuration for
78+
* Board: "LOLIN(WEMOS) D1 R2 & mini 2 or similar
79+
*/
80+
#ifdef ESP8266
81+
82+
#define SWAP_SERIAL
83+
#define LED_PIN LED_BUILTIN
84+
85+
#define MIDI_PORT_ACTIVE
86+
87+
#ifndef SWAP_SERIAL
88+
#define RXD2 13 /* U2RRXD, D7 */
89+
#define TXD2 15 /* U2RRXD, D0 */
90+
#include <SoftwareSerial.h>
91+
SoftwareSerial Serial2(RXD2, TXD2);
92+
#define MIDI_PORT2_ACTIVE
93+
#endif
94+
95+
#endif
96+
97+
98+
/*
99+
* Configuration for
100+
* Board: "Generic STM32H7 Series"
101+
* Board part number: "Daisy Seed"
102+
*/
103+
#ifdef ARDUINO_DAISY_SEED
104+
105+
#define LED_PIN LED_BUILTIN
106+
#define MIDI_PORT2_ACTIVE
107+
108+
#endif /* ARDUINO_DAISY_SEED */
109+
110+
111+
/*
112+
* Configuration for
113+
* Board: "Seeeduino XIAO"
114+
*/
115+
#ifdef ARDUINO_SEEED_XIAO_M0
116+
117+
#define LED_PIN LED_BUILTIN
118+
#define MIDI_PORT1_ACTIVE
119+
120+
#endif /* ARDUINO_SEEED_XIAO_M0 */
121+
122+
123+
#define ML_SYNTH_INLINE_DECLARATION
124+
#define ML_SYNTH_INLINE_DEFINITION
125+
#include <blink.h>
126+
#include <midi_interface.h>
127+
128+
struct midiMapping_s midiMapping =
129+
{
130+
NULL,
131+
NULL,
132+
NULL,
133+
NULL,
134+
NULL,
135+
NULL,
136+
NULL,
137+
NULL,
138+
NULL,
139+
0,
140+
};
141+
142+
void setup(void)
143+
{
144+
#ifdef BLINK_LED_PIN
145+
Blink_Setup();
146+
#endif
147+
148+
Serial.begin(115200);
149+
//delay(1500);
150+
while (!Serial)
151+
{
152+
delay(250);
153+
#ifdef BLINK_LED_PIN
154+
Blink_Process();
155+
#endif
156+
}
157+
158+
Serial.println("ml_midi_monitor");
159+
160+
Midi_Setup();
161+
162+
163+
}
164+
165+
void loop_1hz(void)
166+
{
167+
uint8_t msg[] = {0x90, 0x01, 0x02};
168+
Midi_SendRaw(msg);
169+
170+
#ifdef BLINK_LED_PIN
171+
Blink_Process();
172+
#endif
173+
}
174+
175+
void loop(void)
176+
{
177+
178+
uint32_t newCnt = millis();
179+
180+
181+
static uint32_t lastCnt = 0;
182+
static uint32_t cnt = 0;
183+
cnt += newCnt - lastCnt;
184+
lastCnt = newCnt;
185+
if (cnt >= 1000)
186+
{
187+
cnt -= 1000;
188+
loop_1hz();
189+
}
190+
191+
Midi_Process();
192+
193+
194+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fqbn;version;config
2+
espressif:esp32:esp32;latest;
3+
rp2040:rp2040:rpipico2;latest;
4+
rp2040:rp2040:rpipico;latest;
5+
#esp8266:esp8266:d1_mini;latest;
6+
#Seeeduino:samd:seeed_XIAO_m0;1.8.2;
7+
#STMicroelectronics:stm32:GenH7;2.5.0;PNUM=DAISY_SEED
8+
#teensy:avr:teensy41;1.8.5;TEENSY_USB=serialmidiaudio

0 commit comments

Comments
 (0)