Nucleo F401REでFM音源を実装するやつ 外部DACとオペアンプを利用 現在はMCP4922とNJM2737

Dependencies:   AOTTrigon I2CEEPROM MCP4922 AQM0802A mbed

Fork of NuMidi401 by Yuu Kobayashi

NuFM401

Nucleo F401用の自作ソフトウェアMIDI音源

概要

だいたいそんなもんです。

特徴

  • ブレッドボードの上で組める程度には簡単な回路構成
  • 外部のDACにMCP4922を採用
  • 念のためのボルテージフォロアとしてNJM2737Dを採用
  • バンク用EEPROMに24FC1025を採用
  • シリアル経由でMIDIデータを受信することで操作

補足

シリアル <=> MIDI のドライバにはHairless-MIDISerialをオススメします。 仮想MIDIケーブルはとりあえずMIDI Yokeで。

Files at this revision

API Documentation at this revision

Comitter:
kb10uy
Date:
Sat Jan 31 10:54:13 2015 +0000
Parent:
23:deb76bdf6f03
Commit message:
NRPN 20h xxh???

Changed in this revision

FMOscillator/FMAlgorithm.h Show annotated file Show diff for this revision Revisions of this file
FMOscillator/MIDIChannel.NRPNFunction.cpp Show annotated file Show diff for this revision Revisions of this file
Main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r deb76bdf6f03 -r f93b49b4cd66 FMOscillator/FMAlgorithm.h
--- a/FMOscillator/FMAlgorithm.h	Sat Jan 31 10:44:08 2015 +0000
+++ b/FMOscillator/FMAlgorithm.h	Sat Jan 31 10:54:13 2015 +0000
@@ -22,6 +22,10 @@
     FMAlgorithm();
     FMAlgorithm(int opc, int cnc, Timer *tm, AOTTrigon *tri);
     ~FMAlgorithm();
+    FMOperator* getOperator(int idx) {
+        if (idx < opcount) return operators[idx];
+        return operators[idx];
+    }
     void setConnection(int t, int s);
     void setConnectionIndex(int id);
     void enableCurrentConnection();
diff -r deb76bdf6f03 -r f93b49b4cd66 FMOscillator/MIDIChannel.NRPNFunction.cpp
--- a/FMOscillator/MIDIChannel.NRPNFunction.cpp	Sat Jan 31 10:44:08 2015 +0000
+++ b/FMOscillator/MIDIChannel.NRPNFunction.cpp	Sat Jan 31 10:54:13 2015 +0000
@@ -79,7 +79,35 @@
 
 void MIDIChannel::nrpnOperator()
 {
-
+    switch(nrpnLSB) {
+        case 0x01:
+            algo->getOperator(dataEntryMSB)->setAttack(dataEntryLSB);
+            break;
+        case 0x02:
+            algo->getOperator(dataEntryMSB)->setDecay(dataEntryLSB);
+            break;
+        case 0x03:
+            algo->getOperator(dataEntryMSB)->setSustain(dataEntryLSB);
+            break;
+        case 0x04:
+            algo->getOperator(dataEntryMSB)->setSustainRate(dataEntryLSB);
+            break;
+        case 0x05:
+            algo->getOperator(dataEntryMSB)->setRelease(dataEntryLSB);
+            break;
+        case 0x06:
+            algo->getOperator(dataEntryMSB)->setFrequencyMultiple(dataEntryLSB);
+            break;
+        case 0x07:
+            algo->getOperator(dataEntryMSB)->setFrequencyMultipleFloating(dataEntryLSB);
+            break;
+        case 0x08:
+            algo->getOperator(dataEntryMSB)->setTotalLevel(dataEntryLSB);
+            break;
+        case 0x09:
+            algo->getOperator(dataEntryMSB)->setFeedback(dataEntryLSB);
+            break;
+    }
 }
 
 void MIDIChannel::setStateNRPNOperator()
diff -r deb76bdf6f03 -r f93b49b4cd66 Main.cpp
--- a/Main.cpp	Sat Jan 31 10:44:08 2015 +0000
+++ b/Main.cpp	Sat Jan 31 10:54:13 2015 +0000
@@ -8,8 +8,8 @@
 Serial midiserial(USBTX,USBRX);
 FMOscillator *fm;
 
-const double smpps = 40000.0;
-const double smpus = 1000000.0 / smpps;
+//const double smpps = 40000.0;
+//const double smpus = 1000000.0 / smpps;
 
 double ntime = 0.0;