Admiral - DIY synth module with Fluxamasynth or VS1053b

Started by Guitarpolson-fgn, March 13, 2013, 04:09:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Guitarpolson-fgn

My goal is to tweak a GM module into a very nice expansion module  for the GR and VG  line of products of Roland, the AXON range, the new fishman Tripleplay and Jam Origins Midi Guitar.
The hardware is going to feature a standard "midi in"  and tweaked GM performance.
We'll build in all kinds of guitartypical stuff: string splits, fretsplits, multi legato,mapped drums and more..
Dont expect the latest highend synth sounds from a VS1053b, what you can expect is flawless performance, a steady palet of sounds, and unbothered creativity in the appliance of them..
The Fluxamasynth has more "realistic" instrument set, with mapped drums and more, slightly more expensive.

There actually never has been a synth expansionmodule special for guitarsynth..

The module will feature 16 instruments sounding simultaneously (as opposed to 2 in the GR series, and 0 in the VG99)

CPU:
-Arduino Leonardo
http://www.watterott.com/de/Arduino-Leonardo-headers

Soundboard: (only 1 needed ofcourse)
-Musicshield (seeed studio) with VS1053b
-Fluxamasynth

9 March 2013, 11:41
Hurray! The fluxama synth arrived, after 4 weeks of swimming it finally found his way to my home.
Ofcourse the original library didnt work, but it took me 20 minutes to get it going anyway.
The fluxama has real filters build in, so it'll be great fun to map these to CC18 for GR30!
I've adapted my goal: I will implement the "single stomp, play note, theres your programchange" setup first.


1 March 2013, 11:41
..been waiting for my Fluxamasynth for weeks, nothing arrived yet, guess its still on the boat..
In the meantime I've programmed the kernel for my own hex guitar to midi converter. It will use Admiral Midi as direkt sound engine. It is still uncertain on when microcontroller the pitch to midi will take place, I've got an alternative board with STM32F103 that runs on 72Mhz, if my atmega32u4 wont perform good enough.

7 Februari 2013, 11:41
..too little time to get things done, but: I've got a marvellous idea now ho to support stringsplits on the fly.
-you play a note on string 3 on lets say position 5
-you can twist a knob and the sound changes
-now the 3rd string sound, sounds new from 5 onward.
-If you play more strings at once, all these strings can be assigned a new sound
Still have to decide to make unlimited splits, max splits per string, of just 1 split. Think I'll start of with 1 split..

3 Februari 2013, 14:15
..have started to program the statemachine, to capture incoming midi events and modify them before sending them to the soundboard.


2 Februari 2013, 18:40
I have made up a "non interface mode" for attaching to the GR55 & VG99 goes like this:
S1 pressed: volumepedal change selects sound of soundingnote.  (I know this a bit tricky but hey, its a start)
S2 pressed: volumepedal change select pitch of soundingnote
these settings are immediatele stored in the current program space (EEPROM), so it automatically syncs to the VG/GR
The midicc send by S1,S2 and volumepedal are set globally, so it gonna be really easy to configure.
GK volume can be used for synthvolume if needed.

2 Februari 2013, 14:00
yesterday I have tried to get USBmidi over SPI with teensy library on Leonardo. wont work. I used ISP programmer)
I tend to find teensy highly unsympathetic: they build on arduino opensource and force you to buy their boards.
Arduino doenst force you to buy their boards, there are lots of fine clones out there!
I will wait till Arduino has usbmidi support himself, or I'll switch to the great  LUFA library if I'm really in need.
but I wont support these teensy brothers, because they just want to make money over other peoples back imho.
Anyone reading this who has other opinion, please react, show me I'm wrong! I dont mind!


30 januari 2013
Peter ploveday has pointed me to an alternative soundshield, the fluxamasynth. I've ordered that one too. Tanks for the tip, Peter!
That'll give more flexibility in the design.
I'm currently looking for USBMidi support, alas Arduino doesnt offer it, I'll just have to use the teensy librarie and a programmer.
USBmidi support as paticulary handy in 2 situations:
1) Fishman Tripleplay or jam Origin's Midi guitar: midi routed through USBMidi is tiny bit faster. It will never meet the 31250 bit restraint, going though USBmidi and Arduino's SPI. The Fluxamasynth uses parallel interface which should be just as fast.
2) Guitarsynth connected to midi input: then the USB midi can be used for the editor and as midi input for you DAW.

In both setups having 1 or 2 pedal and a volumepedal input would seem to be desirable, that way the box stays small and light, which in case of a laptop setup is positive, but when needed floorpedals can be mounted. Further soundcontrol will be done via the computereditor. Programchanges then should come via the guitarsynth or via the computer.
So if you just use a computer in a live setup, a programchanger floorboard comes in handy, but this too is extra. it shoudnt burden the design now.  the main concern is to provide the right connectability.

I'll make the port setup such, that the shields are easily exchangeable. The pedal and volumepedal inputs need dedicated portpins therefore, that fit both configurations, to prevent useless soldering back and forth..

I'm thinking of building the test editor in CSound. Convenient for prototyping.

27 Januar 2013: First recording of the "bare skeleton" performance of Arduino/Music Shield/gr-30
All demos of all new hardware have to be out of tune, I swear this has to be true! ")
Nevertheless! Hear this fast chip, hooked up to my gr-30.
I press the gk button every now and then to increase the outgoing midi preset nr. on all string.. The GR-55 hasn't got midi presets per string. So with a gr-30 this bare bones system is allready worth the buy!
I'm quite astounded with how many nice lead tones this chips offers, I wouldnt' call it "GM" though.. it's just a nice fast little synth, thats hackable and tweakable, and that's what I hoped for 1 week ago..
Particularly nice is the smooth bending, and nice velocity sensitivity. And I havent even start to tweak yet!




januari 27th:
Great! I've hooked up the midi out of my gr-30 to Admiral Midi. It is surely fast enough! Didnt do a A-B comparions, but it feels just as fast as the onboard soundmodule. So! Bingo! tonight I'm gonna play a demo.
the funny is, that the vs1053b sounds so antique and kind of warm, I guess it's not exactly 44100 khz that its rendering, but it feels, dont know how to say it.. It sounds inspiring. There isnt one sound on it that closely remembles a real instrument, so it feels like a synth, an old one.
So, tonight.. then I'll make a demo out of it.
The fun thing is: I just just the presets that I can select with the gr30: so I can select different sounds and transpositions for each string! Just as an expansions for the gr-30 it is allready worth the money, for the sound characters has a 180 degrees differnet focus as the GR30 internal engine.
Green light! and I'm just working on it for 1 week exactly! So this is a project, that has started with real fast results :)
Januari 26th:
It works! My first SPI connection.. What I did yesterday was fully correct, I just needed to give a hard reset on the Music Shield via XRESET, everything works fine. Board sounds like a 80's scienfiction movie! Nice, oldschool touch!
I'll try make it usb-midi via the Teensy library, that way I can test it at ease.
I'll just hook it up on a guitarsynth, then we will know instantly if the latency is low enough.

januari 25th:
12:09:
have learned about SPI programming with the arduino SPI library and stuff, is very interesting.
Have decided to write everything from scratch, the Music Shield's example code is using SPI, but when booting in Reatlime Midi mode the protocol actually is: SDI! SPI features write(adres,value) whereas SDI is just write(value)..
So that means it is simpler in fact, and I want to make clean code, that's why I'm using  Arduino's standard library here.
So, it is quite a job getting it together, but when ready it'll work on any Arduino.
15:08
Asked a bit of more info on vsdsp forum for getting rt midi working over SDI, my topic is approved and I'm quite sure they'll help, I've read the other topics, they are really helpfull people over there at VSLI.

Januari 24th:
Bummer! The VS1053b's RX port is directly connected to +3.3V on the the seeed studio music shield! Grrr!
Now I have to use the SDI interface, thats more complicated.. but it is surely faster. So that should compensate for the extra work i'll have now..
And: It will make it easy tot facilitate "midi out", since I cant use the Arduino's  UART for communicating with the Music Shield, I can use it to connect to an external synth. Every disadvantage has it's advantage! ')
It'll make Admiral Midi stronger if it can be connected to external GM modules, in fact it should be possible to just plug in on any GM keyboard, since the instrument mappings are standard!

12:40: I've dug up the SDI interfacing part of the seedstudio example code. looks wel.
So I'll use it. This code supports about any Arduino I guess.
transmission speed seems CPU/16, it would mean 1.0 Mhz.. now that sounds ok, it'll speed up every midinote about 1 ms.

13:40: Have discovered only 1 cpp + h file needed to get it a running. Complied without errors. Program will play all notes on channel 1 for 1/10 of a second, then start again.
Now I need to prepare the musicshield for RT midi. GPIO1 should be "tied high". Now I've been long enough in this hobby to know, that I first should check what "high" means here. The local high for vs1053b is 3v3, not Arduino's 5 v.. So locate proper 3v3 source.. found, its a regulator ofcourse with a buffer C, thats where I'll get my "high"..
Patience is the most undervalued issue in developing, I try now to be as slow as possible, it will allow me to develop this faster & better!


15:53 I've got everything hooked up, but I get no sound, leds blink, all seems fine..
It is probably a tiny communication error, I've asked seeedstudio for some advice, we'll see.
I have to wait for some feedback there, I'll feed the birds and do some snowshoving in the meantime..

17:58 Found this information in specs of VS1053b
"After that the data to the Audio FIFO, which holds the data until it is read by the Audio interrupt and fed to the samplerate converter and DACs. The size of the audio FIFO is 2048 stereo (2×16-bit) samples, or 8 KiB"
FIFO buffer with 2048 samples..
Now that doesnt mean the latency is 2048/44100 = 46mSecs.
But it could.
And that would destroy the chips realtime performance.
But it wont destroy the project!
There are other chips, e.g. this one:
http://www.dream.fr/pdf/Serie2000/SAM_Datasheets/SAM2195.pdf

Januari 23:
Midi implementation specs:
meta: 0x51 : set tempo
other meta: MidiMeta() called (user code can send out lyrics and other meta information)
SysEx device control: 0x01 : master volume (only in file mode!)
channel message: 0x80 note off, 0x90 note on, 0xc0 program, 0xe0 pitch wheel
channel message 0xb0: parameter
0x00: bank select (0 is default, 0x78 and 0x7f is drums, 0x79 melodic)
0x06: RPN MSB: 0 = bend range, 2 = coarse tune
0x07: channel volume
0x0a: pan control
0x0b: expression (changes volume)
0x0c: effect control 1 (sets global reverb decay)
0x26: RPN LSB: 0 = bend range
0x40: hold1
0x42: sustenuto
0x5b effects level (channel reverb level)
0x62,0x63,0x64,0x65: NRPN and RPN selects
0x78: all sound off
0x79: reset all controllers
0x7b, 0x7c, 0x7d: all notes off



Januar 22th:
  postal delivery of Arduino Leonardo and Music shield. Lovely little boards :)
  "To get the VS1053 into RT MIDI mode, power up the VS1053 with GPIO0 tied low, GPIO1 tied high."
  I've located GPIO0 & GPIO1, they are marked and bound to ground with 100k R.. bravo! easy to configure!
  The vs1053b board needs ground,+5V, and midi serial input. that's all.
  Therefore I will not even use the shield as a shield, I'll put 3 wires in between them.
  This also means that there is large freedom for the microcontrller and vs1053 board used.
  But we'll support only arduino based controllers here however, to unify the code.
  Unifying the code will help exchangeablility between developers, and since there is no reason to not use Arduino, we'll use it,     since it is the easiest to work with.
  Note that there are derivates of Arduino with faster processors, so in need of power one can allways switch to one of them,   without changing the code considerably . Eg: picduino,maple)

Januar 21th:
  I've come up with a nice project name: Admiral Midi

Januar 20th:
  Ordered the boards. 50 euro.




 

Guitarpolson-fgn

#1
Here is the bare code for the VS1053b, with instructions for musicshield from Seedstudio...
You can use this as is, to connect it to a GR-30. it will just connect the soundchip to the midi stream, use "presets" on the GR-30 to give each string its own sound!

/*
==================================================
Arduino + Music Shield 1 ( seeedstudio ) via SPI
==================================================
created 26 januari 2013
by Paul Driessen
[url=http://www.pauldriessen.nl]www.pauldriessen.nl[/url]
==================================================

This code works with Arduino Leonardo + Music Shield from Seeedstudio
I can't gurantee anything, but it should work with any Arduino I guess..

http://www.seeedstudio.com/depot/music-shield-p-642.html?cPath=132_134

!!!!!!ATTENTION PLEASE !!!!! VERY IMPORTANT !!!!!
To boot the Music Shield into realtime midi mode the GPIO1 has to be connected to 3v3!!
I located C20 on the board, this is the source of 3v3 on the board
and connected a thin wire from the + of this one to the GPIO, the hole named "1" is GPIO1
**Please ask someone good in soldering to do this if uncertain yourself!!**
 
Once GPIO1 is properly pulled up, this code will work.
 
*/


// inslude the SPI library:
#include <SPI.h>


// Music Shields XDCS is to be taken LOW on every transfer, and is connected to Arduino's A2.
// that is the "chips select pin" that is extra needed for getting SPI communication going
// the SDI communication mentioned by VLSI in their VS1053b documentation is a subset of SPI
// It just means that that is no command layer, just data: Serial Data Interface
const int XDCS = A2;

// where gonna get feedback over the DREQ line, connected to A1
const int DREQ = A1;

// where gonna give a hard reset ourselves, to be sure to have a nice booted chip..
const int XRESET = A0;

void setup() {
 
  Serial1.begin(31250); // our midi connection
 
  digitalWrite(XDCS, HIGH);   //trick!!
  pinMode (XRESET, OUTPUT);   // XRESET  = LOW active
 
  // set the slaveSelectPin as an output:
  digitalWrite(XDCS, HIGH); //trick!!
  pinMode (XDCS, OUTPUT);   //this order prevents XDCS becomgin LOW! is LOW active!

  pinMode (DREQ, INPUT);

  // initialize SPI:
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);   
  SPI.setDataMode(SPI_MODE0) ;          //capture on first risign edge
  SPI.setClockDivider(SPI_CLOCK_DIV16); //1 mhzfunction, mycrystal=16mhz
 
  //Serial.println("Reset & waiting for VS1053b to wake up..");
  digitalWrite(XRESET, LOW);    // push reset button
  delay(100);                   // keep depressed for 100ms
  digitalWrite(XRESET, HIGH);   // and release..
  //Serial.println("Wakie Wakie!!"); 
  while(digitalRead(DREQ)==LOW) 
  { 
                                //wait for chip to wake up, DREQ becomes high after 22000 of his clockcycles..
                                //so xtal scan could be implemented here, not needed here because crystal is known
  };
  //Serial.println("Yohooo! The VS1053b has woken up!");
   SendResetCC(1);   //reset all controllers on channel 1
  SendProgram(1,1); //prest select..
  SendCC(1,7,127); // channelvolume up..
  SendCC(1,0x5b,127); // fulle fx send
  SendCC(1,0x0c,0); // fulle fx master
  //for(int p=1;p<=127;p++)
  //{
      SendProgram(1,1); //prest select..
      for(int n=32;n<=64;n++)
      {
         SendNoteOn(1,n,127);
         digitalWrite(13, LOW);
         delay(50);   
         digitalWrite(13, HIGH);
         SendNoteOn(1,n,0);  //note off..
         delay(25); 
       };   
  //};

}

void loop() {
  //testProgram: Build your own interface/music here!
  //Have fun! Be creative!
  //greetings,
  //Paul Driessen

  //*/
  //
  // Passthrough Midi from serial port, minimal usage pattern, may fit some GR30 owners,
  // becasue they can send preset nr's per channel! But they's only have 6 out of the 16 possible channels...
  if (Serial1.available() > 0)
  {       
        SPIByte(Serial1.read());
  }

}

void SendResetCC(unsigned char channel)
{
  SPIByte(0xB0 + channel ); //channel 0;
  SPIByte(0x79 ); //reset controller;



void SendProgram(unsigned char channel, unsigned char preset)
{
  SPIByte(0xC0 + channel ); //channel 0;
  SPIByte(preset ); //controller;

void SendPreset(unsigned char channel, unsigned char preset)
{
  SPIByte(0xB0 + channel ); //channel 0;
  SPIByte(0); //controller;
  SPIByte(preset ); //

void SendCC(unsigned char channel, unsigned char cc,unsigned char value)
{
  SPIByte(0xB0 + channel ); //channel 0;
  SPIByte(cc ); //controller;
  SPIByte(value); //velo;

void SendNoteOn(byte channel, byte note,byte velocity )
{
  SPIByte(0x90 + channel ); //channel 0;
  SPIByte(note ); //note;
  SPIByte(velocity ); //velo;

}
void SendNoteOff(byte channel, byte note,byte velocity )
{
  SPIByte(0x80 + channel ); //channel 0;
  SPIByte(note ); //note;
  SPIByte(velocity ); //velo;

}

void SPIByte(unsigned char val)
{
  while(digitalRead(DREQ)==LOW)
  {
     //wait for room in the buffer
  } 
  digitalWrite(XDCS,LOW); //start transmission
    SPI.transfer(0 );     //MSB
    SPI.transfer(val );   //LSB;
  digitalWrite(XDCS,HIGH);//end transmission