EM MIDI Arduino Lib 1.0.1
Loading...
Searching...
No Matches
midi.h
Go to the documentation of this file.
1
2#pragma once
3
4#ifndef _EM_MIDI_H_
5#define _EM_MIDI_H_
6
7/**
8 * @file midi.h
9 */
10#include <Arduino.h>
11#include <Stream.h>
12
14#include "midi_note.h"
16#include "midi_timbre.h"
17
18namespace em {
19
20/**
21 * @~Chinese
22 * @brief 均衡器参数结构体。
23 */
24/**
25 * @~English
26 * @brief Equalizer parameter structure.
27 */
29 /**
30 * @~Chinese
31 * @brief 低频增益值(0-127)。
32 */
33 /**
34 * @~English
35 * @brief Low frequency gain value (0-127).
36 */
37 uint8_t low_frequency_gain = 64;
38
39 /**
40 * @~Chinese
41 * @brief 中低频增益值(0-127)。
42 */
43 /**
44 * @~English
45 * @brief Medium-low frequency gain value (0-127).
46 */
48
49 /**
50 * @~Chinese
51 * @brief 中高频增益值(0-127)。
52 */
53 /**
54 * @~English
55 * @brief Medium-high frequency gain value (0-127).
56 */
58
59 /**
60 * @~Chinese
61 * @brief 高频增益值(0-127)。
62 */
63 /**
64 * @~English
65 * @brief High frequency gain value (0-127).
66 */
67 uint8_t high_frequency_gain = 64;
68
69 /**
70 * @~Chinese
71 * @brief 低频中心频率值(0-127)。
72 */
73 /**
74 * @~English
75 * @brief Low frequency center value (0-127).
76 */
77 uint8_t low_frequency = 64;
78
79 /**
80 * @~Chinese
81 * @brief 中低频中心频率值(0-127)。
82 */
83 /**
84 * @~English
85 * @brief Medium-low frequency center value (0-127).
86 */
88
89 /**
90 * @~Chinese
91 * @brief 中高频中心频率值(0-127)。
92 */
93 /**
94 * @~English
95 * @brief Medium-high frequency center value (0-127).
96 */
98
99 /**
100 * @~Chinese
101 * @brief 高频中心频率值(0-127)。
102 */
103 /**
104 * @~English
105 * @brief High frequency center value (0-127).
106 */
107 uint8_t high_frequency = 64;
108};
109
110/**
111 * @~Chinese
112 * @brief 12个音阶调谐参数结构体。
113 */
114/**
115 * @~English
116 * @brief 12 scale tuning parameter structures.
117 */
119 /**
120 * @~Chinese
121 * @brief C 音符微调值(0-127)。
122 */
123 /**
124 * @~English
125 * @brief C note fine-tuning value (0-127)
126 */
127 uint8_t note_c = 64;
128
129 /**
130 * @~Chinese
131 * @brief C# 音符微调值(0-127)。
132 */
133 /**
134 * @~English
135 * @brief C# note fine-tuning value (0-127)
136 */
137 uint8_t note_c_sharp = 64;
138
139 /**
140 * @~Chinese
141 * @brief D 音符微调值(0-127)。
142 */
143 /**
144 * @~English
145 * @brief D note fine-tuning value (0-127).
146 */
147 uint8_t note_d = 64;
148
149 /**
150 * @~Chinese
151 * @brief D# 音符微调值(0-127)。
152 */
153 /**
154 * @~English
155 * @brief D# note fine-tuning value (0-127).
156 */
157 uint8_t note_d_sharp = 64;
158
159 /**
160 * @~Chinese
161 * @brief E 音符微调值(0-127)。
162 */
163 /**
164 * @~English
165 * @brief E note fine-tuning value (0-127).
166 */
167 uint8_t note_e = 64;
168
169 /**
170 * @~Chinese
171 * @brief F 音符微调值(0-127)。
172 */
173 /**
174 * @~English
175 * @brief F note fine-tuning value (0-127).
176 */
177 uint8_t note_f = 64;
178
179 /**
180 * @~Chinese
181 * @brief F# 音符微调值(0-127)。
182 */
183 /**
184 * @~English
185 * @brief F# note fine-tuning value (0-127).
186 */
187 uint8_t note_f_sharp = 64;
188
189 /**
190 * @~Chinese
191 * @brief G 音符微调值(0-127)。
192 */
193 /**
194 * @~English
195 * @brief G note fine-tuning value (0-127).
196 */
197 uint8_t note_g = 64;
198
199 /**
200 * @~Chinese
201 * @brief G# 音符微调值(0-127)。
202 */
203 /**
204 * @~English
205 * @brief G# note fine-tuning value (0-127).
206 */
207 uint8_t note_g_sharp = 64;
208
209 /**
210 * @~Chinese
211 * @brief A 音符微调值(0-127)。
212 */
213 /**
214 * @~English
215 * @brief A note fine-tuning value (0-127).
216 */
217 uint8_t note_a = 64;
218
219 /**
220 * @~Chinese
221 * @brief A# 音符微调值(0-127)。
222 */
223 /**
224 * @~English
225 * @brief A# note fine-tuning value (0-127).
226 */
227 uint8_t note_a_sharp = 64;
228
229 /**
230 * @~Chinese
231 * @brief B 音符微调值(0-127)。
232 */
233 /**
234 * @~English
235 * @brief B note fine-tuning value (0-127).
236 */
237 uint8_t note_b = 64;
238};
239
240/**
241 * @~Chinese
242 * @brief 调制轮参数结构体。
243 */
244/**
245 * @~English
246 * @brief Modulation wheel parameters.
247 */
249 /**
250 * @~Chinese
251 * @brief 高频音调音量强度 (0-127)。
252 */
253 /**
254 * @~English
255 * @brief High pitch volume intensity (0-127).
256 */
257 uint8_t high_pitch_volume = 64;
258
259 /**
260 * @~Chinese
261 * @brief 时变音色截止频率 (0-127)。
262 */
263 /**
264 * @~English
265 * @brief Time-varying timbre cutoff frequency (0-127).
266 */
268
269 /**
270 * @~Chinese
271 * @brief 振幅调制深度 (0-127)。
272 */
273 /**
274 * @~English
275 * @brief Amplitude modulation depth (0-127).
276 */
277 uint8_t amplitude = 64;
278
279 /**
280 * @~Chinese
281 * @brief 低频振荡器速率 (0-127)。
282 */
283 /**
284 * @~English
285 * @brief Low-frequency oscillator rate (0-127).
286 */
288
289 /**
290 * @~Chinese
291 * @brief 音高调制深度 (0-127)。
292 */
293 /**
294 * @~English
295 * @brief Pitch modulation depth (0-127).
296 */
297 uint8_t pitch_depth = 64;
298
299 /**
300 * @~Chinese
301 * @brief 时变滤波器深度 (0-127)。
302 */
303 /**
304 * @~English
305 * @brief Time-varying filter depth (0-127).
306 */
308
309 /**
310 * @~Chinese
311 * @brief 时变放大器深度 (0-127)。
312 */
313 /**
314 * @~English
315 * @brief Time-varying amplifier depth (0-127).
316 */
318};
319
320/**
321 * @~Chinese
322 * @class Midi
323 * @brief Midi是一个用于MIDI模块的驱动类,用于合成音乐。
324 * @example drum_pattern_player.ino 鼓型播放器。
325 * @example play_music.ino 使用BANK_0_ACOUSTIC_GUITAR_STEEL_STRING 音色播放音乐。
326 */
327/**
328 * @~English
329 * @class Midi
330 * @brief Midi is a driver class for the MIDI module, used for synthesizing music.
331 * @example drum_pattern_player.ino Drum pattern player.
332 * @example play_music.ino Play music using the BANK_0_ACOUSTIC_GUITAR_STEEL_STRING tone.
333 */
334
335class Midi {
336 public:
337 /**
338 * @~Chinese
339 * @brief 构造函数。
340 * @param stream stream 用于 MIDI 通信的数据流引用。
341 */
342 /**
343 * @~English
344 * @brief Constructor.
345 * @param stream A data stream reference used for MIDI communication.
346 */
347 Midi(Stream& stream);
348
349 /**
350 * @~Chinese
351 * @brief 在指定通道(0-15)上发出给定的MIDI音符。
352 * @param channel 指定通道(0-15)。
353 * @param midi_note MIDI 音符(0-127),请查阅参考midi_note.h;其中,通道9的音符请查阅参考midi_percussion_note.h。
354 * @param note_velocity
355 * 音符力度(0-127),控制音符的音量和音调亮度,在键盘上,这对应于按键的力度,0:无声(相当于noteOff),1-126:从弱到强,127:最大强度.
356 */
357 /**
358 * @~English
359 * @brief Generate the given MIDI note on the designated channel (0-15).
360 * @param channel Designated channel (0-15).
361 * @param midi_note MIDI notes (0-127), please refer to midi_note.h for reference; Among them, for the notes of channel 9, please
362 * refer to midi_percussion_note.h.
363 * @param note_velocity Note velocity (0-127), controls the volume and tone brightness of notes, on a keyboard this corresponds to how hard the
364 * key,0: silent (equivalent to noteOff), 1-126: from weak to strong, 127: maximum strength.
365 */
366 void NoteOn(const uint8_t channel, const uint8_t midi_note, const uint8_t z);
367
368 /**
369 * @~Chinese
370 * @brief 关闭指定通道中的音符,该通道之前使用noteOn()命令以给定的音高打开。
371 * @param channel 指定通道(0-15)。
372 * @param midi_note MIDI 音符(0-127),请查阅参考midi_note.h;其中,通道9的音符请查阅参考midi_percussion_note.h。
373 */
374 /**
375 * @~English
376 * @brief Close the note in the specified channel, which was previously opened at a given pitch using the noteOn() command.
377 * @param channel Designated channel (0-15).
378 * @param midi_note MIDI notes (0-127), please refer to midi_note.h for reference; Among them, for the notes of channel 9, please
379 * refer to midi_percussion_note.h.
380 */
381 void NoteOff(const uint8_t channel, const uint8_t midi_note);
382
383 /**
384 * @~Chinese
385 * @brief 更改指定通道的音色。其中通道9是一个专用的鼓组通道,通道9的音色和音符请查阅参考midi_percussion_note.h。
386 * @param channel 指定通道(0-15),其中通道9是专用鼓组通道。
387 * @param bank 音色库选择,参数值为MIDI_bank_0或MIDI_bank_127。
388 * @param timbre
389 * 音色编号(0-127),请查阅参考midi_timbre.h中的宏(例如EM_MIDI_TIMBRE_BANK_0_GRAND_PIANO);其中,通道9的音色请查阅参考midi_percussion_note.h。
390 */
391 /**
392 * @~English
393 * @brief Change the tone of the specified channel. Among them, channel 9 is a dedicated drum channel, and the timbre and notes of channel 9 can be
394 * found in reference midi_percussion_note.h .
395 * @param channel Designated channels (0-15), where channel 9 is a dedicated drum group channel.
396 * @param bank Selection of timbre library, with parameter values of MIDI_BANK_0 or MIDI_BANK_127.
397 * @param timbre Timbre number (0-127), please refer to the macro in reference midi_timbre.h (e.g.
398 * EM_MIDI_TIMBRE_BANK_0_GRAND_PIANO); Among them, for the timbre of channel 9, please refer to midi_percussion_note.h .
399 */
400 void SetChannelTimbre(const uint8_t channel, const uint8_t bank, const uint8_t timbre);
401
402 /**
403 * @~Chinese
404 * @brief 向上或向下弯曲音高,默认摆动+/-1半音。
405 * @param channel 指定通道(0-15)。
406 * @param pitch_bend_value 弯音值(0-1023),0:最大向下弯曲,512:中心位置(无弯曲),1023:最大向上弯曲。
407 */
408 /**
409 * @~English
410 * @brief Bend the pitch upwards or downwards, with a default swing of+/-1 semitone.
411 * @param channel Designated channel (0-15).
412 * @param pitch_bend_value Pitch bend value (0-1023), 0: maximum downward bend, 512: center position (no bend), 1023: maximum upward bend.
413 */
414 void PitchBend(const uint8_t channel, uint16_t pitch_bend_value);
415
416 /**
417 * @~Chinese
418 * @brief 设置弯音范围(灵敏度)。
419 * @param channel 指定通道(0-15)。
420 * @param pitch_bend_range_value 弯音范围值(半音数,0-127),典型值:1-24(半音),默认值:2(±2半音)。
421 */
422 /**
423 * @~English
424 * @brief Set the pitch bend range (sensitivity).
425 * @param channel Designated channel (0-15).
426 * @param pitch_bend_range_value Pitch bend range value (number of semitones, 0-127), typical value: 1-24 (semitones), default value: 2 (± 2
427 * semitones).
428 */
429 void PitchBendRange(const uint8_t channel, const uint8_t pitch_bend_range_value);
430
431 /**
432 * @~Chinese
433 * @brief MIDI系统重置发送MIDI系统重置命令(0xFF),将所有连接的MIDI设备重置为初始状态。
434 */
435 /**
436 * @~English
437 * @brief MIDI system reset sends MIDI system reset command (0xFF) to reset all connected MIDI devices to their initial state.
438 */
439 void MidiReset();
440
441 /**
442 * @~Chinese
443 * @brief 在指定通道上为每个音符发送一个noteOff()。
444 * @param channel 指定通道(0-15)。
445 */
446 /**
447 * @~English
448 * @brief Send a noteOff() for each note on the specified channel.
449 * @param channel Designated channel (0-15).
450 */
451 void ChannelAllNotesOff(const uint8_t channel);
452
453 /**
454 * @~Chinese
455 * @brief 设置特定通道音量。
456 * @param channel 指定通道(0-15)。
457 * @param volume 音量级别(0-127),0:静音,127:最大音量。
458 */
459 /**
460 * @~English
461 * @brief Set specific channel volume.
462 * @param channel Designated channel (0-15).
463 * @param volume Volume level (0-127), 0: mute, 127: maximum volume.
464 */
465 void SetChannelVolume(const uint8_t channel, const uint8_t volume);
466
467 /**
468 * @~Chinese
469 * @brief 设置所有通道的音量。
470 * @param volume 音量级别(0-127),0:静音,127:最大音量。
471 */
472 /**
473 * @~English
474 * @brief Set the volume for all channels.
475 * @param volume Volume level (0-127), 0: mute, 127: maximum volume.
476 */
477 void SetAllChannelVolume(const uint8_t volume);
478
479 /**
480 * @~Chinese
481 * @brief 将混响效果应用于指定通道。
482 * @param channel 指定通道(0-15)。
483 * @param reverberation_type 混响类型,请参考midi_chorus_reverberation.h中的宏(例如,EM_MIDI_REVERBERATION_ROOM_1)。
484 * @param reverberation_volume 混响量(0-127),0:无混响,127:最大混响量。
485 * @param delay_feedback 延迟反馈量(0-127),0:无反馈,127:最大反馈。
486 */
487 /**
488 * @~English
489 * @brief Apply reverberation effect to the specified channel.
490 * @param channel Designated channel (0-15).
491 * @param reverberation_type Reverberation type, refer to macros in midi_chorus_reverberation.h (e.g.,
492 * EM_MIDI_REVERBERATION_ROOM_1).
493 * @param reverberation_volume Reverberation transmission amount (0-127), 0: no reverberation, 127: maximum reverberation amount.
494 * @param delay_feedback Delayed feedback quantity (0-127), 0: no feedback, 127: maximum feedback.
495 */
496 void SetReverberation(const uint8_t channel, const uint8_t reverberation_type, const uint8_t reverberation_volume, const uint8_t delay_feedback);
497
498 /**
499 * @~Chinese
500 * @brief 将合唱效果应用于指定通道。
501 * @param channel 指定通道(0-15)。
502 * @param chorus_effect_type 合唱效果类型,请参考midi_chorus_reverberation.h中的宏(例如,EM_MIDI_CHORUS_1)。
503 * @param chorus_effect_volume 合唱效果量(0-127),0:无,127:最大发送音量。
504 * @param chorus_effect_feedback 效果反馈量(0-127,0表示未设置)。
505 * @param chorus_delay_time 合唱延迟时间(0-127,0表示未设置),单位:ms。
506 */
507 /**
508 * @~English
509 * @brief Apply a chorus effect to a specified channel.
510 * @param channel Designated channel (0-15).
511 * @param chorus_effect_type chorus effect type, refer to macros in midi_chorus_reverberation.h (e.g., EM_MIDI_CHORUS_1).
512 * @param chorus_effect_volume chorus effect sending volume (0-127), 0: none, 127: maximum sending volume.
513 * @param chorus_effect_feedback Effect feedback amount (0-127, 0 means not set).
514 * @param chorus_delay_time chorus delay time (0-127, 0 indicates not set), unit: ms.
515 */
516 void SetChorus(const uint8_t channel,
517 const uint8_t chorus_effect_type,
518 const uint8_t chorus_effect_volume,
519 const uint8_t chorus_effect_feedback,
520 const uint8_t chorus_delay_time);
521
522 /**
523 * @~Chinese
524 * @brief 设置声相位置。
525 * @param channel 指定通道(0-15)。
526 * @param pan_position_value 声相位置值(0-127),0:最左侧(完全左侧通道),64:中心位置(左右平衡通道),127:最右侧(完全右侧通道)。
527 */
528 /**
529 * @~English
530 * @brief Set the pan position.
531 * @param channel Designated channel (0-15).
532 * @param pan_position_value pan position value (0-127), 0: far left (completely left channel), 64: center position (balanced left and right
533 * channel),127: far right (completely right channel).
534 */
535 void SetPanPosition(const uint8_t channel, const uint8_t pan_position_value);
536
537 /**
538 * @~Chinese
539 * @brief 设置四段均衡器。
540 * @param channel 指定通道(0-15)。
541 * @param equalizer_parameter 均衡器参数结构体。
542 */
543 /**
544 * @~English
545 * @brief Set up a four segment equalizer.
546 * @param channel Designated channel (0-15).
547 * @param equalizer_parameter Equalizer parameters structure.
548 */
549 void SetEqualizer(const uint8_t channel, const EqualizerParameter& equalizer_parameter);
550
551 /**
552 * @~Chinese
553 * @brief 定调(粗调/细调)。
554 * @param channel 指定通道(0-15)。
555 * @param fine_tuning 微调值(0-127),影响音调的细微变化。
556 * @param coarse_tuning 粗调值(0-127),影响音高的八度变化。
557 */
558 /**
559 * @~English
560 * @brief Set tone (coarse/fine).
561 * @param channel Designated channel (0-15).
562 * @param fine_tuning Fine tuning value (0-127), affecting subtle changes in pitch.
563 * @param coarse_tuning Coarse tuning values (0-127), affect the octave variation of pitch.
564 */
565 void SetTuning(const uint8_t channel, const uint8_t fine_tuning, const uint8_t coarse_tuning);
566
567 /**
568 * @~Chinese
569 * @brief 设置颤音参数。
570 * @param channel 指定通道(0-15)。
571 * @param vibrato_rate 振动频率(0-127)-控制振动的速度。
572 * @param vibrato_depth 振动深度(0-127)-控制振动振幅。
573 * @param vibrato_delay_modify 振动延迟修改(0-127)-控制振动开始前的延迟时间。
574 */
575 /**
576 * @~English
577 * @brief Set vibrato parameters.
578 * @param channel Designated channel (0-15).
579 * @param vibrato_rate Vibrato rate (0-127) - controls the speed of vibrato oscillation.
580 * @param vibrato_depth Vibrato depth (0-127) - controls the amplitude of vibrato oscillation.
581 * @param vibrato_delay_modify Vibrato Delay Modification (0-127) - Control the delay time before the start of vibrato.
582 */
583 void SetVibrato(const uint8_t channel, const uint8_t vibrato_rate, const uint8_t vibrato_depth, const uint8_t vibrato_delay_modify);
584
585 /**
586 * @~Chinese
587 * @brief 设置时变滤波器(TVF)。
588 * @param channel 指定通道(0-15)。
589 * @param cutoff 截止频率值(0-127)-控制滤波器通过的频率范围。
590 * @param resonance 共鸣强度/共鸣值(0-127)-在截止频率附近控制滤波器的增益。
591 */
592 /**
593 * @~English
594 * @brief Set Time Varying Filter (TVF).
595 * @param channel Designated channel (0-15).
596 * @param cutoff Cut off frequency value (0-127) - controls the frequency range that the filter passes through.
597 * @param resonance Resonance peak/resonance value (0-127) - Control the gain of the filter near the cutoff frequency.
598 */
599 void SetTimeVaryingFilter(const uint8_t channel, const uint8_t cutoff, const uint8_t resonance);
600
601 /**
602 * @~Chinese
603 * @brief 设置包络参数。
604 * @param channel 指定通道(0-15)。
605 * @param attack_time 触发时间(0-127)-控制声音从零开始达到最大振幅的时间,单位:ms。
606 * @param attenuation_time 衰减时间(0-127)-控制声音从最大振幅衰减到保持水平的时间,单位:ms。
607 * @param release_time 释放时间(0-127)-控制钞票释放后音量衰减到零所需的时间,单位:ms。
608 */
609 /**
610 * @~English
611 * @brief Set envelope parameters.
612 * @param channel Designated channel (0-15).
613 * @param attack_time Attack time (0-127) - controls the time for the sound to reach its maximum amplitude from zero, unit: ms.
614 * @param attenuation_time Attenuation time (0-127) - controls the time for sound to decay from maximum amplitude to maintain a level, unit: ms.
615 * @param release_time Release time (0-127) - controls the time it takes for the volume to decay to zero after the note is released, unit: ms.
616 */
617 void SetEnvelope(const uint8_t channel, const uint8_t attack_time, const uint8_t attenuation_time, const uint8_t release_time);
618
619 /**
620 * @~Chinese
621 * @brief 为指定的MIDI通道设置12个音阶调谐参数(每个半音独立的音高偏移)。
622 * @param channel 指定通道(0-15)。
623 * @param scale_tuning_parameter
624 * 为指定通道设置12个音符调谐参数(C、C#、D、D#、E、F、F#、G、G#、A、A#、B),(每个半音的独立间距偏移)。
625 */
626 /**
627 * @~English
628 * @brief Set the 12 scale tuning parameters for the specified MIDI channel (independent pitch offset for each semitone).
629 * @param channel Designated channel (0-15).
630 * @param scale_tuning_parameter Set the 12 scale tuning parameters(C, C#, D, D#, E, F, F#, G, G#, A, A#, B) for the specified channel (independent
631 * pitch offset for each semitone).
632 */
633 void SetScaleTuning(const uint8_t channel, const ScaleTuningParameter& scale_tuning_parameter);
634
635 /**
636 * @~Chinese
637 * @brief 设置调制轮参数,配置调制轮声音的多种控制效果。
638 * @param channel 指定通道(0-15)。
639 * @param modulation_wheel_parameter 调制轮参数结构体。
640 */
641 /**
642 * @~English
643 * @brief Set modulation wheel parameters and configure multiple control effects for modulation wheel sound.
644 * @param channel Designated channel (0-15).
645 * @param modulation_wheel_parameter Modulation wheel parameters structure.
646 */
647 void SetModulationWheel(const uint8_t channel, const ModulationWheelParameter& modulation_wheel_parameter);
648
649 /**
650 * @~Chinese
651 * @brief 激活所有鼓通道,并将所有16个MIDI通道(0-15)设置为鼓通道。
652 */
653 /**
654 * @~English
655 * @brief Activate all drum channels and set all 16 MIDI channels (0-15) as drum channels.
656 */
657 void AllDrums();
658
659 private:
660 Midi(const Midi&) = delete;
661
662 Midi& operator=(const Midi&) = delete;
663
664 void Write(const uint8_t data);
665
666 void Write(const uint8_t* buffer, const size_t size);
667
668 void SendNrpnOrRpnParameter(const uint8_t channel,
669 const uint8_t most_significant_byte_controller,
670 const uint8_t most_significant_byte,
671 const uint8_t least_significant_byte_controller,
672 const uint8_t least_significant_byte,
673 const uint8_t value);
674
675 void NullNrpnOrRpn(const uint8_t channel, const uint8_t most_significant_byte_controller, const uint8_t least_significant_byte_controller);
676
677 Stream& stream_;
678};
679} // namespace em
680#endif
void SetTimeVaryingFilter(const uint8_t channel, const uint8_t cutoff, const uint8_t resonance)
Set Time Varying Filter (TVF).
Definition midi.cpp:132
void SetChannelTimbre(const uint8_t channel, const uint8_t bank, const uint8_t timbre)
Change the tone of the specified channel. Among them, channel 9 is a dedicated drum channel,...
Definition midi.cpp:18
void SetEqualizer(const uint8_t channel, const EqualizerParameter &equalizer_parameter)
Set up a four segment equalizer.
Definition midi.cpp:104
void SetChannelVolume(const uint8_t channel, const uint8_t volume)
Set specific channel volume.
Definition midi.cpp:55
void SetScaleTuning(const uint8_t channel, const ScaleTuningParameter &scale_tuning_parameter)
Set the 12 scale tuning parameters for the specified MIDI channel (independent pitch offset for each ...
Definition midi.cpp:147
void AllDrums()
Activate all drum channels and set all 16 MIDI channels (0-15) as drum channels.
Definition midi.cpp:203
void SetPanPosition(const uint8_t channel, const uint8_t pan_position_value)
Set the pan position.
Definition midi.cpp:99
void SetEnvelope(const uint8_t channel, const uint8_t attack_time, const uint8_t attenuation_time, const uint8_t release_time)
Set envelope parameters.
Definition midi.cpp:139
void SetModulationWheel(const uint8_t channel, const ModulationWheelParameter &modulation_wheel_parameter)
Set modulation wheel parameters and configure multiple control effects for modulation wheel sound.
Definition midi.cpp:173
void PitchBendRange(const uint8_t channel, const uint8_t pitch_bend_range_value)
Set the pitch bend range (sensitivity).
Definition midi.cpp:40
void SetChorus(const uint8_t channel, const uint8_t chorus_effect_type, const uint8_t chorus_effect_volume, const uint8_t chorus_effect_feedback, const uint8_t chorus_delay_time)
Apply a chorus effect to a specified channel.
Definition midi.cpp:80
void ChannelAllNotesOff(const uint8_t channel)
Send a noteOff() for each note on the specified channel.
Definition midi.cpp:50
void NoteOff(const uint8_t channel, const uint8_t midi_note)
Close the note in the specified channel, which was previously opened at a given pitch using the noteO...
Definition midi.cpp:13
void SetAllChannelVolume(const uint8_t volume)
Set the volume for all channels.
Definition midi.cpp:60
void SetReverberation(const uint8_t channel, const uint8_t reverberation_type, const uint8_t reverberation_volume, const uint8_t delay_feedback)
Apply reverberation effect to the specified channel.
Definition midi.cpp:65
void NoteOn(const uint8_t channel, const uint8_t midi_note, const uint8_t z)
Generate the given MIDI note on the designated channel (0-15).
Definition midi.cpp:8
Midi(Stream &stream)
Constructor.
Definition midi.cpp:5
void MidiReset()
MIDI system reset sends MIDI system reset command (0xFF) to reset all connected MIDI devices to their...
Definition midi.cpp:46
void PitchBend(const uint8_t channel, uint16_t pitch_bend_value)
Bend the pitch upwards or downwards, with a default swing of+/-1 semitone.
Definition midi.cpp:31
void SetTuning(const uint8_t channel, const uint8_t fine_tuning, const uint8_t coarse_tuning)
Set tone (coarse/fine).
Definition midi.cpp:117
void SetVibrato(const uint8_t channel, const uint8_t vibrato_rate, const uint8_t vibrato_depth, const uint8_t vibrato_delay_modify)
Set vibrato parameters.
Definition midi.cpp:124
Define constants for reverberation effect types and chorus effect types.
MIDI note numbering definition (0-127), including all MIDI note numbering from C-1 (0) to G9 (127).
Define the percussion timbre and note constants for channel 9.
Define channel timbre library constants and timbre constants.
Equalizer parameter structure.
Definition midi.h:28
uint8_t medium_high_frequency
Medium-high frequency center value (0-127).
Definition midi.h:97
uint8_t medium_low_frequency
Medium-low frequency center value (0-127).
Definition midi.h:87
uint8_t medium_high_frequency_gain
Medium-high frequency gain value (0-127).
Definition midi.h:57
uint8_t low_frequency
Low frequency center value (0-127).
Definition midi.h:77
uint8_t high_frequency_gain
High frequency gain value (0-127).
Definition midi.h:67
uint8_t medium_low_frequency_gain
Medium-low frequency gain value (0-127).
Definition midi.h:47
uint8_t high_frequency
High frequency center value (0-127).
Definition midi.h:107
uint8_t low_frequency_gain
Low frequency gain value (0-127).
Definition midi.h:37
Modulation wheel parameters.
Definition midi.h:248
uint8_t time_varying_filter_depth
Time-varying filter depth (0-127).
Definition midi.h:307
uint8_t amplitude
Amplitude modulation depth (0-127).
Definition midi.h:277
uint8_t high_pitch_volume
High pitch volume intensity (0-127).
Definition midi.h:257
uint8_t low_frequency_oscillator_rate
Low-frequency oscillator rate (0-127).
Definition midi.h:287
uint8_t pitch_depth
Pitch modulation depth (0-127).
Definition midi.h:297
uint8_t time_varying_amplifier_depth
Time-varying amplifier depth (0-127).
Definition midi.h:317
uint8_t time_varying_timbre_cutoff
Time-varying timbre cutoff frequency (0-127).
Definition midi.h:267
12 scale tuning parameter structures.
Definition midi.h:118
uint8_t note_b
B note fine-tuning value (0-127).
Definition midi.h:237
uint8_t note_d_sharp
D# note fine-tuning value (0-127).
Definition midi.h:157
uint8_t note_c_sharp
C# note fine-tuning value (0-127)
Definition midi.h:137
uint8_t note_d
D note fine-tuning value (0-127).
Definition midi.h:147
uint8_t note_a_sharp
A# note fine-tuning value (0-127).
Definition midi.h:227
uint8_t note_f
F note fine-tuning value (0-127).
Definition midi.h:177
uint8_t note_f_sharp
F# note fine-tuning value (0-127).
Definition midi.h:187
uint8_t note_g
G note fine-tuning value (0-127).
Definition midi.h:197
uint8_t note_e
E note fine-tuning value (0-127).
Definition midi.h:167
uint8_t note_c
C note fine-tuning value (0-127)
Definition midi.h:127
uint8_t note_g_sharp
G# note fine-tuning value (0-127).
Definition midi.h:207
uint8_t note_a
A note fine-tuning value (0-127).
Definition midi.h:217