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で。
Main.cpp@24:f93b49b4cd66, 2015-01-31 (annotated)
- Committer:
- kb10uy
- Date:
- Sat Jan 31 10:54:13 2015 +0000
- Revision:
- 24:f93b49b4cd66
- Parent:
- 23:deb76bdf6f03
NRPN 20h xxh???
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kb10uy | 1:cde592d8076e | 1 | #include "Main.h" |
kb10uy | 1:cde592d8076e | 2 | |
kb10uy | 10:0ffdefe75566 | 3 | MCP4922 output(PA_7, PA_5, PA_8); |
kb10uy | 16:5cfa8b491882 | 4 | I2C lcdbus(D14, D15); |
kb10uy | 10:0ffdefe75566 | 5 | |
kb10uy | 16:5cfa8b491882 | 6 | AOTTrigon trigon; |
kb10uy | 16:5cfa8b491882 | 7 | Timer timer; |
kb10uy | 16:5cfa8b491882 | 8 | Serial midiserial(USBTX,USBRX); |
kb10uy | 16:5cfa8b491882 | 9 | FMOscillator *fm; |
kb10uy | 3:e98f2da2d3c5 | 10 | |
kb10uy | 24:f93b49b4cd66 | 11 | //const double smpps = 40000.0; |
kb10uy | 24:f93b49b4cd66 | 12 | //const double smpus = 1000000.0 / smpps; |
kb10uy | 3:e98f2da2d3c5 | 13 | |
kb10uy | 3:e98f2da2d3c5 | 14 | double ntime = 0.0; |
kb10uy | 10:0ffdefe75566 | 15 | |
kb10uy | 11:62da91a1eaf1 | 16 | |
kb10uy | 10:0ffdefe75566 | 17 | int main() |
kb10uy | 10:0ffdefe75566 | 18 | { |
kb10uy | 23:deb76bdf6f03 | 19 | fm = new FMOscillator(&timer, &midiserial, &trigon, &lcdbus); |
kb10uy | 10:0ffdefe75566 | 20 | //DAC setting |
kb10uy | 5:6f060709aa23 | 21 | output.referenceMode(MCP4922::DAC_A, MCP4922::REF_UNBUFFERED); |
kb10uy | 5:6f060709aa23 | 22 | output.gainMode(MCP4922::DAC_A, MCP4922::GAIN_1X); |
kb10uy | 5:6f060709aa23 | 23 | output.powerMode(MCP4922::DAC_A, MCP4922::POWER_NORMAL); |
kb10uy | 5:6f060709aa23 | 24 | output.referenceMode(MCP4922::DAC_B, MCP4922::REF_UNBUFFERED); |
kb10uy | 5:6f060709aa23 | 25 | output.gainMode(MCP4922::DAC_B, MCP4922::GAIN_1X); |
kb10uy | 5:6f060709aa23 | 26 | output.powerMode(MCP4922::DAC_B, MCP4922::POWER_NORMAL); |
kb10uy | 13:e11380ceb460 | 27 | |
kb10uy | 11:62da91a1eaf1 | 28 | while(true) { |
kb10uy | 16:5cfa8b491882 | 29 | ntime = timer.read_us()/1000000.0; |
kb10uy | 13:e11380ceb460 | 30 | //output.write(MCP4922::DAC_A,out/oc+0.5); |
kb10uy | 11:62da91a1eaf1 | 31 | } |
kb10uy | 10:0ffdefe75566 | 32 | } |