Skip to content

Clean up MIDI relay implementation #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions docs/references/hiragana-map.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
A あ
I い
U う
E え
O お
KA か
KI き
KU く
KE け
KO こ
GA が
GI ぎ
GU ぐ
GE げ
GO ご
SA さ
SO し
SU す
SE せ
SO そ
ZA ざ
ZI じ
ZU ず
ZE ぜ
ZO ぞ
TA た
TI ち
TU つ
TE て
TO と
DA だ
DI ぢ
DU づ
DE で
DO ど
NA な
NI に
NU ぬ
NE ね
NO の
HA は
HI ひ
HU ふ
HE へ
HO ほ
BA ば
BI び
BU ぶ
BE べ
BO ぼ
PA ぱ
PI ぴ
PU ぷ
PE ぺ
PO ぽ
MA ま
MI み
MU む
ME め
MO も
YA や
YU ゆ
YO よ
RA ら
RI り
RU る
RE れ
RO ろ
WA わ
WI うぃ
WE うぇ
WO うぉ
NN ん
MM ん
KYA きゃ
KYI き
KYU きゅ
KYE きぇ
KYO きょ
GYA ぎゃ
GYI ぎ
GYU ぎゅ
GYE ぎぇ
GYO ぎょ
SYA しゃ
SYI し
SYU しゅ
SYE しぇ
SYO しょ
TYA ちゃ
TYI ち
TYU ちゅ
TYE ちぇ
TYO ちょ
ZYA じゃ
ZYI じ
ZYU じゅ
ZYE じぇ
ZYO じょ
DYA ぢゃ
DYI ぢ
DYU ぢゅ
DYE ぢぇ
DYO ぢょ
TJA てゃ
TJI てぃ
TJU てゅ
TJE てぇ
TJO てょ
DJA でゃ
DJI でぃ
DJU でゅ
DJE でぇ
DJO でょ
NYA にゃ
NYI に
NYU にゅ
NYE にぇ
NYO にょ
HYA ひゃ
HYI ひ
HYU ひゅ
HYE ひぇ
HYO ひょ
BYA びゃ
BYI び
BYU びゅ
BYE びぇ
BYO びょ
PYA ぴゃ
PYI ぴ
PYU ぴゅ
PYE ぴぇ
PYO ぴょ
FYA ふゃ
FYU ふゅ
FYE ふぇ
FYO ふょ
MYA みゃ
MYI み
MYU みゅ
MYE みぇ
MYO みょ
RYA りゃ
RYI り
RYU りゅ
RYE りぇ
RYO りょ
SHA しゃ
SHI し
SHU しゅ
SHE しぇ
SHO しょ
JA じゃ
JI じ
JU じゅ
JE じぇ
JO じょ
CHA ちゃ
CHI ち
CHU ちゅ
CHE ちぇ
CHO ちょ
TSA つぁ
TSI つぃ
TSU つ
TSE つぇ
TSO つぉ
SWA さ
SWI すぃ
SWU す
SWE せ
SWO そ
ZWA ざ
ZWI ずぃ
ZWU ず
ZWE ぜ
ZWO ぞ
TWA た
TWI てぃ
TWU とぅ
TWE てぇ
TWO と
DWA だ
DWI でぃ
DWU どぅ
DWE でぇ
DWO ど
FA ふぁ
FI ふぃ
FU ふ
FE ふぇ
FO ふぉ
15 changes: 6 additions & 9 deletions lib/miku/tasks/hardware/MidiRelayTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "daisy_seed.h"

namespace miku::tasks::hardware {
/// @brief Number of MIDI clock events per quarter note
const int MIDI_PPQN = 24;

class MidiRelayTask : public miku::tasks::Task {
Expand Down Expand Up @@ -48,18 +49,14 @@ namespace miku::tasks::hardware {

switch(msg.type)
{
// TODO properly calculate channel based on incoming message
uint8_t messageType = msg.type;
uint8_t channel = msg.channel;
uint8_t header = (messageType << 4) | channel;

case daisy::MidiMessageType::NoteOn:
{
uint8_t bytes[3] = {0x90, 0x00, 0x00};
bytes[1] = msg.data[0];
bytes[2] = msg.data[1];
this->midiHandler.SendMessage(bytes, 3);
}
break;
case daisy::MidiMessageType::NoteOff:
{
uint8_t bytes[3] = {0x80, 0x00, 0x00};
uint8_t bytes[3] = {header, 0x00, 0x00};
bytes[1] = msg.data[0];
bytes[2] = msg.data[1];
this->midiHandler.SendMessage(bytes, 3);
Expand Down