Wave Table Synthesizer(Occilator only). I will make Envelope Generator and MML for play music.

Dependencies:   mbed

Project: Synthesizer. It is using embed to Chip Tune Synthesizer for NXP LPC1768.

At First

Prepare an amplifier with volume wheel. The amplifier wire at pin1 to pin18(D/A converter) from IC Clip or Breedboard.

Play

Check out this project and deploy your mbed. And then push the reset key.

You hear a sound from amplifier.

Modify

First step, you can see main.cpp. This source file plays an occilator with "wait()". Modify frequency at

#define ADD 0x2000000

on the top of source.

Occilator select 7 waveforms.

  • OCC_NONE,
  • OCC_SQUARE,
  • OCC_SINE,
  • OCC_SAW,
  • OCC_WT,
  • OCC_NOISE,
  • OCC_TRIANGLE,

WT means WaveTable Synthesizer.Use "setWave()" function at first.Wavetable will copy in instance.

Change there for waveform.

    gOccilator[0]=Occilator::getInstance(OCC_SAW,INTERRUPT_TIME_US);

INTERRUPT_TIME_US depends sampling rate. Don't change.

Total volume of D/A converter is setting this place.

        gOccilator[0]->setVolume(volume);

By the way, this sample output 0 to 1V(not3.3V) for deforming distortion.

ToDo

  • Envelope generator and LFO(with delay)
  • MML(Music Macro Language)
  • Sample Song(I will make a Japanese Anime music,perhaps)

Project Goal Date

I will make for Comic Market 90(2016.Aug. in Tokyo).And these thing will be written in a Doujinshi.

Revision:
3:32094530d55e
Parent:
2:96affff92e0e
Child:
4:2febde858269
--- a/main.cpp	Fri Jan 22 05:26:04 2016 +0000
+++ b/main.cpp	Sat Jan 30 09:26:02 2016 +0000
@@ -6,7 +6,7 @@
 /*#define ADD 0x20000*/
 
 /*static unsigned int gLEDOn=0x0;*/
-static Channel* gChannel[2];
+static Occilator* gOccilator[2];
 
 DigitalOut myled1(LED1);
 DigitalOut myled2(LED2);
@@ -15,15 +15,15 @@
 //static void tick();
 
 int main() {
-    gChannel[0]=new Channel(INTERRUPT_TIME_US);
-    gChannel[0]->setOmega(ADD);
-    gChannel[1]=new Channel(INTERRUPT_TIME_US);
-    gChannel[1]->setOmega(ADD+0x100000);
+    gOccilator[0]=new Occilator(INTERRUPT_TIME_US);
+    gOccilator[0]->setOmega(ADD);
+    gOccilator[1]=new Occilator(INTERRUPT_TIME_US);
+    gOccilator[1]->setOmega(ADD+0x10000);
     int volume=0x1000;
     while(1) {
         wait(0.1);
-        gChannel[1]->setVolume(volume);
-        gChannel[0]->setVolume(volume);
+        gOccilator[1]->setVolume(volume);
+        gOccilator[0]->setVolume(volume);
         volume-=0x100;
         if (volume < 0)
         {