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
- Committer:
- kb10uy
- Date:
- 2014-12-23
- Revision:
- 4:e300f6fd7f96
- Parent:
- 3:e98f2da2d3c5
- Child:
- 5:6f060709aa23
File content as of revision 4:e300f6fd7f96:
#include "Main.h" Ticker sampler; Timer master; MCP4922 output(D4,D3,D7); AOTTrigon t(64); const double smpps = 40000.0; const double smptime = 1.0 / smpps; const double smpus = 1000000.0 / smpps; double ntime = 0.0; double freq = 1.0; void tick_sampling(); int main(){ output.frequency(20000000); sampler.attach_us(&tick_sampling, smpus); master.start(); while(1); } void tick_sampling() { ntime=master.read_us()/1000000.0; for(int i=0;i<32;i++) t.sine(M_PI*2.0*freq*ntime); output.writeA((int)(4095*(t.sine(M_PI*2.0*freq*ntime)/2.0+0.5))); }