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.

Committer:
117Florian
Date:
Thu Jan 21 10:24:33 2016 +0000
Revision:
1:af7abed0bfb5
Parent:
0:df2c24629de5
Child:
2:96affff92e0e
???????????????????????????????????????????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
117Florian 0:df2c24629de5 1 #include "mbed.h"
117Florian 0:df2c24629de5 2 #define MAIN
117Florian 0:df2c24629de5 3 #include "global.h"
117Florian 0:df2c24629de5 4
117Florian 1:af7abed0bfb5 5 #define ADD 0x2000000
117Florian 1:af7abed0bfb5 6 /*#define ADD 0x20000*/
117Florian 1:af7abed0bfb5 7
117Florian 1:af7abed0bfb5 8 /*static unsigned int gLEDOn=0x0;*/
117Florian 1:af7abed0bfb5 9 static Channel* gChannel[2];
117Florian 0:df2c24629de5 10
117Florian 1:af7abed0bfb5 11 DigitalOut myled1(LED1);
117Florian 1:af7abed0bfb5 12 DigitalOut myled2(LED2);
117Florian 1:af7abed0bfb5 13 DigitalOut myled3(LED3);
117Florian 1:af7abed0bfb5 14 DigitalOut myled4(LED4);
117Florian 1:af7abed0bfb5 15 //static void tick();
117Florian 0:df2c24629de5 16
117Florian 0:df2c24629de5 17 int main() {
117Florian 1:af7abed0bfb5 18 // gTicker.attach_us(tick,22);
117Florian 1:af7abed0bfb5 19 // myled1=1;
117Florian 1:af7abed0bfb5 20 gChannel[0]=new Channel(INTERRUPT_TIME_US);
117Florian 1:af7abed0bfb5 21 gChannel[0]->setOmega(ADD);
117Florian 1:af7abed0bfb5 22 gChannel[1]=new Channel(INTERRUPT_TIME_US);
117Florian 1:af7abed0bfb5 23 gChannel[1]->setOmega(ADD+0x100000);
117Florian 0:df2c24629de5 24 while(1) {
117Florian 0:df2c24629de5 25 wait(1);
117Florian 0:df2c24629de5 26 }
117Florian 0:df2c24629de5 27 }
117Florian 1:af7abed0bfb5 28 /*
117Florian 0:df2c24629de5 29 void tick()
117Florian 0:df2c24629de5 30 {
117Florian 0:df2c24629de5 31 if (gLEDOn & 0x80000000)
117Florian 0:df2c24629de5 32 {
117Florian 0:df2c24629de5 33 myled = 1;
117Florian 0:df2c24629de5 34 signal = 0xffff0000;
117Florian 0:df2c24629de5 35 }
117Florian 0:df2c24629de5 36 else
117Florian 0:df2c24629de5 37 {
117Florian 0:df2c24629de5 38 myled = 0;
117Florian 0:df2c24629de5 39 signal = 0;
117Florian 0:df2c24629de5 40 }
117Florian 0:df2c24629de5 41 gLEDOn+=ADD;
117Florian 1:af7abed0bfb5 42 }
117Florian 1:af7abed0bfb5 43 */