Nucleo F401REでFM音源を実装するやつ 外部DACとオペアンプを利用 現在はMCP4922とNJM2737
Dependencies: AOTTrigon I2CEEPROM MCP4922 AQM0802A mbed
Fork of NuMidi401 by
NuFM401
Nucleo F401用の自作ソフトウェアMIDI音源
概要
だいたいそんなもんです。
特徴
- ブレッドボードの上で組める程度には簡単な回路構成
- 外部のDACにMCP4922を採用
- 念のためのボルテージフォロアとしてNJM2737Dを採用
- バンク用EEPROMに24FC1025を採用
- シリアル経由でMIDIデータを受信することで操作
補足
シリアル <=> MIDI のドライバにはHairless-MIDISerialをオススメします。 仮想MIDIケーブルはとりあえずMIDI Yokeで。
Diff: FMOscillator/MIDIChannel.cpp
- Revision:
- 19:f0dcf591c5dd
- Parent:
- 17:2e577c6000cf
- Child:
- 20:8278e607a687
diff -r b20fdf1da8f8 -r f0dcf591c5dd FMOscillator/MIDIChannel.cpp --- a/FMOscillator/MIDIChannel.cpp Tue Jan 27 13:25:14 2015 +0000 +++ b/FMOscillator/MIDIChannel.cpp Thu Jan 29 11:05:37 2015 +0000 @@ -9,6 +9,62 @@ panpot = 64; expression = 127; hold1 = false; + dataEntryMSB = 0; + dataEntryLSB = 0; + nrpnMSB = 0; + nrpnLSB = 0; + rpnMSB = 0; + rpnLSB = 0; + algo = NULL; + state = Undefined; +} + +MIDIChannel::~MIDIChannel() +{ + if (algo != NULL) delete algo; +} + +void MIDIChannel::setDataEntryMSB(char msb) +{ + dataEntryMSB = msb; + +} + +void MIDIChannel::setDataEntryLSB(char lsb) +{ + dataEntryLSB = lsb; +} + +void MIDIChannel::setNRPNMSB(char msb) +{ + nrpnMSB = msb; + if (msb >= 0x60) { + state = NRPNSingleData; + } else { + state = NRPNDoubleData; + } +} + +void MIDIChannel::setNRPNLSB(char lsb) +{ + nrpnLSB = lsb; + if (state == NRPNNoData) processNRPNFunction(); +} + +void MIDIChannel::setRPNMSB(char msb) +{ + rpnMSB = msb; + if (msb == 0x7f){ + state = RPNNoData; + } else { + state = RPNSingleData; + } +} + +void MIDIChannel::setRPNLSB(char lsb) +{ + rpnLSB = lsb; + if (state == RPNNoData) processRPNFunction(); } void MIDIChannel::allSoundOff() @@ -17,4 +73,27 @@ void MIDIChannel::allNoteOff() { +} + +void MIDIChannel::processNRPNFunction() { + switch(nrpnMSB) { + + } +} + +void MIDIChannel::processRPNFunction() { + switch(rpnMSB) { + case 0x00: + //LSB 0~2全部実装できないですから + break; + case 0x7f: + if (rpnLSB == 0x7f) { + rpnMSB = 0; + rpnLSB = 0; + nrpnMSB = 0; + nrpnLSB = 0; + } + break; + } + state = Undefined; } \ No newline at end of file