Friday, 23 August 2013

Simple mono synth with groovuino library

Here is a simple example on how to make a monophnic 1-osc synth with the groovuino lib.
I added a low-pass filter and a very light sequencer.

Here is the video :



You just need 4 potentiometers and an audio out as described in this post :
http://groovuino.blogspot.fr/2013/03/the-goal-is-to-build-groovebox-using.html

The potentiometers are plugged on analog inputs 3,4,5 and 6.

Analog 3 : octave of the arpeggio
Analog 4 : filter frequency
Analog 5 : bpm
Analog 6 : choice of the arpeggio



The code :

Incude your libraries. We just need the osc and low-pass filter.


#include <arduino.h>
#include <osc.h>
#include <filter.h>

We will use the Due timer library. I like it. You can download it here https://github.com/ivanseidel/DueTimer, and copy the repository in your arduino library folder.

#include <DueTimer.h>

Now instanciate your oscillator and filter :

Osc osc;
LowPassFilter LP;


Some data we will need for the arpeggiator :

int step = 0;
int numarp = 0;
int count = 0;


The arpeggio sequences (8 sequences of 16 notes). You can build your own sequences.
0 is is A 440 Hz. 2 = B, 3 = C, 12 = A octave...


int nArps[8][16] = {
{0,0,12,0,0,0,3,15,2,14,0,0,-2,-2,0,12},
{0,12,-2,0,1,13,1,1,5,17,5,17,4,16,0,0}, 
{0,-2,0,3,5,3,0,-2,0,-2,0,3,5,6,5,3},
{0,0,12,0,24,22,12,15,0,-2,0,0,24,36,3,-2},
{0,12,0,15,0,19,0,18,0,15,0,12,0,24,0,-2},
{0,0,3,0,0,0,0,-2,0,0,0,0,0,3,5,-2},
{0,0,0,0,0,0,7,7,6,6,6,6,6,6,-2,-2},
{0,0,3,0,0,-2,0,0,0,0,3,0,5,3,0,3}};


Initialize everything :

void setup() 

  Serial.begin(9600); 

The analog inputs :

  pinMode(A6, INPUT);
  pinMode(A5, INPUT);
  pinMode(A4, INPUT);
  pinMode(A3, INPUT);

Start the timers : one 44.1 kHz for audio generation, and on 100 Hz for sequencer :

  Timer0.attachInterrupt(loop1).setFrequency(44100).start();
  Timer8.attachInterrupt(loop2).setFrequency(100).start();

Generate the wavetables. We'll only use Sine, Saw, and Square :

  createSineTable();
  createSawTable();  
  createSqTable();    

Initialize the DAC output.

  analogWrite(DAC1,0); 

Set cutoff and resonance to default values :

  LP.setCutoffFreq(255);
  LP.setResonance(255);

Set the oscillator to default values :

  osc.init();
  osc.setWaveform(0,30);
  osc.setVolOsc(0, 127);
  osc.setNote(50,50);



Read the potentiometers.
analog 6 selects the arpeggio number (8 arrpeggios, so the number is 3 bits long)
analog 4 sets the cutoff frequency

void loop() 

  numarp = analogRead(6)>>7;
  LP.setCutoffFreq(analogRead(4)>>3);
  delay(5);
}


Generate the sound :
One osc with LP filter.

void loop1() 

  int32_t ulOutput=2048;

  osc.next();

  ulOutput += LP.next(osc.output());
   
  if(ulOutput>4095) ulOutput=4095;
  if(ulOutput<0) ulOutput=0;
  dacc_write_conversion_data(DACC_INTERFACE, ulOutput); 
}

The sequencer :
analog 5 fixes the tempo. If the value is high, the time between 2 notes will be long.
analog 3 sets the octave. (it adds an integer * 12 to the note).

void loop2()
{
  if(count>=(analogRead(5)>>4))
  {
    if(step>=15) step = 0;
    else step+=1;
    osc.setNote((analogRead(3)>>7)*12+nArps[numarp][step],100);
    count = 0;
  }
  else count++;
}

Friday, 14 June 2013

Polyphonic sampler

After making a simple sampler, let's code a polyphonic sampler now.
First of all, it's necessary to copy samples on a SD card. The samples need to be consecutive, so the best to do is to format SD card before copying the samples.

As usual, the groovuino library will be used.
The names of the samples used have to be changed in the samplerl.h file.

Here is the code.

First, call groovuino library elements you will need, and instanciate objects :

#include <arduino.h>
#include <sequencer.h>

const int samplernumber = 6; // polyphony

Pattern drumpat[samplernumber];

#include <SdFat.h>

SdFat sd;
Sd2Card *card = sd.card();

#include <samplerl.h>
#include <DueTimer.h>


Samplerl samp[samplernumber];

uint32_t step = 0;
int bpm=120;

Now, the setup function where you initialize your data. This is here you will enter a drum sequence.
There are 96 steps in a measure. So 24 steps for each time, 12 steps for a quaver...

void setup()
{
  Serial.begin(9600);
 
  bpm = 120;

  Timer0.attachInterrupt(loop1).setFrequency(44100).start();
  Timer4.attachInterrupt(loop2).setFrequency((bpm*24/60)).start();

  analogWrite(DAC1,0);

  sd.begin(chipSelect, SPI_FULL_SPEED);

  for(int i=0; i<samplernumber; i++)
  {
    samp[i].init();
    samp[i].load(samplefile[i]);
    delay(5);
  }

  for(int i=0; i<samplernumber; i++)
  {
    drumpat[i].init();
  }

// Drum sequence
  drumpat[0].noteon[0] = true;
  drumpat[0].seqvol[0] = 50;

  drumpat[0].noteon[12] = true;
  drumpat[0].seqvol[12] = 50;

  drumpat[2].noteon[48] = true;
  drumpat[2].seqvol[48] = 50;

  drumpat[3].noteon[48] = true;
  drumpat[3].seqvol[48] = 50;

  drumpat[3].noteon[24] = true;
  drumpat[3].seqvol[24] = 50;

  drumpat[3].noteon[72] = true;
  drumpat[3].seqvol[72] = 50;

  drumpat[2].noteon[72] = true;
  drumpat[2].seqvol[72] = 50;

  drumpat[0].noteon[72] = true;
  drumpat[0].seqvol[72] = 50;

  drumpat[4].noteon[48] = true;
  drumpat[4].seqvol[48] = 80;

  drumpat[5].noteon[48] = true;
  drumpat[5].seqvol[48] = 80;

  drumpat[5].noteon[36] = true;
  drumpat[5].seqvol[36] = 80;

  drumpat[0].noteon[24] = true;
  drumpat[0].seqvol[24] = 50;

  drumpat[1].noteon[24] = true;
  drumpat[1].seqvol[24] = 50;

  drumpat[1].noteon[0] = true;
  drumpat[1].seqvol[0] = 80;

  drumpat[1].noteon[12] = true;
  drumpat[1].seqvol[12] = 20;

  drumpat[1].noteon[24] = true;
  drumpat[1].seqvol[24] = 80;

  drumpat[1].noteon[36] = true;
  drumpat[1].seqvol[36] = 20;

  drumpat[1].noteon[48] = true;
  drumpat[1].seqvol[48] = 80;

  drumpat[1].noteon[60] = true;
  drumpat[1].seqvol[60] = 20;

  drumpat[1].noteon[72] = true;
  drumpat[1].seqvol[72] = 80;

  drumpat[1].noteon[84] = true;
  drumpat[1].seqvol[84] = 20;
}



The sample buffers are filled in the main loop :

void loop() 

  for(int i=0; i<samplernumber; i++)
  {
    if(samp[i].buffill()) i= 100;
  }
}


The 44 kHz loop to generate the sample sound :

void loop1() 

  int32_t ulOutput=2048;

  for(int i=0; i<samplernumber; i++)
  {
    samp[i].next();
    ulOutput += samp[i].output();
  }
  
  if(ulOutput>4095) ulOutput=4095;
  if(ulOutput<0) ulOutput=0;
   
  dacc_write_conversion_data(DACC_INTERFACE, ulOutput); 
}


The sequencer loop :


void loop2()
{
    if(step>=95) step = 0;
    else step++;
    for(int i=0; i<samplernumber; i++)
    {
      if(drumpat[i].noteon[step])
      {
        samp[i].splay(drumpat[i].seqvol[step], 1);
      }
    }
}






Wednesday, 22 May 2013

Groovuino groove box demo

Here is the demo of a first version of the groove box made with groovuino library.







It has :

Mono synth section
3 osc with multiple waveforms, tuning, etc...
An ADSR enveloppe
A LP filter (Mozzi filter)
An LFO linked on the filter frequency.
The sensors permit to play notes.

Arpeggiator section
arpeggiator modes (random, UP, DOWN, UP/DOWN)
arpeggiator speed
Scales (pentatonic, dorian, arabic, minor, major, etc...)
pitch (only octave)
The note length can be changed by the IR sensor

Sampler section
For the moment, just one 16 steps sequenced loop, the sequence can be real-time recorded
4 samples read. Can put the one shot samples on the SD card.

Explainations here on how to build the groovuino : http://groovuino.blogspot.com/2013/03/the-goal-is-to-build-groovebox-using.html

Thursday, 18 April 2013

Let's code a simple sampler

Using the groovuino library, we'll make a simple sampler, which will play a "poum-tchack" rythm.

You can hear the result here :
https://soundcloud.com/gaetino/poumtchack

First of all, you will have to wire a SD card to the SPI port, and making an audio out on the Arduino. Please refer to this post if you don't know how to connect the hardware :
http://groovuino.blogspot.com/2013/03/the-goal-is-to-build-groovebox-using.html

On the SD card, you will transfer 2 one-shot wave files (44 kHz), named "kick1.wav" and "snare1.wav".

Download groovuino library and SdFat lib :
https://github.com/Gaetino/Groovuino
https://code.google.com/p/sdfatlib/
Then put them in your favorite arduino library repository.

As usual, we'll begin the code by importing libraries :


#include <SdFat.h>
#include <sampler.h>
#include <timer.h> 

Now instanciate a Sd and a sampler object :


SdFat sd;
Sampler sampler;


To make the beat, we'll use a simple timer :

int to = 0;

Now the setup method to initialize our data :

void setup() 


// Start the audio engine
  startTimer(TC1, 1, TC4_IRQn, 44100);
  analogWrite(DAC1,0); 


    sd.begin(chipSelect, SPI_FULL_SPEED);
    sampler.init();
}

We'll use the loop() method to compute the beat, and to fill the wave buffer if necessary.
Of course, if you want to make a groovebox, you will need another timer to get the beat and trigger the samples.


void loop() 
{
   if(to>100000) 
   {
     to=0;
 // POUM
     sampler.load("kick1.wav");
     sampler.splay(100,1);
   }
   
   if(to==50000) 
   {
 // TCHACK
     sampler.load("snare1.wav");
     sampler.splay(100,1);
   }
   
   sampler.buffill();
   
   delayMicroseconds(10);
   
   to++;


And finally, as usual, the audio engine :


void TC4_Handler() 

   TC_GetStatus(TC1, 1); 

// 2048 is the 0 value of audio out.
   int16_t ulOutput=2048;

   sampler.next();
   
   ulOutput += sampler.output();

   if(ulOutput>4095) ulOutput=4095;
   dacc_write_conversion_data(DACC_INTERFACE, ulOutput); 
}


That's it. If all is good, you can hear a "poum-tchack".

Wednesday, 3 April 2013

Build a groove box with Arduino Due, Post3 : Let's code a simple synth

After explaining the project in posts 1 and 2, now let's code into the Arduino Due.
Please refer to the main post : http://groovuino.blogspot.fr/2013/03/the-goal-is-to-build-groovebox-using.html
You can use the USB cable with Programming Port. For now, no need to external power supply. all components used have very low power needs. When we'll add LCD, it will be necessary.

First of all, download the groovuino library on guithub :
https://github.com/Gaetino/Groovuino

Then copy the folder into the library of your arduino folder.

If you haven't got yet, download the latest arduino environment here :
http://arduino.cc/en/Main/Software

Be careful to take the one working with Arduino Due.


Now, we'll code a synth which is working with the groovuino hardware.

Libraries

First, before making any code, import all the libraries you need :


#include <arduino.h>
#include <osc.h>
#include <env.h>
#include <filter.h>
#include <sequencer.h>

#define POLIPHONY 1
int notes[POLIPHONY];

#include <interface.h>
#include <arp.h> 
#include <timer.h> 



Now we instantiate the voices and their volume envelopes, and the filter. For the moment, there will be just 1 voice, we'll make a mono synth.

Osc oscA[POLIPHONY];
Env env1[POLIPHONY];

LowPassFilter LP;

We need some status :


boolean play = false;
boolean mono = true;


We have to include the analogread.h function AFTER having instantiated envelopes, oscillators and filter, because it's using these objects.

#include <analogread.h>


Initialization (setup function)

void setup() 


// Defining pots and sensors  
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);
  pinMode(A6, INPUT);

// Loading osc tables
  createSineTable();
  createSawTable();  
  createSqTable();  

// Start the audio engine
  startTimer(TC1, 1, TC4_IRQn, 44100);
  analogWrite(DAC1,0); 
  
// Set filter default values
  LP.setCutoffFreq(255);
  LP.setResonance(1);
  
  for(int i=0; i<POLIPHONY; i++)
  {
    oscA[i].init();
    env1[i].init();
    notes[i]=0;
  }

  play=false;
  
  analogcontroller_init();

// Set the glide time at 2 ms
  oscA[0].setGlideTime(2);
  
  init_interface();
}   

The loop function will be only used to read sensor and potentiometers data.


void loop() 

  read_input();
  analogcontroller_read();
}



Finally, the 44 kHz loop, where we have to read oscillators values


void TC4_Handler() 


 TC_GetStatus(TC1, 1); 

 int32_t ulOutput=2048;

// load oscillator value  
 oscA[0].next();
 ulOutput += oscA[0].output();

// apply filter effect
  if(ulOutput>10) ulOutput = LP.next(ulOutput);

// apply envelope 
  ulOutput = (ulOutput * env1[0].amount())>>19;

// apply global volume
  ulOutput = (ulOutput*volsynth)>>7;

  
  if(ulOutput>4095) ulOutput=4095;
   
  dacc_write_conversion_data(DACC_INTERFACE, ulOutput); 
}



To be continued...



Build a groove box with Arduino Due, Post2 : Main functionnalities

Here I will describe how the interface will act on software. I wanted a simple interface, with no menus.
If it's convincing, I will make a more elaborate interface.

Please refer to the main post : http://groovuino.blogspot.fr/2013/03/the-goal-is-to-build-groovebox-using.html




4 Mode buttons with LED to choose the way you want to use the groovebox
8 Function buttons with LED to choose which function you want to act to
4 Pots to change the value of the function parameters.

3 sensors : 1 ribbon sensor, 1 pressure sensor, 1 distance sensor.

Here a list of the modes and parameters we can act on :



Mode 1 : Synth parameters
Mode 2 : Arppegiator
Mode 3 : Sampler
Mode 4 : Free play

Mode 1

button 1 : OSC1
-         Pot1 : Volume
-         Pot2 : Waveform
-         Pot3 : Fine 

button 2 : OSC2
-         Pot1 : Volume
-         Pot2 : Waveform
-         Pot3 : Fine 

button 3 : OSC3
-         Pot1 : Volume
-         Pot2 : Waveform
-         Pot3 : Fine 

button 4 : Enveloppe volume
-         Pot1 : A
-         Pot2 : D
-         Pot3 : S
-         Pot4 : R 

button 5 : EnveloppeA
-         Pot1 : A
-         Pot2 : D
-         Pot3 : S
-         Pot4 : R 

button 6 : LFOA
-         Pot1 : speed
-         Pot2 : waveform
-         Pot3 : amplitude

button 7 : filter
-         Pot1 : f
-         Pot2 : q
-         Pot3 : modulation (off, LFOA, EnvA)
-         Modulation power

button 8 : General
-         Pot1 : volume
-         Pot2 : Tempo
-         Pot3 : Mode (monophonique / polyphonique)



Mode 2

button 1 to 8 : notes
-         Pot1 : arpegiator mode (OFF – UP – DOWN – UP/DOWN - random)
-         Pot2 : arpegiator speed (1/4T - 1/4 – 1/2T - 1/2 – 1 – 2)
-         Pot3 : arpeggiator range (-4 à 4)
-         Pot4 : scale (Pentatonic, arabic, major, minor, Dorian)



Mode 3

button 1 : Sampler1
-         Pot1 : sample num
-         Pot2 : sample pitch
-         Pot3 : sample beginning
-         Pot4 : sample ending

button 2 : Sampler2

-         Pot1 : sample num
-         Pot2 : sample pitch
-         Pot3 : sample beginning
-         Pot4 : sample ending

button 3 : Sampler3
-         Pot1 : sample num
-         Pot2 : sample pitch
-         Pot3 : sample beginning
-         Pot4 : sample ending

button 4 : Sampler4


-         Pot1 : sample num
-         Pot2 : sample pitch
-         Pot3 : sample beginning
-         Pot4 : sample ending

Arppegiator


The scales of arppegiator will be simple, as we have only 8 buttons. So no chromatic scale, for example.
I will use the most common.

Here is a table which indicates the notes corresponding to each button, and the value of the MIDI note (beginning by C3)




Penta
Arabe
Majeure
Mineure
Dorienne
button1
C
60
C
60
C
60
C
60
C
60
button2
Eb
63
C#
61
D
62
D
62
D
62
button3
F
65
E
64
E
64
Eb
63
Eb
63
button4
G
67
F
65
F
65
F
65
F
65
button5
Bb
70
G
67
G
67
G
67
G
67
button6
C
72
G#
68
A
69
Ab
68
A
69
button7
Eb
75
Bb
70
B
71
Bb
70
Bb
70
button8
F
77
C
72
C
72
C
72
C
72



Wednesday, 20 March 2013

Build a groove box with Arduino Due, Post1 : Software/Hardware

The goal is to build a groovebox using the last Arduino : Arduino Due.
The processor is a 32 bit ARM3 cadenced at 84 MHz, and it has a Digital-to-analog output.
http://arduino.cc/en/Main/ArduinoBoardDue

It can easily generate sound at 44 kHz. The DAC is 12 bits. It's a little less than nowadays audio products, but it corresponds to 80-90's products like first yamaha or akai samplers. The sound is a little more "compressed", but still used in modern music.

The FatLib library gives Arduino quick access to SD card. It's quick enough to read samples. So the groovebox will have a sampling part, to generate beats from one-shot samples, and a synth part, to generate bass, chords and leads.

I could start this project by inspiring on RCArduino Blog, by Duane B. (a very good blog on arduino), and this particular post :
http://rcarduino.blogspot.com/2012/12/arduino-due-dds-part-1-sinewaves-and.html

Here are some demo of what is possible to do with groovuino. (it's just a proof of concept, not a very musical song) :
http://groovuino.blogspot.fr/2013/05/groovuino-groove-box-demo.html
https://soundcloud.com/gaetino/groovuino

Here are the specs of groovuino groovebox :
http://groovuino.blogspot.com/2013/04/main-functionalities.html

And here some simple examples to start programming with groovuino library :
Mono synth : http://groovuino.blogspot.fr/2013/04/build-groove-box-with-arduino-due-post3.html
Mono sampler : http://groovuino.blogspot.fr/2013/04/lets-code-simple-sampler.html
Polyphonic sampler : http://groovuino.blogspot.fr/2013/06/polyphonic-sampler.html

Software


First of all, let's make a C++ library with main objects like sampler, oscillators, filters,...

I opened a guithub project :
https://github.com/Gaetino/Groovuino

Let's quickly explain the library files :

sampler.h

With this, you can load and play wave files on a SD card plugged on SPI.
(you can have a look here :
http://playground.arduino.cc/Learning/SDMMC
http://arduino-info.wikispaces.com/SD-Cards )

If you include sampler.h, make sure you have previously imported SdFat.h in your main program.
First, I define a structure corresponding to the header of a wave file : "wave_header".

Then I create a sampler class. Through this class, you can load and read a wave file byte by byte.

In your main program, you will have to create a loop called 44000 times per second. I will call it the 44 kHz loop. You can do this by defining a timer. See timer.h file.

Methods :

   - init()
Initialize data. Must be called in setup() function of main program.

   - splay(volume, note)
Sampler play. Start to play the sample previously loaded, with a certain volume and pitch. (note that pitch is not coded yet)

   - load(samplename)
Loads the sample file (must be a .wav file). It can read mono or stereo file (a stereo will be transformed to mono), at 44 kHz and 16 bit. The wave header is read, and all data is loaded in the structure.

   - sstop()
Sample stop. Just stop the reading of the sample.

   - notestop(note)
Stops the sample corresponding to a certain note, and start the decreasing of the sample volume (because of certain samples which do not end on a 0 volume, I had to make a little decreasing enveloppe to the end of the sample reading, to put the volume to 0 without earing a "click").

   - setVol(volume)
Set the volume of the sample.

   - buffill()
Loads the buffer data, with wave data. The buffer value is actually 1024, you can adjust it to what you want. (data "bufsize").
This function must be called at very high rate, in a different loop than the one which is playing the file (a timer, or main loop). There is 2 buffers. One is being played by output() function, and the other must be loaded prevently. If it has not been loaded yet, the function loads this buffer while the other is being played.

   - next()
Prepares the index of the buffer to be read. Must be called just before output() function, in the 44kHz loop.

   - output()
Returns a 12 bit integer corresponding on the sample played. Must be called in the 44 kHz loop.



osc.h

With this, you can define and play an oscillator.
It will be based on reading a wavetable. For now, I just defined some basic wavetables in the memory of Arduino. But later, we will be able to load any wavetable from SD card. It should be a wave file with 600 samples.

You must play the osc in the 44 kHz loop.

Methods :

   - init()
Initialize data. Must be called in setup() function of main program.

   - setNote(note, volume)
Set the note and volume of the oscillator (for example data coming from MIDI NoteOn)
The note is corresponding to normalized MIDI data :

Do0
24
Do1
36
Do2
48
Do3
60
La3 (440 Hz)
69
Do4
72
Do5
84
Do6
96
Do7
108
Do8
120
Sol8
127


If the glide function is activated, the frenquency will be incremented or decremented little by little until reaching the new note.

   - stop()
Indicates that the osc is no more playing (correponds to MIDI NoteOff). Even if it's the enveloppe which stops the sound of the osc (and not the method stop()), it's important to call it, to indicate to other methods that the sound is no more playing. Important for the glide, for example.

    - setVolOsc(osc number, volume)
Set the volume of the chosen oscillator.

    - setWavform(osc number, waveform number)
Set the waveform of the chosen oscillator.
For now, I just put 5 waveforms, but the goal will be to choose waveform files from the SD card.

    - setFine(osc number, fine tune)
Set the fine tuning of the chosen oscillator.
Fine tuning will be between -0.5 to +0.5 pitch

    - setGlideTime(glide time)
Set the glide time in milliseconds. (1 to 1280)

   - next()
Prepares the index of the buffer to be read. Must be called just before output() function, in the 44kHz loop. Increments or decrements the glide if necessary.

   - output()
Returns a 12 bit integer corresponding to the sample of waveform playing. Must be called in the 44 kHz loop.



timer.h


Contains methods to initialize timers.
See here the discussion about timers on Arduino Due :
http://arduino.cc/forum/index.php?topic=130423.0

   - startTimer(Tc, channel, irq, frequency)
Start the timer on a chosen channel and irq, at a defined frequency in Hz.

   - setFrequency(Tc, channel, frequency)
Update the frequency of the timer, the frequency is in Hz.

   - setTimerBPM()
Set the timer frequency, calculating it from general bpm.


env.h


This class defines an ADSR enveloppe. The data out will be a volume which you'll have to multiply to the sound you want to control (oscillator or sample).


   - init()
Initialize data. Must be called in setup() function of main program.

   - start()
Start the enveloppe. Must be called when a MIDI noteOn event, for example.

    - stop()
Stop the enveloppe. The sustain phase is ended, but from the moment you call this method, the release is beginning.

    - amount()
Returns a 19 bit data which is the volume of the current state of enveloppe. This function must be called in the 44 kHz loop.



Program structure


For the first program design, we won't care about effects (filter, chorus, etc...). Let's make simple.
The groove box will first have a 3-osc mono synth and a 3 polyphony sampler.

Here is the schema:




Hardware


Let's make a pannel. This one is not good, but it's enough to test ergonomy :


In this first simple version, we'll just have :
1 InfraRed distance sensor (like D-Beam on Roland grooveboxes) 
4 mode buttons with LED.
4 potentiometers.
1 pressure sensor (to tap beats or notes)
8 step buttons with LED
1 Ribbon sensor

Connections and other stuffs :
1 MIDI IN
1 MIDI OUT
1 Audio OUT
1 USB plug (the groovebox will be powered by USB)
1 SD card reader

I keep for a futur version :
2 NDS touchscreens
4 Matrix LED
1 LCD screen

The pannel was made in plexyglas.


MIDI

You have to use RX and TX connectors of Arduino Due.
Be careful that nothing is sent to Arduino by a MIDI controller when loading the firmware in the Due.
Here are the schematics from MIDI Breakout board nicely published by Sparkfun. I used these to make my own board. (Or you can buy the board to Sparkfun) :

MIDI IN :


MIDI OUT :


See :
https://www.sparkfun.com/datasheets/BreakoutBoards/BOB-09598-MIDI_Breakout-v11.pdf

Digital


Digital IN :

Have to read 12 buttons values :
4 "MODE" buttons
8 "STEP" buttons


Connections are arduino basics. Digital pins are connected like this :
http://arduino.cc/en/Tutorial/DigitalReadSerial

You can connect them to pins 22-30 for exemple.


Digital OUT :

If you have 3.3V LED, you can connect them directly between digital pins and ground. If not, don't forget to add a resistor.

Analog


Analog IN :

Have to read 4 potentiometers, and 3 sensors.

Like digital, connections are arduino classics :
http://arduino.cc/en/Tutorial/AnalogReadSerial


General Schema

I represented only switch 1 and 2, and LED1 and 2, but there is 12 switches and 12 LED (8 step buttons, 4 mode buttons).




To be continued...