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@23:deb76bdf6f03, 2015-01-31 (annotated)
- Committer:
- kb10uy
- Date:
- Sat Jan 31 10:44:08 2015 +0000
- Revision:
- 23:deb76bdf6f03
- Parent:
- 22:500b4f2953fa
NRPN 10h xxh???
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 | 21:e3014c1bdf9c | 3 | #include "AQM0802A.h" |
kb10uy | 17:2e577c6000cf | 4 | #include "FMOperator.h" |
kb10uy | 21:e3014c1bdf9c | 5 | #include "MIDIUtil.h" |
kb10uy | 19:f0dcf591c5dd | 6 | #include "FMAlgorithm.h" |
kb10uy | 17:2e577c6000cf | 7 | |
kb10uy | 17:2e577c6000cf | 8 | class MIDIChannel |
kb10uy | 17:2e577c6000cf | 9 | { |
kb10uy | 17:2e577c6000cf | 10 | public: |
kb10uy | 17:2e577c6000cf | 11 | MIDIChannel(); |
kb10uy | 23:deb76bdf6f03 | 12 | MIDIChannel(AQM0802A *l, Timer *tm, AOTTrigon *tri); |
kb10uy | 19:f0dcf591c5dd | 13 | ~MIDIChannel(); |
kb10uy | 17:2e577c6000cf | 14 | |
kb10uy | 17:2e577c6000cf | 15 | inline void setModulationMSB(char msb) { |
kb10uy | 17:2e577c6000cf | 16 | modulation = msb; |
kb10uy | 17:2e577c6000cf | 17 | } |
kb10uy | 17:2e577c6000cf | 18 | inline void setModulationLSB(char lsb) { |
kb10uy | 17:2e577c6000cf | 19 | //modulation = lsb | (modulation & 0x3f80); |
kb10uy | 17:2e577c6000cf | 20 | } |
kb10uy | 17:2e577c6000cf | 21 | inline void setPortamentoTime(char val) { |
kb10uy | 17:2e577c6000cf | 22 | portamentoTime = val; |
kb10uy | 17:2e577c6000cf | 23 | } |
kb10uy | 17:2e577c6000cf | 24 | inline void setPortamentoSwitch(bool val) { |
kb10uy | 17:2e577c6000cf | 25 | portamento = val; |
kb10uy | 17:2e577c6000cf | 26 | } |
kb10uy | 17:2e577c6000cf | 27 | inline void setVolume(char val) { |
kb10uy | 17:2e577c6000cf | 28 | volume = val; |
kb10uy | 17:2e577c6000cf | 29 | } |
kb10uy | 17:2e577c6000cf | 30 | inline void setExpression(char val) { |
kb10uy | 17:2e577c6000cf | 31 | expression = val; |
kb10uy | 17:2e577c6000cf | 32 | } |
kb10uy | 17:2e577c6000cf | 33 | inline void setPanpot(char val) { |
kb10uy | 17:2e577c6000cf | 34 | panpot = val; |
kb10uy | 17:2e577c6000cf | 35 | } |
kb10uy | 17:2e577c6000cf | 36 | inline void startHold1() { |
kb10uy | 17:2e577c6000cf | 37 | hold1 = true; |
kb10uy | 17:2e577c6000cf | 38 | } |
kb10uy | 17:2e577c6000cf | 39 | inline void endHold1() { |
kb10uy | 17:2e577c6000cf | 40 | hold1 = false; |
kb10uy | 17:2e577c6000cf | 41 | } |
kb10uy | 19:f0dcf591c5dd | 42 | |
kb10uy | 19:f0dcf591c5dd | 43 | void setDataEntryMSB(char msb); |
kb10uy | 19:f0dcf591c5dd | 44 | void setDataEntryLSB(char lsb); |
kb10uy | 19:f0dcf591c5dd | 45 | void setNRPNMSB(char msb); |
kb10uy | 19:f0dcf591c5dd | 46 | void setNRPNLSB(char lsb); |
kb10uy | 19:f0dcf591c5dd | 47 | void setRPNMSB(char msb); |
kb10uy | 19:f0dcf591c5dd | 48 | void setRPNLSB(char lsb); |
kb10uy | 17:2e577c6000cf | 49 | void allSoundOff(); |
kb10uy | 17:2e577c6000cf | 50 | void allNoteOff(); |
kb10uy | 21:e3014c1bdf9c | 51 | void noteOn(char key, char vel, double time); |
kb10uy | 21:e3014c1bdf9c | 52 | void noteOff(char key, double time); |
kb10uy | 19:f0dcf591c5dd | 53 | |
kb10uy | 17:2e577c6000cf | 54 | private: |
kb10uy | 19:f0dcf591c5dd | 55 | enum DataState { |
kb10uy | 19:f0dcf591c5dd | 56 | Undefined = 0, |
kb10uy | 19:f0dcf591c5dd | 57 | RPNDoubleData, |
kb10uy | 19:f0dcf591c5dd | 58 | RPNSingleData, |
kb10uy | 19:f0dcf591c5dd | 59 | RPNNoData, |
kb10uy | 19:f0dcf591c5dd | 60 | NRPNDoubleData, |
kb10uy | 19:f0dcf591c5dd | 61 | NRPNSingleData, |
kb10uy | 19:f0dcf591c5dd | 62 | NRPNNoData, |
kb10uy | 19:f0dcf591c5dd | 63 | }; |
kb10uy | 21:e3014c1bdf9c | 64 | char prkey; |
kb10uy | 17:2e577c6000cf | 65 | char dataEntryMSB; |
kb10uy | 17:2e577c6000cf | 66 | char dataEntryLSB; |
kb10uy | 17:2e577c6000cf | 67 | char nrpnMSB; |
kb10uy | 17:2e577c6000cf | 68 | char nrpnLSB; |
kb10uy | 17:2e577c6000cf | 69 | char rpnMSB; |
kb10uy | 17:2e577c6000cf | 70 | char rpnLSB; |
kb10uy | 19:f0dcf591c5dd | 71 | DataState state; |
kb10uy | 17:2e577c6000cf | 72 | char modulation; |
kb10uy | 17:2e577c6000cf | 73 | char portamentoTime; |
kb10uy | 17:2e577c6000cf | 74 | bool portamento; |
kb10uy | 17:2e577c6000cf | 75 | char volume; |
kb10uy | 17:2e577c6000cf | 76 | char panpot; |
kb10uy | 17:2e577c6000cf | 77 | char expression; |
kb10uy | 17:2e577c6000cf | 78 | bool hold1; |
kb10uy | 19:f0dcf591c5dd | 79 | FMAlgorithm *algo; |
kb10uy | 21:e3014c1bdf9c | 80 | AQM0802A *lcd; |
kb10uy | 23:deb76bdf6f03 | 81 | Timer *timer; |
kb10uy | 23:deb76bdf6f03 | 82 | AOTTrigon *trigon; |
kb10uy | 19:f0dcf591c5dd | 83 | |
kb10uy | 22:500b4f2953fa | 84 | FunctionPointer nrpnStateSetter; |
kb10uy | 22:500b4f2953fa | 85 | FunctionPointer nrpnStateProcessor; |
kb10uy | 22:500b4f2953fa | 86 | |
kb10uy | 19:f0dcf591c5dd | 87 | void processRPNFunction(); |
kb10uy | 22:500b4f2953fa | 88 | void setNRPNFunctions(); |
kb10uy | 22:500b4f2953fa | 89 | void nrpnUndefined(); |
kb10uy | 22:500b4f2953fa | 90 | void setStateNRPNUndefined(); |
kb10uy | 22:500b4f2953fa | 91 | void nrpnAlgorithm(); |
kb10uy | 22:500b4f2953fa | 92 | void setStateNRPNAlgorithm(); |
kb10uy | 22:500b4f2953fa | 93 | void nrpnOperator(); |
kb10uy | 22:500b4f2953fa | 94 | void setStateNRPNOperator(); |
kb10uy | 17:2e577c6000cf | 95 | }; |