Background
Got my interest for electronics tweaking back after a long pause. In the past I have built a tube guitar amplifier, an analog synthesizer and lots of other more or less audio related things but haven't had much time or interest for soldering lately.
After some serious thinking I couldn't come up with anything new so decided to do some improvements to my old analog synth built back in the university days on last decade. As I have been writing embedded software for living for some time now I thought it would be a cool idea to add some digital awesomeness to it.
The synth. Looking very professional. Wood makes it sound more natural! |
Unfortunately the synth is constantly out of tune. I have added tempco resistors to the oscillators but the frequency still drifts a lot.
I also don't like the midi2cv part. I would like to tweak the software but it's ASM code for an obsolete microcontroller (PIC16f628). I don't see any point studying the platform or such a primitive language now that we have cheap 32bit ARM microcontrollers everywhere.
The Improvement Project
To overcome the issues I started planning to build a new midi2cv board. It would allow me to do more than just generate control voltages from the incoming midi events. I could add frequency compensation for the analog oscillators or even implement digital oscillators with polyphony and accurate tuning. Synth purists will hate me but who cares!
Lately I have spent lots of time programming C for ARM cortex M3/M4 processors. I'm also familiar with FreeRTOS operating system. STM32F4Discovery board seemed to provide an excellent platform for my project. It has good development tools available, JTAG debugger/flashing stuff on board, good quality audio output, USB ports and enough computing power for basic DSP tasks. All pins are nicely available so there's no need to solder anything to get things going.
So, STM32F4Discovery + FreeRTOS it is! I prefer developing in Linux so toolchain would be the good old GCC. I'm also a big fan of test driven development so I added CppUTest to the project.
Enter the MIOS!
Somebody once told me that in software development originality is a crime. For most of the stuff there's already a better implemented, properly tested solution available. An open source library, application note, a suitable project just waiting to be ported to your platform or someting similar. In most of the cases writing basic algorithms from scratch is just plain stupid. Just use the library and spend your time on your application!
So, after some googling I found out about the MIDIBox project. It seemed an interesting source of information about all things MIDI. After studying it a bit deeper things got almost frustrating. I figured out that they have their own operating system dedicated for midi related projects. Surprise surprise, it's based on FreeRTOS! Next thing I figured out was that they have also discovered the awesome discovery board! MIOS32 also included note stacks, midi parsing, midi over usb, software update over midi and application code for midi2cv, simple digital synthesizers and what not. So at least 80% of what I was planning to do with the software was actually already done. I was happy because it clearly indicated that my thoughts about platform selection and tools were making sense and I would be able to avoid lots of boring boilerplate work but at the same time I was slightly pissed off because it's nearly impossible nowadays to come up with anything original. There's always somebody who has already done it, most likely then times better and open source. Well, that's just the way it is in the Internet era.
After running the MIOS32 examples on my discovery board and studying the code I was quite impressed. As a software developer I have read lots and lots of code from various sources and this one was one of the easiest code bases to understand and start working with. Nice clean interfaces, plenty of examples, excellent build scripts. I wish all libraries were like this! CppUTest should be also easy to add for the parts I wanted to use TDD. Of course I might be slightly biased here as I'm already familiar with FreeRTOS and stm32 libraries. It definitely made studying MIOS32 easier. But it's good software anyway!
Next steps
Next I need to start putting all these pieces together to form something that makes my ugly wooden box sound more awesome. Time to heat up my soldering iron!
Comments
Post a Comment