I’ve spent a fair amount of time detailing the hardware that Rockit uses for it’s Voltage-Controlled Amplifier. It’s a transconductance amplifier-based design and you can read about it here. I haven’t, however, discussed the software behind implementing the envelope generator. It ends up being more useful than just controlling amplitude. The same envelope generator code works for the filter envelope too. I didn’t end up using exactly the same code, but it could be made entirely modular, taking some basic inputs like timing and parameter data and returning an appropriate value for an envelope. Let’s just focus on how to code an ADSR envelope for now. If you’d like to get the source code for Rockit, please download it from Rockit’s Sourceforge Page.
I am so excited to announce that I am almost done. The hardware has been finalized. The circuit and all the values are a wrap. Everything is working: MIDI, filters, synthesis, LFOs, envelopes, Voltage-Controlled Amplifier, LEDs, buttons, patch save and recall… I’ve got the first pass of the pcb finished as shown in the silkscreen image above. I’ve gotten to the final knob locations and am pretty happy with that. It’s been a journey but the final design should be on sale within the next couple months. I’m looking at options for selling it from licensing it to doing it myself. I might put up a project on Kickstarter. Stay tuned on that front.
Things I still have to get done are mostly software tasks: finalize pitch bend implementation, test filter audio in, flush out and finalize synthesis waveshapes, finish lfo waveshapes, and a few other small things. Sometime soon after I check every connection on the pcb and optimize the layout, I’ll order some sample pcbs and build one up. In the meantime, I’ll be finishing the software. I’ve got some ideas for making more complex waveshapes, morphing sounds and such. At that point it’ll be done. I’ll have to do some documentation, but I’ve been doing a lot of that through this blog. So, expect the release soon. I can’t wait.
When I started the Rockit 8 Bit Synth design, I thought that I could implement a voltage-controlled amplifier, VCA, in 8 Bit land, saving precious hardware and everything would be easy. Well, as with many of the other things that I learned in the process of developing this project, reality would not be so kind. In this post, I’ll explain why that doesn’t work and then fill you in on how you can implement a functional Voltage-Controlled Amplifier using some fairly simple hardware.
I’ve been working like mad on this synth. It might seem like waiting forever, but I promise I’m working as hard as possible to get this thing done. So, what’s the status now you ask?
I’ve got all the i/o expanders configured and working with all the buttons. That means all the control circuitry is working. Now, I’ve got to interface that with a lot of code that I’ve already written that gets the thing making noise. I’ve already got the oscillators running and the filter was working before. I added some circuitry to generate the different filter types and need to test that. The filter circuit and a bit of troubleshooting are what’s between me and this thing cranking some noise. Once it starts making noise, I can work on tuning how it sounds and the way it works.
I’ve got a list of about 25 things so far that I need to fix with the pcb. By the time I troubleshoot the filter, I’ll probably have 50 things to fix with the pcb. I’m going to change i/o expanders from the 8 bit version to the 16 bit version to save some parts and cost. It might also shrink the board a little, which would further save cost. I’ve made a number of errors of omission on the board as well that need to fixed. For some reason, Eagle didn’t show me all the connections and still doesn’t even after I’ve corrected the schematic.
So, I’ve got miles to go before I sleep, but I promise you: one day, I’ll be done and it will be certifiably awesome!
In Part One about the MCP23S08, I discussed how to set up one of these i/o expanders as a bank of outputs to drive LEDs. They can also be used as digital inputs. They don’t do any good as analog inputs for things like pots. You can use analog multiplexers for that. As digital input expanders though, they make an excellent way to expand your systems switch capabilities. I am using them for banks of tactile switches to step through options to control my synthesizer. Follow the jump to see how I configure them…
Twice now, I’ve been burned. I’m using the GNU C Compiler with the AVR ATMEGA164PA for my current project, the 8 Bit Synth. I need to use external interrupts to determine when a switch has been pressed. When it has, the i/o expander drops its interrupt pin from high to low. So, I set up the external interrupt routine to be falling edge-triggered. I had to figure out how to get the i/o expander to trigger its pin when a button was pressed. I knew that the i/o expander’s output interrupt pin was changing when I pressed a button. I also knew that the microcontroller’s interrupt service routine was being triggered because I made a pin toggle when the routine ran. I set a flag high in the service routine. I configured an if statement in the main routine checking for the flag. If the flag is set, I need to read the i/o expander’s interrupt latch register to determine which switch was pressed. The microcontroller never sends the read command. Not ever, ever. I couldn’t figure out why. Do you know? Follow the jump for the answer to this riddle…
There you have it! I told you the I/O Expanders were working. The machine has started to watch me back. All these LEDs won’t be on at the same time in the final design, but it’s fun to turn them all on to make a flashlight. I’ll probably turn the brightness back down to 7 before I’m done. This brightness is with only 8.5mA coursing through their die. I’m used to the el-cheapo LEDs that can go from 15 to 100mA with no change in brightness. Once those charge wells are full, that’s all you get. Anyways, it doesn’t have to be blue. Maybe there will be an option for customization with different colors. Blue just looks sweet!
So you’ve got 100 LEDs, 72 Buttons, and a microcontroller with 18 I/O pins? You could try multiplexing the LED. Use 8 pins for the cathodes of LEDs and drive groups of 8 LEDs with transistors to turn them on groups at a time. That’s the cheapest thing you could do, but the more LEDs the more complicated it gets and the more pins you still need. You could do 96 LEDs with 20 pins, 8 for cathodes and 12 for multiplexing transistors. You’d have to sink all that current and switch everything fast enough to maintain persistence of vision (about 30Hz). There must be a better way.
And there certainly is. There are shift registers, which are a great way to go especially if you’re doing simple input and output. They have to be polled regularly, but you can send them information serially which they put out in parallel, using only a few microcontroller pins. What I’ve landed upon recently are I/O Expanders from Microchip, particularly the MCP23S08. Follow the jump to learn about them and how to use them.