The Youtube algorithm has reduced a lot the initial quality of the video. Keep in mind that the synthesizer sounds a lot better (I mean heavier) IRL.
Brief history and Disclaimer
The main specifications of the synthesizer are :
- 16 voices polyphony
- 61 keys keyboard
- Up to 512 voices simultaneously
- 4 ADSR
- 2 LFOs with 11 different wave forms
- 8 high quality effects (arpeggiator, distortion, phaser, chorus, flanger, equalizer, delay, reverb, compressor)
The Sylence can also be named as a MIDI controller with :
- 97 potentiometers
- 22 sliders
- 46 rotary encoders
- 26 switches
- 130 led
- 4 Arduinos
- An embedded audio interface
- An embedded oscilloscope / Vu meter
- A MIDI Keyboard
This instructable will be original by :
Its style : This instructable will be a part by part overview, not a timeline of exactly how to do it. I let to the reader the freedom of starting the project by whatever step he wants. Or just take the information as he goes along. The instructable will have at some points really dense explanation because of its complexity, also because I can't do it as a step by step recipe (if I did, the instructable would have way too much step). If you want to do it from scratch to the end, I advice you to start by reading the design part (step 2), then the main architecture (step 1) and after each detailed part (3-6).
Its content : It is a big project (personally the biggest I ever made) with a long, long parts listing, and the main consequence is : it will be a pricey DIY project for mostly (if not all) of the readers and it will be complex (but with some thought and perseverance every one can easily understand it) because of the many subsystems involved in it.
I am also convinced, that each detailed part of the instructable will help to understand how the things works inside (and this will help a lot the persons interested in doing a different project with some of the same parts inside). For example, as when something wasn't working with the Arduinos when I was on the Sylence construction, I had a look at some different Arduino projects on the web to clarify things in my head.
A project like this one (+ 1300$ total cost / + 500 hours work) will help you to plan a project from A to Z, to keep focusing on what's done and what has to be done, to face yourself with unpredictable difficulties (entourage, money, mood, time) and to make you learn deeply by experience (conception, welding, electronic, coding).
Anyway, if someone does the project from the beginning to the end please let me know it ! And feel free to ask in the comment if you misunderstood something in this instructable.
For a better understanding of the instructable, I advise you to :
- Have a good knowledge in electronics, algorithmic, physics (Protocol / BUS / electronics law / c language)
- Have some experience and knowledge in 8 bit ATMEL microcontrollers (Arduino type used here)
- Know a bit about the MIDI protocol (here and here)
- Know what a VST and audio plug in is
At the end of the instructable, you should understand the architecture of the Sylence, how works an hybrid synthesizer and be able to do by yourself the major functions of the synth, Note that not all of the technologies of the synthesizer will be reviewed in depth, some parts will be linked to other instructable or tutorials.
Considering that the Sylence is a module emulating an analog synth, reacting from any tweaked knob by an output sound, considering that the front panel is controlling directly the sound via MIDI, and considering that the sound isn't generated by true analog oscillators (see step 1), I will call the Sylence during the instructable : a synthesizer, a MIDI controller, an hybrid synthesizer or a pseudo-synthesizer (all those nicknames are rights referring to their definitions).
Concerning the price of the synthesizer, I find not valuable to enter in detail (each screw, paint, etc) in the assumption that with a project of this scale, there is a lot of unpredictable side expenses. I will just enumerate the price of the main furniture, costing 3/4 of the total price.
I started meditate about this project during July, 2016. At this stage I was searching for an affordable analog synth to brighten up my mixes and audios creations with leads and basses and add some live performance to the jams we were currently doing with my brother. But analog synths was an overpriced solution for a student, and compared to the VST, true analog synths was harder to have.
The process of emulating a synth has been considerably improved in 15 year. An actual VST tend to sound really close compared to a true analog synth. So the idea of a "pseudo-synthesizer" came from the opportunity of having a good quality VST while it wasn't really expensive compared to a true analog synth at equal performance (16 voices polyphony by example).
At the same period, I was discovering the possibilities of an Arduino by this and this instructable, and by my studies while learning the basics of electronics. In 2 years of conception, I added many features as explained in the video.
Each link to photos/files attached will be underlined during this instructable.
Step 1: Main Architecture Overview
Let's stop beating around the bush ! Let's understand the
functioning by sequences
First, to clarify the functioning (or not), see the Sylence Architecture Master schematics. What I will try to explain in this first step is the yellow/orange zone (1). The Sylence Architecture Master schematics is the main schematics involved in the electronics conception of the Sylence. Each numbers in the colored zone are tied to each step in the instructable.
As I said before, the lead idea of the Sylence, is to control a virtual instrument with the MIDI protocol. To make it clear how does it works in the main lines, see below and the sequence diagram (GIF).
Firstly, the user tweaks something on the panel. The Sylence is traducing that in the proper language, the MIDI.
If the thing tweaked is a knob, a Control Change event (CC) will be sent. If it is a note from the keyboard or a switch, a note OFF/ON event will be sent. All of the MIDI event will be finally sent through the USB connection.
The proper MIDI event will be received and computed by the software synthesizer (VST) called Sylenth1. After being computed, the digital audio information coming from the output of the VST will be sent back to the internal audio interface of the Sylence (see gif 1). Finally the audio interface will convert the digital audio information into sound, and the sound will come out from the audio outputs of the Sylence synthesizer.
Main architecture explanation
Thereare only 4 mainstay components inside the Sylence. Those components are the base of the synthesizer functioning principle, where all the USB subsystems are yet connected for a data transmission, yet only connected for powering. All the flow of information is passing through those components (see the architecture schematics 1)
- An USB hub
- A midi keyboard
- A midi Merger
- An audio interface
The USB Hub (see 2)
The USB allows me to embed some crucial components involved in the structure of the synthesizer. It allows me to connect to the computer paired with only 1 USB cable and connect & power all the USB peripherals inside the synthesizer (Audio Interface / Midi Keyboard / Midi merger)(see the architecture schematics 1).
I used a DINIC USB hub for this function.
The Midi Keyboard (see 3)
The MIDI keyboard is a cardinal choice for the design (see next chapter). In electronics terms, the MIDI keyboard have to be USB (for data transmission and power) and a smooth touch when playing it, I mean, not as good as for professional pianist standards, but, I am aware of a total plastic touch, making a crackling noise when pressing each key. And most importantly a low cost model of MIDI keyboard if you don't want to expand to much your final bill. I choose the Nektar Impact GX61.
The Midi Merger (see 4)
The role of the midi merger is to merge. Of course. But the goal of this part in my project is to take all the MIDI signals coming from the 3 Arduino and assemble it into 1. This part avoid a problem when 2 or more Arduino are talking on the same time on their MIDI lines (example: if there is a MIDI clock sent by the Arduino NANO (6 on the Sylence Architecture Master) while a CC event is sent by the Arduino MEGA, the MIDI merger will first send one of the 2 frames, delaying the moment until the second is sent, and send the second only when the first one is sent). The MIDI merger had the only constraint to be 4in / 1out midi merging. I chose the Miditech Midi 4 Merge
To understand better the role of the MIDI merger, see the architecture schematics 1 (AS1) (MIDI merger in green).
I will detail in the next step what is sending and doing those 3 Arduinos (AS1).
The Audio Interface (sound card) (see 5 & Quad Capture opened)
The sound card is traducing the Sylenth1 computing into sound. The audio interface constraint is to have 2 output audio port and 1 MIDI interface in it (the MIDI interface of the sound card is giving all the MIDI information coming from the MIDI merger to the midi gateway see AS1). The sound card have to be the highest quality possible (to keep the lowest latency & the best clarity / expression of the synth). It is the master piece of the synthesizer, any downgrading of the performance wanted initially wasn't allowed for me. I had a Roland Quad Capture in stock (my wardrobe in fact) so I choose that. It perfectly fits what I was searching for (audio quality at the good standards) and, no infringement has been made to my wallet.
To understand well the impact on the sound an audio interface can have, see the oscilloscope test (1). The signal in yellow (the signal of the Roland QuadC) is way cleaner than the one in white (the one of the Behringer UMC204), at same test conditions.
To resume, there are 2 main Arduino (board A / board B) scanning potentiometers / switches / rotary encoders, sending MIDI information when one of the knobs has moved. The MIDI information goes to the midi merger. The MIDI merger is sending the MIDI information to the MIDI IN of the sound card. The sound card is giving that information to the VST (Sylenth1). The VST is giving back the computed audio signals to the sound card. And finally the sound card is traducing that information into sound (all of this is done in less than 5 milliseconds) (GIF 1).
Now, if it is a key played on the MIDI keyboard, the information (MIDI event) goes to the VST, (the MIDI keyboard is connected directly to the USB computer's port) the VST is computing the sound (digitally) and sending it back to the sound card. The sound card is traducing that information into sound (also done in less than 5 milliseconds).
I explained and detailed a lot the way how the Sylence works. Because its principle of work haven't much in common with an average synthesizer on the market (if nothing in common). You can now imagine your DIY synthesizer with this principle of functioning ! Next, see how I managed the design part.
- USB Hub
- MIDI Keyboard
- MIDI Merger
- Audio interface
50€ to 1500€ depending on your needs
Step 2: Design and Serigraph
The mechanical design is maybe where the least work has been achieved so far (compared to other works). Because it is where I don't feel much passion and because I am not a professional/student in design, the way to do the design isn't so much documented. I added each part of the design by intuitions, and didn't do much schematics of the synthesizer design. And I am sorry for that. It is a good point if you want to rebuild the synthesizer with an other design. In this step I will explain firstly how I made the design and why made those choices.
After few hours of careful deliberation between each way to approach the design & mechanics I chose to (timeline) :
- Find an initial design & the way of doing it (broadly speaking)
- Find the right dimension for the layer
- Do the layer I wanted on Photoshop
- Print it at a professional printer
- Buy the material (wood, ironmongery, paint)
- Do the box entirely
Find the initial design & way to do it (main lines)
My first idea, was a design similar to the Moog SubSequent 37. After all, I found the rounded shape on the side too hard to woodwork.
An initial idea (the easiest to construct for me) finally got my attention. A design between the Waldorf Wave, and the Arturia MatrixBrute, a design where the electronic stuff is placed inside an unique front panel (see 1). And where the front panel is removable (see the Youtube video at 0.34)(see 1).
To bring some old school style to it, I got the idea of wood on the side but with easy shape for an easy woodwork for me.
The plan I found to execute for the layer is to :
- Do a large case made of wood considering the size of the MIDI keyboard (see 2)
- Find a good size for the case embedding the electronic stuff (the front panel) (see next chapter)
- Do that other case where is place the electronic stuff also made of wood (see 3)
- Design a layer on Photoshop at a good dimension (1:1)
- Send it to print (on a 1mm PVC)
- Drill the PVC where components are placed (potentiometers, switches)
- Screw it to the box made of wood
Find the right dimension for the layer
The layer is the way of how (and where) you want to put every controls (Cut OFF, Osc Volume, ect..) on the front panel. You can do without it by using the same layer as the front panel of the VST (see Sylenth1 GUI), but my aim was to have a personalized midi controller. The easiest way i found (and least expensive for me) to make my own panel is to create one on Photoshop (Illustrator is a better solution) at the dimension I wanted (here 45cm x 85cm) and sending the file to a low cost printer.
To find the right dimension of the layer, I took the MIDI keyboard for standard and calculated the best size to put every controls (≈150). This was a pain because I started it by hand (this wasn't the best solution). On a 45cm by 85cm wood, I drawn in detail every control I wanted in real size. Upstream, I fixed the exact knobs heads size I wanted for all my potentiometers to fix the size of each components of the layer.
The best way to do it is : starting by knowing each dimensions of each components of the front panel (LCD, switches), then starting directly on a computer (Illustrator/Photoshop) by testing the configuration you want on a 1:1 scale.
Doing the layer wanted on Photoshop & print it at a pro printer
When this was almost finished, I started a Photoshop to copy this exact hand made solid layer and finish it. See Layer : 1st edition, Layer : 2nd edition, Layer : 9th edition (final). Those operations took me 100hours approximately.
To find the appropriate layer for your necessity :
- Find all the components who will be on your layer
- Measure the dimension of EACH components who will be placed on the layer
- Create a layer in Photoshop for each components at good size (1:1)
- If you have X potentiometers, copy the right layer in Photoshop X time
- Place all those components keeping in minds the proportion IRL
The size of the file is really heavy. In terms of total weight, 600Mo, and also because there is almost 700 layer superposed on Photoshop so it is a RAM eater. All those file are available here.
First versions, a not so much professional, yet improvised, the V1 and V2 (Layer : 1st edition, Layer : 2nd edition), because there was no rules in terms of conception, that's where the main lines of the project started to appear.
After 8 version of it, I was a bit satisfied with it so I ordered a print on the website Pixart-Printing, it is the only seller who print on a 1 mm height plastic, and the price is pretty low in EU (<35€).
The result is quite good, PVC is easily drilled, the printer kept the exact proportions. (see 3 Layer when printed photos and knob head)
This is maybe the less expensive way to do a serigraph, the precision is sufficient, the colors are approximately the same, and the material (PVC) is easy to drill, cut or screw. Some printers (laser printing) was way ahead what a student can afford (400€ for the aluminum serigraph).
Construction of each boxes
I constructed those boxes without so much constraints, some screws here and there. I painted in black the boxes (see disassembled view, 3, Boxes 1/2/3/4).
For each part, I followed this guidelines :
- Cut the shape on the wood with good tool (circular saw should do the trick), cut a bit larger than initially
- Place a special glue (wood glue) on only one side
- Place the part of wood you cut before
- Before getting the excess of glue out, put a square and screw it.
- Get rid of the excess of glue
- Get rid of the excess of wood with the appropriate tool (file, saw)
While doing this stuff (the construction of each boxes), I started doing the drill of the layer (see knob ON/ON 2).
To make sure all the led are well fixed, I added some hot glue on each (see knob ON 2). When doing an electronics project with many cables involved in it (or not), hot glue is always a good choice, it is always helping to harden the structure, and it is a good electric insulation, so, to prevent unwanted short circuit.
The easiest way of assembling electronics parts while testing is to wire, solder, connect, program, while all the electronics is placed on the layer, not in the box.
The final task of the assembling is to wire the ground and the 5V to all analog components of the layer. See GND & 5V.
When this task is done (all knobs and components placed on the layer), I start wiring all the things. So, before that, you have to know exactly what wire go were. See you on the next chapters to see more details of each electronics parts.
I developed the design during the developing the electronics. Since this was my first big design to accomplish, I've didn't done much plans and schematics of the design. This step explained what kind of difficulties I faced to make you comfy if you plan to do yours. I am sorry if some of you wanted only a "do this / do that" step, but I find interesting to explain the history of the problem I faced so you can easily avoid when doing yours.
The bill is different with each design. For mine, the bill was nearly 500€.
- Knobs / Knob heads / Sliders / Switches
- Wood and screws
- The layer printed
- Copper wire
- Soldering wire
- Different electronic components (capacitor, led, resistor)
Step 3: Power Supply & Connections
In this step, I will explain you how the synth is powered.
During the prototyping of each part, I managed the supply of the elements on the breadboard with a laboratory power supply. It was really helpful thanks to the current limiter and the live amps consumption on the power supply to see the exact current drawn by the system in real time.
So when I put the components up in the case of the synth during the mounting, it was easy to know which embed power supply I would choose to buy. The total current drawn by the system was up to 0.8A maximum.
On the Sylence Architecture Master schematics, this step will try to clarify the gray zone (3).
Concerning the subsystems :
- All the Arduino are 5 Volt powered (the cleanest 5V possible to keep the Analog/Digital converter away from noise and avoid floating values)
Each Arduino Mega/Nano are drawing a total of 50mA (typical) at 5V.
- All the MCP23017 & CD4051 chipset, potentiometers, sliders, debounce circuits, LCD and led are also 5 Volt powered
The 6 MCP23017 are drawing and powering the led drawing a total of 30mA (typical) at 5V.
The 16 CD4051 are drawing less than 3mA (typical) at 5V.
The potentiometers and sliders are each 10Kohm. There is 119 of them. The total resistance is about 85ohm. The total current drawn is approximately 60mA at 5V. If you don't know much about ohm's law and want to develop the calculations by yourself see here.
The 46 rotary encoders & debounce circuits are drawing less than 5mA(typical) at 5V.
The 20x4 LCD screen is drawing around 200mA (typical) at 5V.
- The oscilloscope is also 5 Volt powered
The oscilloscope is drawing a total of 65mA (typical) at 5V. Experimentally, it draws around 100mA.
- The vu-meter is 12 Volt powered (the cleanest possible because of its link to the sound output)
The vu-meter is drawing a total of 50mA (typical) at 5V. Experimentally, it draws from 10mA to 100mA (maximum) (All led OFF/ all led ON).
- The led for the oscilloscope menus are 3.3 Volt powered
Surprisingly, the most of the current drawn was by those 4 blue led. Experimentally, it draws around 200mA (typical).
To resume, the total typical current drawn by the Sylence is about 655mA (does not include the soundcard / midi merger / MIDI keyboard) .
For the 5V part, I choose the Mean Well RS-15-5 which is a 5V, 3A (to be really safe) switch mode power supply for my main power supply (see SW POWER). I tested it with my oscilloscope and saw that an actual switch mode power supply is really well filtered. I choose to buy to the same brand the 12V power supply I was searching for the audio circuitry, but with less amps to deliver.
Additionally, I have a 5V 2A switch mode power supply for the USB hub, for the USB powered part. To see how the ground are blended together, see the Power supply schem. I differentiate the ground of the mains powerful power supply from the other audio circuitry ground, to avoid any ground loop buzz.
To correctly design or find a power supply :
- Think and calculate the power consumption of each things composing the synth
- Multiply the final value by 2
- Think about each conception problem you have to avoid (ex : if it is an audio project, be aware of switching mode power supply, or look closely of the radiations emitted by it, split the power supply of the power side and the command side in 2 power supply, etc)
In this step, the approximate price is 30€.
Step 4: Arduino, Analog Part
In this step, I will try to explain how is handled the 119 analog value (pot, slider) by only 1 Arduino.
- Firstly we will see how to get rid of the problem of the only 16 free analog pins an an ATmega 2560 (Arduino uc).
- Secondly, we will see what is the best solution to have a viable connection beetween all those components (CD4051, Arduino, potentiometers & sliders)
On the Sylence Architectures Master schematics, this step will try to clarify the green zone (4).
Arduino : How many inputs is too many ? - The analog part
The analog inputs of the Arduino are 10 bits wide (2^10 = 1024, 1024 value are quantified) and the maximum numbers of analog ports (see here the difference between analog and digital/discrete values) on the Arduino family is 16 (Arduino Mega), which is cool but not enough.
The chosen VST (Sylenth1) have in total 245 controls, 72 of them are discrete (ON or OFF). So approximately 173 of them are just analog controls.
I enumerated the exact type of each controls and the number of them wanted in a board : here (in French & English). The number of 119 analog controls appear.
If you want to do the same project with an other VST than Sylenth1, I highy recommend you to do a board to list all of the control you actually want to tweak. This was a big plus when dispatching the controls (of the GUI of the VST) on the hardware pin, to know precisely on which direction your project is going (many controls / only analog controls / only digital controls / led backlight wanted / etc), it is the main specifications of the project.
To have more analog input, I used multiplexers (mux), CD4051, these are inexpensive, easy to use and the schematic of connections is really easy (see Schem MUX Board or Typical connection CD 4051 / Arduino MEGA).
First the proper port is chosen via the A-B-C pin (3 pin, 8 possibilities), then the mux connect internally the OUT pin to the pin pointed (see Schem MUX Board & Typical connection CD 4051 / Arduino MEGA), when done, the Arduino read the value of pots, all of this, done, in 10 microseconds. To read the 120 value (each mux are 8:1, so 15 mux gave me 120 new analog ports), it takes approximately 500 microseconds (see soft development section why).
For a better eplanation of multiplexer (CD4051) see this clear tutorial.
For 119 analog values, I used 15 multiplexer (mux). Each mux are 8:1, so 15 mux gave me 120 new analog ports.
To have a reliable connection between the pots, the multiplexers and the arduino, I have done a proper board for a solid connection (the analog inputs of the arduino are sensitive, if a pot isn't properly connected to the mux, the value will float and the program will be blocked), see after.
In order to do that I made tiny board. See Tiny mux board 1/2/3.
The total cost of 1 board is approx 2$ (counting wire and solder wire)
- First, drill the hole sized for the headers (see Tiny mux board 2)
- Then solder the headers and the muxs on the proto board
- Make sure to note with a color pen were the wires have to go (to avoid being lost)
- Solder each part where the mux board should soldered (following your schematics)
The soldering of those boards was a bit complex because I wanted a tiny board (see Mux board -). But you can do them in whatever dimensions you want.
All the pots are only connected to ground and +5V, see Typical Connection and GND & 5V.
When the board is done, and the pots connected I just glued the board on the layer, wired it to the potentiometers and the Arduinos, see Wiring & Test.
The Software Part
As I said in the introduction, some instructable helped me a lot. As a beginner in software (not a total beginner), starting a program (on the Arduino environment) from scratch was an important task. By luck, I found a really well written instructable for a midi controller & software. So thanks a lot to him for giving to me the main principle of getting an analog value stored and sending it to a serial.
I kept his program in the main lines, but changed it to give to the program the ability to work with multiplexers.
To understand the principle functions, have a look at the diagram and Arduino Pinout Board A.
I attached the program. An explained version (with comments & source/credit) of the C code will be available soon.
By the way, the best way to program correctly your Arduino is to firstly have a fixed hardware (all pin already connected) and not changing configuration every time.
- 1 Arduino Mega clone
- 4 muxes board (CD4051 chips, PCBs,etc)
Step 5: Arduino, Rotary Encoder & Toggle Switch
Potentiometers are good, but to choose between 8 values, it is better to know when you switch between 2 values. Inversely, the knobs have a smooth curve and not a finite number of points. That's why Rotary encoders are here. These are written on the board (see 1 step before) as discrete values (paliers in french)
On the Sylence Architecture Master schematics, this step will try to clarify the violet zone (5).
Arduino : How many inputs is too many ? - Digital part
There are 54 digital pins in total on an Arduino mega. If we take apart the pin for the RX/TX communication, the pin for the I2C bus, and the A-B-C pin for the muxs as presented before, there is a total of 47 free pin on board A and 47 on board B. With 2 Arduino, I have 94 free pin. Why as many ?
Because of the rotary encoders. Those little things take 2 pins each (see ROT Enc), Here is a video explaining the concept, credit goes to How to Mechatronics, follow the channel !
My aim was to control 46 discrete values (as seen in the board in step 4) so it needs 92 pin free. But the encoders are hard to get working properly, without a debounce circuit (to avoid the output value to change alternatively from 0 to 1) see Screen Comparison.
The first screen is showing a very fast toggle switching. The ATmega2560 (Arduino) will traduce it by a really fast increment of the rotary encoder, which is not wanted (by the user).
The second screen is the same chronogram when an hardware debounce circuit is placed between the oscilloscope and the rotary encoder. The white line is the threshold voltage of the ATmega, while this line is reached the uc traduce it by an increment. The moment when the threshold voltage is reached in the right screen is always when the rotary encoder has legitimately moved. That's why we need a debounce circuit for each rotary encoder.
With the PJRC library (see after), all the pins of the MEGA taken by a rotary encoder can be handled without problem, if your program is not computing to much on other tasks.
Debounce circuit Board
Electronically these are really easy (see New Debounce Circuit), but with 46 of them it started to be complicated, maybe too much complicated. I tried to do a board manually, same method as the mux board, but I gave up, there was too much work (see Debounce Board Hand). I decided to do the board via a CAD software (Altium) (as shown on the right and after), and subcontract the schematics to to a specialized company. It cost me 12$. See Schematics and PCB. You can download or change them here.
To handle the 26 switch, I used MCP23017. Those are also handling the led for visual effects, but you'll see that in the next step.
The switches are directly connected to the MCP chip and the activation led (see Switch Config), with an internal pull up.
The state of the switch is read by the Arduino by asking the MCP via the bus I²C. I activated the interrupt on the MCP to gain some time (see the .c attached, at the end there is activation registers). When a switch has changed its state, an interrupt connected to the pin 2 of the MEGA is also changing its state to prevent the Arduino from a state change of the switch.
For this digital step, it was harder due to the lack of MIDI projects handling rotary encoders.
But I found a cool way to manage the rotary encoders thanks to pjrc.
The technique used is totally explained here. The library is also available at that address.
So I took the fragment of code of the initial PJRC code, to modify it, and make it handling more rotary encoders.
When the value are captured, I used the same technique has for the analog part :
- If a value has change, sending it to the serial
- Considering not all the discrete value are on same scale (some have 8 values, some 13), I have a different factor ratio on each rotary encoder algorithms
This is probably the fastest technique, the maximum response time of a rotary encoder movement is <1ms.
But, I m sure my code is not highly optimized. I didn't wanted to reinvent the wheel by rewriting the library etc.
I will try to optimize the code in next weeks.
The encoder handle algorithm is there on the 2 main Arduino because the 46 rotary encoder are dispatched between those 2 different boards (A & B).
To manage the switches, has I said before, I first configure the MCP23017 chip, by writing in the MCP registers (see pdf MCP23017).
And then wait for a state change. When there is one, I read back the MCP register to see which switch moved, and then send it to the serial as a noteOn/noteOff
Too understand, see the diagram & the code attached with the Arduino Pinout Board B. An other version with lot more explanation and comments will arrive soon.
- 1 Arduino Mega clone
- 2 MCP board (MCP chips, PCBs, etc)
- Big debounce board
Step 6: Visual Effects
4 important Visuals
The visuals are the thing that wasn't planned at the beginning of the project. I have done them when I saw that it was possible to. It is a the part of the project where I let my imagination flow.
On the Sylence Architecture Master schematics, this step will try to clarify the blue zone (6).
For the midi clock my aim was to synchronize all the hardware with the software part, like, the DAW with an external sequencer, and why not, a modular synth. This, to use the Sylence also as MIDI swiss knife.
The soft development of the midi clock was a bit hard, I worked hours long to find the perfect timing (set by a rotary encoder and a potentiometer see). This, because I wanted the exact BPM value written on the main LCD screen, and a 0.01 BPM maximum jitter.
To transmit the BPM value, I connected an Arduino Nano to the main Arduino Mega who control the LCD with I2C. On the same bus, I connected a MCP23017 to drive the leds I wanted (see Bpm Clock Schem).
What are doing led in a BPM clock generation ?
I wanted a little pattern indicating the time signature. A little macro as you can see in the gif with 16 rounds.
To do this I took an other MCP, 16 leds. Each led designate 1/8 beat and the one on side design the start of a bar.
See video at 0.43s.
The little macros with the led can be selected as :
The little macro is following the clock generated by the rotary encoder and the potentiometer.
The little macro is following the clock received via the MIDI input (USB or MIDI IN) (see Sylence Achitecture Master for a better understanding)
The choice is selected by the user via a simple switch.
- If the user choose internal clock generation
- The Arduino Nano generate a midi clock (24 tick per step) ordered by a rotary encoder and a potentiometer (see the pic on the left). The signal go to the midi merger.
- When chosen, the value is sent via I2C to the Arduino Mega which write it on the LCD
- Each 3 tick a led is blinking. This, controlled via the MCP23017.
Too see it in action, visit this link.
The program of the clock generator is attached, see ArduinoMidi_MidiClockGen.
Oscilloscope & vu-meter
I implemented a tiny oscilloscope, and a vu-meter to see what consequences have the knob we are tweaking, on the wave form. The oscilloscope is available here.The datasheet of the oscilloscope is attached see OSC_Gabotronics.
Concerning the scope specification, the band size is about 200kHz, this value is respecting the shannon's law since the audio band goes at a maximum of :
- 48 000 / 2 = 24 000
So, 24 kHz is the maximum frequency (less in fact) that can be developed by the audio output of the Sylence. There is almost a factor 10 between those 2 band limit. The Shannon's law is respected.
For the vu-meter, I choose an all-in-one vu-meter (see vu_meter).
The led strip is connected to the last Arduino. On each side of the synth, a led strip is following the movement of each knob. See the video at 4.03. The Arduino Mega is connected to the main MIDI output coming out of the MIDI merger. It analyze the knob value and control 8 led via 8 PWM pins.See also the gif I attached called Led Strip.
The code of the led strip is contained in the master Arduino board, see LCD main screen.
In terms of hardware, the led are driven by 2n2222 transistors. Here is a good explanation of it.
Led back light
A led back light is used on the 4 main oscillators. See video at 0.55. This backlight is controlled by the Arduino Board B. When the encoder is moving, the Arduino is controlling the MCP to write the good value.
To see this in action, see those video and look at the main video at 0.55.See also led visual Gif.
LCD Main screen
A wide LCD screen is also following the movement of each controls. It was also a real pain to program it, because the number of controls is important.
The Arduino is reading the master output of the MIDI merger. Then it find the right information (which control is being tweaked, what's the value sent to the VST) and write it clearly on the screen. I took an Arduino MEGA because of the size of the memory.
See the code attached, named ArduinoMidi_ReadingMIDI_MasterBoard.
- The ocilloscope and vu-meter circuit
- LCD 20*4
- Arduino Mega & NANO
- MCP board for the led pattern
- Transistor board in order to drive the led
Step 7: Conclusion
The Sylence is a pseudo-synth working like a charm and corresponding to the goal that I set when I was searching for a synthesizer. The sound of the synth is really true (I mean the sound respect the physics). I took a screen capture with my scope of the 4 main wave forms generated by the oscillators, see screen capture. The signals are a lot less noisy IRL than on the screen capture. I think the oscilloscope produce the noise while referencing the signals.
Follow my Youtube channel if you want to listen more about the Sylence, I will do some more videos of musical jams and sound test in the future !
I let you with some pictures I took during the conception.