I’ve spent a lot of time in the development of the Rockit 8 Bit Synth dealing with aliasing. I made a MATLAB simulation to get to the heart of the issue visually. The script simulates the wavetable synthesis process by generating a sawtooth wavetable and playing back that wavetable to generate a 50% duty cycle square wave output. This output is plotted along with the Fast Fourier Transform (the frequency) of the signal By adjusting some parameters, the amount of aliasing in the signal can be increased or decreased, providing a visual tool for understanding the factors that contribute to aliasing in wavetable synthesis. Click through for a thorough explanation.
I can see the end. The hardware is pretty much locked down. I’ve got to do one final layout revision, but the circuit values and everything are more or less decided. I made an ugly layout mistake in the last revision that coupled a lot of the serial communication into the audio signal as noise. Only a new layout will fix that.
On the software side, I’m wrapping up the oscillators trying to get creative to expand the sonic palette. I’ll be able to continue working on the software until the end though. So, I’m going to be starting the new layout this week and next, ordering the final board and winding this design down. I’m really excited to get to this point, but often wrapping up all the loose ends can be the most challenging part. I really want this to be as perfect as I can get it to be.
I’m figuring out how the final product will be made available. I’m looking at some licensing options because I know what it’s like manufacture something and that’s honestly the least fun part of the process. It’d be nice to license the design to someone else to build and sell so that I can design the next thing. I’ll still support the design and make software improvements, maybe even a second version with some capability expansion, but it’d be nice if someone else handled the business end of it. I’ll do it if I have to and it might be my only option. I’ll fill you in as I know more.
Cheers and happy designing!
I got in the new pcb today and it looks great. I’ll build it up tonight. I have to recommend imagineering, the company that built the pcb. They have an excellent first time offer of $25 a board. They delivered early and I picked them up this afternoon. I am excited! Let’s make some noise!
A while back, I lamented my struggles with aliasing. Well, I resolved them and found inner peace with digital signal processing. Slowly it’s becoming second nature. I’ve got about 90% of the original functions working. The only major omission is MIDI at this point. That shouldn’t be too hard. To celebrate, I made this lo-fi recording using the audio in jack on my laptop. Lock up your dog and check it out. It’s just one key held down so the filter envelope isn’t involved. The filter, both oscillators with only three waveshapes at this point, and both lfos are running. I’m changing the pitch with a knob. It starts out hissy from the input, gets going with a simple sin wave, demonstrates some pitch, moves into other wave shapes and some beating oscillators, then takes off with filter and lfo modulation.
Oh, I feel like a proud parent. I’ve given birth to a square wave roaring lion. I got through troubleshooting the pcb, finding a few traces that weren’t routed and a few connections that were incorrect. I haven’t dug into the details just yet, but the function is there. Fine tuning will follow. This step brings me much much closer to the day when I can offer it to you as a fun new toy or a shiny new weapon in your arsenal. The filter definitely works, which is sweet and probably the most important thing to be sure works. Filters make or break synths. I think you’ll like the way it sounds. Once I get a bit further, I’m going to post some audio samples to give you an idea of what to expect. For now, back to work…
So, I’m deep in embedded software, or as people in the know call it, firmware. A lot of what I’m dealing with is rookie nonsense. Now, I’m probably more of a journeyman coder at this point, but good high quality code doesn’t just spring from good intention and effort. There are a great many rules and tricks of the trade that can only really be learned from someone else. I, being self-taught, have learned much of what I now know by blindly stumbling through the wilderness until through sheer effort, I find the way out of the woods of impenetrable error messages. I’m going to be sharing over the course of many posts, some of the rules and best practices that I discover along my journey. Hopefully, they’ll shorten the duration of your meanderings. Follow the jump for a discussion of the use of the preprocessor directive, #ifndef.
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.