Ambient House Track: Detour #1

I did a new track tonight with my “tabletop” hardware synths going into Ableton Live. I used a LaunchPad to bring in Ableton Live parts and a nanoKontrol2 to control the Ableton Live mixer and effects.

I recorded a live performance of about 8:30 minutes to multiple tracks in Ableton Live which I then edited down to the final 5:43 minutes. Nothing was added in the editing process – I basically just cut out the boring parts, rearranged the drums a bit and fixed the levels in a couple of places.

Detour #01 setup

Gear used on this track:

  • Waldorf Rocket
  • Korg Volca Keys
  • Korg Volca Bass
  • Korg nanoKontrol2
  • Novation LaunchPad Mini
  • mda ePiano (free plugin)
  • TAL-U-No-62 (free plugin)
  • Ableton Live instruments and FX

Test-Driven Development for Arduino on Windows 7

Arduino UnoWhen I first started programming micro-processors in C, I felt like I had stepped into a time machine that took me back to my early teenage years where I spent long nights learning how to write simple programs on the C64.  But alas, after a few nostalgic programming sessions I found myself falling out of love with of procedures, modules and global variables all over again and started looking for ways to apply some of the things I have learned about software development over the last 30 years or so.

Figuring out how to use basic C++ for embedded development helped me leap about ten years ahead in time to my early twenties, where I started learning about object oriented programming in Java. But I still found micro-controller development to be slow, messy and error prone and I missed the rigour and predictability I have achieved in my programming in recent years by applying TDD. jgade

So I started looking for information on how to write unit tests for micro-controller code and quickly came across James W. Greenings book “Test-Driven Development for Embedded C”, which convinced me I was on to something.

Although the book is choke full of good information, it is pretty sketchy on how to set up a development environment for embedded TDD, as is the documentation for CppUTest — the authors C/C++ unit testing framework of choice. And since I have never done much C/C++ development and have no prior experience with GCC, it took me a while to figure out how to set up a decent development environment on my Windows 7 PC.

I set up the environment for the Arduino because I am working on an project for this board at the moment. However, the unit testing tool chain is completely independent from the Arduino tool chain, so it should be a simple matter to adapt this setup to other boards and micro-controllers.

Step 1: Install Sublime Text with Stino

If you already have a good text editor for Arduino development, you can skip this step. However, if you are still using the standard Arduino editor, I strongly recommend that you give Sublime Text a try.

  1. Download Sublime Text 2 and install
  2. If you have not already done so, grab the Arudino software and install that as well
  3. Open Sublime Text
  4. Click the Preferences > Browse Packages… menu to open an explorer window
  5. Browse up one level and then open the Installed Packages folder
  6. Download Package Control.sublime-package and copy it into the Installed Packages folder
  7. Restart Sublime Text
  8. Click the menu Preferences->Package Control
  9. Type package control install and select Package Control: Install Package
  10. Type arduino and select Arduino-like IDE

You should now see an Arduino menu in Sublime Text.

Step 2: Set up the Example Project

Time to get hold of the arduino-tdd-example project and take your new development environment for a spin:

  1. Open the arduino-tdd-example repository on GitHub and download the zip file
  2. Unzip the project under your  Cygwin home folder (mine is c:\cygwin\home\Rasmus in the windows file system)
  3. Open the helloword.ino file in Sublime Text
  4. Click the menu Arduino > Preferences > Select Arduino Application Folder and select the Arduino folder on your system (e.g. c:\program files\arduino)
  5. Click Arduino > Arduino AVR Boards and select the board you are using
  6. Press Ctrl+Alt+V to compile the sketch

Next, try to upload the sketch to your Arduino:

  1. Connect your Arduino board to your PC
  2. Click the menu Arduino > Serial Port and select the Arduino COM port
  3. Click the menu Arduino > Serial Monitor > Baudrate and select 9600 (this is what the example project uses)
  4. Press Ctrl+Alt+M to start the serial monitor
  5. Press Ctrl+Alt+U to upload the sketch to you Arduino

When the sketch has finished uploading, you should see a Hello world! message in the serial monitor.

Step 3: Install Cygwin and CppUTest

It is possible to use CppUTest with a number of tool chains but the simplest solution is probably to use Cygwin.

  1. Start the latest installer from the Cygwin website
  2. On the packages screen, choose to install all devel packages (they are around 500 MB, so the installation might take a while… some mirrors are faster that others though!)
  3. Once the installation is complete, locate and open your Cygwin home directory in Windows Explorer (e.g c:\cygwin\home\Rasmus)
  4. Download the latest release of CppUTest from the GitHub repository (I used version 3.6)
  5. Unpack the CppUTest folder cpputest-x.y to your Cygwin home directory (the x.y suffix is the version number you are using)
  6. Open the Cygwin terminal
  7. Type cd cpputest-x.y to open the CppUtest folder
  8. Type mkdir build_dir; cd build_dir
  9. Type cmake ..
  10. Type make
  11. Finally, type make check to run the CppUTest tests

All tests should pass.

Step 4: Run the Example Unit Tests

  1. In the cygwin prompt, navigate top the arduino-tdd-example project folder (use /cygdrive/c to access the c: drive in the windows file system)
  2. Type make to run build and run CppUTest

And that all there is to it. Now go write some tests for your Arduino projects!

DIY Breakout Boards for Prototyping

I have been prototyping a drum machine on breadboards lately and found it difficult to make some components sit well in the boards, especially potentiometers and jack sockets.

Although I had carefully selected components that would fit in a breadboard, I was experiencing annoying issues with unreliable connections. I even had components falling out of the boards when I was moving them around (I am the proud father of a very curious 2-year old boy and need to store my prototypes on a high shelf when I’m not working on them).

I decided to solve this problem once and for all and spent an evening designing and building a couple of simple breakout boards for my project, using Olivier Gillet’s breadboard friends as inspiration.

Prototyping breakout boards

The breakout boards work just as I had hoped. They sit really tight on top of the breadboards and the connections are 100% reliable.

I also picked up on Olivier’s idea of using jumpers to set default connections – e.g. connecting the sleeve of the jack socket to ground and bridging tip and ring so that only a single wire is needed to incorporate the socket in a circuit in “mono mode”. This approach not only saves time but also reduces the number of wires in my prototype, making it easier to work with.

I really recommend this approach, even for fairly simple prototypes: What worth doing is usually worth doing well – especially in engineering projects.

You could use strip board for your own designs as long as the power rails on your breadboard match “standard” dimensions – this is not the case with all boards. If you enjoy etching your own circuit boards like I do, that’s obviously the way to go – you can grab my Eagle files on GitHub and use them as a starting point for your own designs.

Making a Complete Track in GarageBand for iPhone

I recently traveled from Dubai to Vietnam and got bored with the in-flight entertainment.

So I put my iPhone 5 in flight mode, loaded up GarageBand and did a full-blown 5 minute track in about 4 hours. I uploaded the track straight to my sound cloud from GarageBand without any additional edits, overdubs or mastering.

I was really surprised how complete this track sounds. Being my own worst critic I will be the first to point out that the track is far from perfect, but for a single app on a smartphone I think it’s pretty damn impressive.

Take a listen and tell me what you think!

 

 

 

4 x MIDI Thru Box – A Simple DIY Project

I recently found myself in need of a MIDI thru box for my desktop synth setup and decided to build one from scratch. A MIDI thru box is a pretty simple device and at a total cost 15-20 euros for parts (including a home made circuit board), it’s a great choice if you are looking for a simple DIY electronics project.

Complete schematics, circuit board layout and part list for this build are available under the Creative Commons license on GitHub.

Design

Circuit board designed in Eagle CAD

Circuit board designed in Eagle CAD

A bit of research revealed that most MIDI thru box designs posted online are strikingly similar. So after a brief stop at my local electronics store to pick up some parts, I quickly prototyped the circuit on a breadboard and settled on a design.

Although the Hex Schmitt trigger I use can in fact drive 5 MIDI outputs, I chose to sacrifice one of them for an activity LED. Life is too short to troubleshoot MIDI connections, so this was an easy decision. If you have the need, another Hex Schmitt trigger could easy be added to the circuit for a total of 10 outputs (plus the activity LED).

Next step was documenting the schematic in Eagle. I have been wanting to switch to KiCad for a while but this project was simple enough for the free version of Eagle, so I put off learning a new CAD package once again. With the schematic in place, I moved on to the circuit board layout. I opted for a single-layered design because it’s considerably easier and cheaper to make single-sided circuit boards on your own.

Build

Etching the circuit board is by far the trickiest part of the process if you haven’t done it before. Unless you are willing to spend hundreds of euros on a specialized equipment such as an UV light box and an etching tank, you may find that quite a few failed attempts are needed before you get it right… but it can be done! Personally, I use the “photo resist” method with a regular 15 watt CFL bulb, a photo frame and a couple of plastic containers, all of which I picked up at IKEA for next to nothing. It took me an hour or so to make a near-perfect circuit board for this project, including holes for all the components and a makeshift silkscreen.

Making cheap DIY circuit boards on the kitchen table

Making cheap circuit boards on the kitchen table

After completing the circuit board, populating and soldering the components was a simple matter. I like to build and test individual sections of the circuit in isolation, so I started with the voltage regulator, then moved on to the MIDI input (including activity LED) and finally completed the MIDI outputs one by one – testing each section carefully along the way. It may take a bit longer to do it this way, but it eliminates the frustration of having to sort out multiple issues at the same time, which I often find myself doing if I populate and solder an entire board in one go.

Having built a working circuit, the only reaming task was to build an enclosure to protect it. I like to design pretty acrylic boxes for my DIY projects and have them manufactured by Ponoko, but since this box will be stowed away under my desk I opted for a more basic solution and simply cut two small pieces from a 3 mm plywood board I had lying around – one for the top and one for the bottom of the circuit board.

Finished MIDI thru box

Finished MIDI thru box

If someone would like to contribute an acrylic box design to this project I would be happy to add the drawings to the GitHub repository.

Conclusion

I have used the box for around 20 hours now and have not experienced any issues. There is no noticeable latency when playing notes and MIDI clock is tight.

If you are a green DIY enthusiasts who have put together a few kits and are looking to take it to the next level, this project is a good choice. You could use stripboard but I really recommend that you bite the bullet and learn how to etch your own circuit boards. I find that using “proper” circuit boards helps me avoid mistakes and makes my builds much more enjoyable.

Feel free to post a comment if you have questions or need help.

Hacking a Remote Codec for the Launchpad Mini

42514I decided that I need a better way to select patterns/loops on Reason devices such as Redrum, Matrix and Dr. Octo Rex during live performances.

I know the Livid Ohm64 will do the job and it looks super cool but it’s expensive too. And since I already have a nanoKontrol2 which I’m quite happy with, the Ohm64 seemed like a bit of an overkill.

After a bit of online research I decided on a Novation Launchpad instead and went off to my local music store to get one. I looked at both the full-size “S” model and the “Mini”, both of which I knew to be supported by Reason from my research.

I decided on the Launchpad Mini. I’m OK with the small buttons and I only have so much space on my desktop… plus it’s a bit cheaper than its bigger brother, so what’s not to like?

Well… it turns out that Novation did’t bother implementing their AutoMap software for the Launchpad Mini. And they are not providing any remote codecs for Reason either. So the Launchpad Mini basically just works like a keyboard in Reason… and it’s not even velocity sensitive!

So much for the advertised “Reason support”.

It is  possible to map buttons in Reason to the Launchpad Mini of course, but the buttons on the control surface don’t light up and show the “state” of the software, which was what I expected.

Bummer.

Luckily I applied for access to the Propellerhead Remote SDK a while back and decided to get my hands dirty.

I haven’t actually used the Remote SDK before and it turned out that the most difficult and frustrating part of developing my first remote codec was actually figuring out how to download the SDK! Let’s just say that the Propellerhead developer support could be better…

After I got hold of the SDK things were actually pretty straight forward. It probably took me 7-8 hours to figure everything out and put together the codec. I have absolutely no love for Lua but the Remote API is clean and logical, and the documentation provided in the SDK is pretty good.

I decided to implement most buttons on the Launchpad Mini as simple toggle buttons. Since I plan to map individual Launchpad buttons to different devices in Reason, I decided not to map the buttons to anything by default. I wouldn’t make sense, really.

For the top row of round buttons on the Launchpad Mini (labelled 1-8) I decided to do something special. Rather than acting as toggle buttons, these buttons are mapped to the bar position in Reason: As the song pointer in Reason moves from bar 1 to bar 8, these buttons light up one by one. When the song pointer hits bar 9, the Launchpad “wraps around” and starts from 1 again.

Very cool, if you ask me. I tend to structure the music I make in 8 bar sections and I find that having a visual cue like this during a busy live performance is very useful. This way, I can focus on other aspects of the performance without losing track of the bar count.

The codec can be downloaded from the GitHub. Enjoy!

BleepDrum Build

I finally received my bleep drum kit after about two weeks and sat down to build it last night…

P1011381

I spent a couple of hours on the build which was a more than I anticipated. This was mainly due to the fact that the silkscreen was missing from the PCB, so I had to carefully place components as shown in the online guide diagrams, which was quite cumbersome and I did make a couple of mistakes (god I hate desoldering).

Other than that the build was straight forward and I encountered no major problems. Everything worked the first time I popped in the battery and I didn’t even get to use my newly purchased multimeter.

As for the Bleep Drum, I like the grungy sounds and the overall concept but the sequencer is really difficult to work with. The quantization is off somehow… can’t quite put my finger on the problem. I had a look at the source code but gave up when I still hadn’t located the relevant code after around 15 minutes… working with messy code is no fun and this is a hobby, after all.

The MIDI implementation is very decent though and I had some fun controlling the Bleep Drum with a bunch of step sequencers in Reason.

Conclusion

Although the Bleep Drum is a simple kit and in many ways an interesting little instrument, I was annoyed by the missing silkscreen and I think the bad quantization is a real deal breaker.