Pages

Sunday, August 26, 2012

The Must Build Arduino Project - The Illutron B

Is there a must build Arduino project ? Something simple that can be built in minutes and tinkered with for days or weeks ?

There is now.

Presenting the Illutron B -

The Illutron B is a development of the Illutron synthesizer originally created by Nikolaj Mobius. All of the sound in the clip is being generated by the Arduino with no outside assistance or post processing - the bass notes are extraordinary.

Even more incredibly is that all of the sound is being generated using just one analog output.

How does it work ?

If you think of an analog output as a power switch, the longer it is switched on, the more power we output. By varying the duration that the power is on over time we can output a waveform, for example a sine wave.

The Illutron B is a wave table synthesizer, this is a synthesizer which uses the Direct Digital Synthesis described above to generate sound waves using descriptions 'wave tables' that are stored in the memory.

The wavetables are simply arrays, if you take the values from each of the wave header files and copy them into your favorite spreadsheet you will see the following -

Synth designers know that as listeners we do not find endlessly repeating sine, square or triangle waves very interesting. To make the sound more musical wave table synthesizers combine the waveform with an envelope.

The envelope describes the power or loudness of the waveform over time - think of a snare drum, its starts very powerfully and decays away to nothing very quickly - a flute can start softly, reach a level then decay softly - its the envelope that describes this. The simple trick of combining the wavetable with an envelope is responsible for the huge range of musical possibilities in wavetable synthesis.

How do we do this in software ? - It couldn't be easier, we mulitply the waveform by the envelope, as the envelope value gets smaller, so the output waveform shrinks away to nothing.

Have a look through the code, its extensively documented.

Built in envelopes - the faster the sound drops away, the more percussive (drum like) the envelope -

You can add your own envelopes, or modify the supplies ones, there is no rule that an envelop cannot start quietly and get louder - or look like a heart beat for a pulsing bass sound.

Build your own pocket night club -

How long does it take to build ? anywhere from 5 to 10 minutes, seriously, if you have two potentiometers a few capacitors and resistors you can be playing your own Illutron B in 10 minutes.

What does it do ?

While the synth is very powerful, Nikolaj has included a demonstration tune which is the basis of the clip.

In the clip I am using the Illutron B which provides control over the beats per minute and also the pitch of one of the four channels using just two potentiometers to jam with the demo tune.

This is where RCArduino comes in. When I first heard the Illutron I was blown away, it is far and away the best Arduino Audio project of all. The drum sounds are awesome, the bass is incredible, you will not get tired of exploring those low notes. I know that as a community we can make great things from this.

For this reason I have spent the past few days refactoring, optimizing and documenting the Illutron version B.

Some ideas for your own Illutron projects -

1) Hook up some peizo knock sensors for an electronic drum kit
2) Bass loop generator with push buttons for different bass drops
3) A four channel sequencer
4) Sound effects for games, installations and robots
5) Its a great basis for a Thermin or similar physical instrument.
6) Add some soft pots, cross faders or a stylus to control the pitch of the different channels

Nightclub in your pocket

My own idea is to build on the current example - Ideally I would like to see a set of beats or tunes included in a 'Night club in a box' where the user can select the beat with a push button. The user is then free to jam with the selection in the same manner as the video - Arduino, two potentiometers, one resistor, two capacitors, synched LED Light show and you have an instant pocket night club that everyone can enjoy.

In order to support the further development of Nikolaj's original concept I have refactored the original Illutron code into a more user friendly class library while at the same time taking the opportunity to do some optimizing and improve the readability of the code.

The Illutron B code is being added to the Illutron repository on github I will provide a link once its uploaded, in the meantime, you can get it from me - DuaneB on the Arduino forum.

If your a musician it should be immediately obvious how to setup and trigger the different voices, the sample sequencer is also easy to understand and modify. If like me you are not a musician, build one anyway, the demo tune is great to play with and I hope to get some new tunes included for you to upload.

Whats an Illutron ?

Its actually an art studio on a ship in Copenhagen harbour. The original Illutron synth was created by a member of the Illutron collective Nikolaj Mobius. You can find out more about Illutron and their work in light, sound, electronics and a surprising amount of fire here - http://illutron.dk/posts/54

Building your own Illutron B -

The easy part -
2 * 10 K Potentiometers
4 * LEDs (or eight if you like)
4 * LED Current Limiting Resistors (500 to 1000 Ohms should be fine)

The only slightly less easy part -

Jelly Beans

What are Jelly Beans and why do I need them ?

Jelly Beans are those common components that all circuits need and you should have a jar full of. If your just starting out, you might not have these, but get some, they are very cheap standard components which are widely used in all sort of circuits.

1 * 2.2K resistor (or two 1K resistors in series - anything thats close)
1 * 0.1uF capacitor - you should have hundreds of these, they are used for stopping interference from other components from reaching the sensitive parts of your circuits, if you don't have any, buy 20, they are cheap and you will use them for everything.
1 * 100uf capacitor - again these are widely used. In this case the capacitor is there to filter out a DC voltage so that your Audio equipment only receives the alternating signal part of the Arduino output. If you don't have any of these, get 10.

Here is the Schematic -

Note : The Fritzing software used to draw the circuit labels C2 with 0.1mF, this is the 100uf capacitor, 100uf is the most common way to represent this value but 0.1mf is also correct (1uf = 0.001mf so 100uf = 0.1mf)

Hi, There is only one of me and I am not very musical so its better that I document the code for everyone else to build cool projects from. I will add some explanations and examples in the coming weeks - For myself I would like to build one with a stylophone type interface and a set of controls to manage the sequence and voices.

If you want to code to build your own, PM Me - DuaneB - on the Arduino forum.

Hi- Do i need to build another RCfilter for a second output or oc0b?- What I want to try is select a waveform with a switch with 6 stands and play it whit a midi keyboard and use few pots for modulating the sound. I think it's possible but do I start with a cleen sheet and copy everything or with the demo or i don't know???It sounds really nice for shure in lower region.ThanksWouter

Hi, Yes you will need an additional RC Filter for the second output, the main reason to use the second output is to drive a second speaker. I found that as more channels were added, so they all started to average towards zero, one way around this is to split the channels and drive two separate outputs.

Instead of using a switch, I would suggest you use another pot, it gives you ten positions on a single pin. Have a look at the Arduino Based Nebulophone, they have implemented switching and adjustment on single pots, for example you could select the waveform and the rate of decay by dividing the pot reading into 4 (for the waveform) and within each for you have 255 steps to control the duration.

There are lots of options for how you could control and cross modulate the waveforms, but I am not sure that the Illutron B code is the best starting point for your project, have you had a look at this one which might be closer to what you want - http://rcarduino.blogspot.com/2012/10/five-dollar-synthesiser.html

Wonderful work. I am Sound Design student at Savannah College of Art and Design. My Sound Art professor and I are working on some projects with the Arduinos to hopefully implement into the course work for the undergrads sometime in the future. I'm very impressed with Nikolaj's beginnings and your advancements. I was hoping you still had the zip files available? I will message you on the on the Arduino forums as well.

I was looking at playing with the original illutron synth code for my next project, but after seeing this post I'd like a look at your refactored code. Looking at the illutron github repo, I'm having a hard time seeing how to change things like tempo... Did you ever get it up on github, or should I still be creating an account on the forums to contact you that way?

Hi, You can test something for me, I have put a zip file of the code on google docs. To access the zip file, follow the link below, then look for the file menu at the top of the screen, open the file menu and select the download option. A popup should appear asking if you want to download the zip file. Let me know if it works for you. Link - https://docs.google.com/file/d/0B8WjAvuO3LnIZUNLRkxwWTZKYzQ

Hi, Have you tried on XP ? In an ideal world the OS that the compiler is running on should not make any difference, but in practice its different code streams that are probably maintained by different teams. If you try XP let me know how you get on.

Hi Duane, thanks for your work on this, it's a lot of fun! I've noticed that changing the value for "mod" doesn't seem to have a noticeable effect-- is there something I need to uncomment to make modulation work, or is it just subtle enough that it's difficult to hear?

Hi DuaneI get the following error if verify the script. do you know what is wrong?Joost

Arduino: 1.6.0 (Mac OS X), Board: "Arduino Uno"

In file included from IllutronBDemo0_2.ino:32:0:sin256.h:4:23: error: variable 'SinTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char SinTable[]= ^In file included from IllutronBDemo0_2.ino:33:0:ramp256.h:4:24: error: variable 'RampTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char RampTable[]= ^In file included from IllutronBDemo0_2.ino:34:0:saw256.h:4:23: error: variable 'SawTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char SawTable[]= ^In file included from IllutronBDemo0_2.ino:35:0:square256.h:4:27: error: variable 'SquareTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char SquareTable[]= ^In file included from IllutronBDemo0_2.ino:36:0:noise256.h:4:25: error: variable 'NoiseTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char NoiseTable[]= ^In file included from IllutronBDemo0_2.ino:37:0:tria256.h:4:28: error: variable 'TriangleTable' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char TriangleTable[]= ^In file included from IllutronBDemo0_2.ino:40:0:env0.h:4:19: error: variable 'Env0' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Env0[]= ^env0.h:264:19: error: variable 'Inv0' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Inv0[]= ^In file included from IllutronBDemo0_2.ino:41:0:env1.h:4:19: error: variable 'Env1' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Env1[]= ^env1.h:264:19: error: variable 'Inv1' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Inv1[]= ^In file included from IllutronBDemo0_2.ino:42:0:env2.h:4:19: error: variable 'Env2' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Env2[]= ^env2.h:264:19: error: variable 'Inv2' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Inv2[]= ^In file included from IllutronBDemo0_2.ino:43:0:env3.h:4:19: error: variable 'Env3' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Env3[]= ^env3.h:264:19: error: variable 'Inv3' must be const in order to be put into read-only section by means of '__attribute__((progmem))' PROGMEM char Inv3[]= ^Error compiling.

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.

I built the IllutronB, there is a beat running, though my pots A0 and A1 have no influence on the circuit?. Is it also absolutely necessary to have an op amp with this circuit. or can my jack go right to a small speaker?. Thanks!

I also wrote a small test sketch to see if my pots are working and they are. All seems to be in place and functioning, though the pots still have no effect on varying the sound. Please help. Anyone.. Thank you.

The LM386 is not an op-amp but a basic audio amplifier. Its a cheap and simple way to generate enough power to drive a standalone speaker while protecting your Arduino. More here - http://rcarduino.blogspot.ae/2012/08/adding-audio-to-arduino-projects.html

Alternatively you can use the simple output circuit to drive a speaker through any existing audio amp that you have.

As for your pots, are you running the code from the downloads page of this blog, if not, your pots are not going to do anything

Hello, I would really appreciate some help!How difficult it is to make this WONDERFUL synth+sequencer work in Arduino Mega? I have 0 knowledge of programming the registries of the Arduino. Is there like a table or guideline with the different names so that I could change the library? Is that possible at all?Thanks a lot in advance!