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で。
FMOscillator/MIDIChannel.h@20:8278e607a687, 2015-01-29 (annotated)
- Committer:
- kb10uy
- Date:
- Thu Jan 29 11:09:56 2015 +0000
- Revision:
- 20:8278e607a687
- Parent:
- 19:f0dcf591c5dd
- Child:
- 21:e3014c1bdf9c
??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kb10uy | 17:2e577c6000cf | 1 | #pragma once |
kb10uy | 17:2e577c6000cf | 2 | #include "mbed.h" |
kb10uy | 17:2e577c6000cf | 3 | #include "FMOperator.h" |
kb10uy | 17:2e577c6000cf | 4 | #include "MIDIChannel.h" |
kb10uy | 19:f0dcf591c5dd | 5 | #include "FMAlgorithm.h" |
kb10uy | 17:2e577c6000cf | 6 | |
kb10uy | 17:2e577c6000cf | 7 | class MIDIChannel |
kb10uy | 17:2e577c6000cf | 8 | { |
kb10uy | 17:2e577c6000cf | 9 | public: |
kb10uy | 17:2e577c6000cf | 10 | MIDIChannel(); |
kb10uy | 19:f0dcf591c5dd | 11 | ~MIDIChannel(); |
kb10uy | 17:2e577c6000cf | 12 | |
kb10uy | 17:2e577c6000cf | 13 | inline void setModulationMSB(char msb) { |
kb10uy | 17:2e577c6000cf | 14 | modulation = msb; |
kb10uy | 17:2e577c6000cf | 15 | } |
kb10uy | 17:2e577c6000cf | 16 | inline void setModulationLSB(char lsb) { |
kb10uy | 17:2e577c6000cf | 17 | //modulation = lsb | (modulation & 0x3f80); |
kb10uy | 17:2e577c6000cf | 18 | } |
kb10uy | 17:2e577c6000cf | 19 | inline void setPortamentoTime(char val) { |
kb10uy | 17:2e577c6000cf | 20 | portamentoTime = val; |
kb10uy | 17:2e577c6000cf | 21 | } |
kb10uy | 17:2e577c6000cf | 22 | inline void setPortamentoSwitch(bool val) { |
kb10uy | 17:2e577c6000cf | 23 | portamento = val; |
kb10uy | 17:2e577c6000cf | 24 | } |
kb10uy | 17:2e577c6000cf | 25 | inline void setVolume(char val) { |
kb10uy | 17:2e577c6000cf | 26 | volume = val; |
kb10uy | 17:2e577c6000cf | 27 | } |
kb10uy | 17:2e577c6000cf | 28 | inline void setExpression(char val) { |
kb10uy | 17:2e577c6000cf | 29 | expression = val; |
kb10uy | 17:2e577c6000cf | 30 | } |
kb10uy | 17:2e577c6000cf | 31 | inline void setPanpot(char val) { |
kb10uy | 17:2e577c6000cf | 32 | panpot = val; |
kb10uy | 17:2e577c6000cf | 33 | } |
kb10uy | 17:2e577c6000cf | 34 | inline void startHold1() { |
kb10uy | 17:2e577c6000cf | 35 | hold1 = true; |
kb10uy | 17:2e577c6000cf | 36 | } |
kb10uy | 17:2e577c6000cf | 37 | inline void endHold1() { |
kb10uy | 17:2e577c6000cf | 38 | hold1 = false; |
kb10uy | 17:2e577c6000cf | 39 | } |
kb10uy | 19:f0dcf591c5dd | 40 | |
kb10uy | 19:f0dcf591c5dd | 41 | void setDataEntryMSB(char msb); |
kb10uy | 19:f0dcf591c5dd | 42 | void setDataEntryLSB(char lsb); |
kb10uy | 19:f0dcf591c5dd | 43 | void setNRPNMSB(char msb); |
kb10uy | 19:f0dcf591c5dd | 44 | void setNRPNLSB(char lsb); |
kb10uy | 19:f0dcf591c5dd | 45 | void setRPNMSB(char msb); |
kb10uy | 19:f0dcf591c5dd | 46 | void setRPNLSB(char lsb); |
kb10uy | 17:2e577c6000cf | 47 | void allSoundOff(); |
kb10uy | 17:2e577c6000cf | 48 | void allNoteOff(); |
kb10uy | 19:f0dcf591c5dd | 49 | |
kb10uy | 19:f0dcf591c5dd | 50 | |
kb10uy | 17:2e577c6000cf | 51 | private: |
kb10uy | 19:f0dcf591c5dd | 52 | enum DataState { |
kb10uy | 19:f0dcf591c5dd | 53 | Undefined = 0, |
kb10uy | 19:f0dcf591c5dd | 54 | RPNDoubleData, |
kb10uy | 19:f0dcf591c5dd | 55 | RPNSingleData, |
kb10uy | 19:f0dcf591c5dd | 56 | RPNNoData, |
kb10uy | 19:f0dcf591c5dd | 57 | NRPNDoubleData, |
kb10uy | 19:f0dcf591c5dd | 58 | NRPNSingleData, |
kb10uy | 19:f0dcf591c5dd | 59 | NRPNNoData, |
kb10uy | 19:f0dcf591c5dd | 60 | }; |
kb10uy | 19:f0dcf591c5dd | 61 | |
kb10uy | 17:2e577c6000cf | 62 | char dataEntryMSB; |
kb10uy | 17:2e577c6000cf | 63 | char dataEntryLSB; |
kb10uy | 17:2e577c6000cf | 64 | char nrpnMSB; |
kb10uy | 17:2e577c6000cf | 65 | char nrpnLSB; |
kb10uy | 17:2e577c6000cf | 66 | char rpnMSB; |
kb10uy | 17:2e577c6000cf | 67 | char rpnLSB; |
kb10uy | 19:f0dcf591c5dd | 68 | DataState state; |
kb10uy | 17:2e577c6000cf | 69 | char modulation; |
kb10uy | 17:2e577c6000cf | 70 | char portamentoTime; |
kb10uy | 17:2e577c6000cf | 71 | bool portamento; |
kb10uy | 17:2e577c6000cf | 72 | char volume; |
kb10uy | 17:2e577c6000cf | 73 | char panpot; |
kb10uy | 17:2e577c6000cf | 74 | char expression; |
kb10uy | 17:2e577c6000cf | 75 | bool hold1; |
kb10uy | 19:f0dcf591c5dd | 76 | FMAlgorithm *algo; |
kb10uy | 19:f0dcf591c5dd | 77 | |
kb10uy | 19:f0dcf591c5dd | 78 | void processRPNFunction(); |
kb10uy | 19:f0dcf591c5dd | 79 | void processNRPNFunction(); |
kb10uy | 17:2e577c6000cf | 80 | }; |