FATCAT is based on a project I did and later abandoned back in 2016, inspired by projects like MintySynth and GameBoy trackers. This post is a summary of my experiences from that earlier project. I won't cover all aspects of it or go into huge technical detail. I'm saving that for the logs I'm writing about the current incarnation of the project, since everything worthwile about the old project is carried over to FATCAT.
I wanted to make an instrument that functioned similar to mod tracker software or drum machines, in the form of a self-contained pocket sized device. I also wanted it to be easy to build without needing to use any custom PCB or any SMD components. And I wanted it to fit inside an Altoids tin.
Although I thought of the project as a mod tracker I never had any ambition to build something that could load and play an actual ".mod" file from an SD card or something like that. I simply wanted to make a self-contained synt/sequencer where the music composing interface uses the concepts of tracks and patterns with discrete rows for note data.
At that time I had recently gotten into embedded C programming and the AVR 8-bit MCUs. I felt that the ATtiny84 would be a good fit for the project. That MCU has a small enough PCB footprint while still having just about the right number of pins to drive a single digit 7-segment display and read input from a few buttons.
I wanted to use a onboard piezo speaker for sound output. I've always been attracted by the sound of chiptunes being played back through a piezo speaker. I find that even bad, out of tune music somehow sounds cool when reproduced by a piezo. Possibly it has something to do with the narrow frequency range. (Check out the classic PC game "Xenon 2 Megablast" for some stellar piezo speaker techno.)
Sound playback engine
I had even less experience with audio programming than I had with AVR C. But I did have some code from my previous AVR project where I, with an embarrassing amount of difficulty, had managed to output short 8-bit samples from an ATmega328. I decided to use that code as a starting point for this project.
Taking stock of my current capabilities as a embedded C programmer I realized I couldn't set the bar too high if I wanted a reasonable chance of finishing the project. For the device to have any practical use as a musical instrument I felt that it should at least be able to play a drum track and a base track simultaneously. But I felt reluctant to dip my toe into digital sound mixing at that point. (I have since learned it's not as complicated as I had thought.)
I knew I could output a squarewave and vary its frequency with the hardware timer in CTC mode. That would be my base instrument. And I could use PWM mode for playing drum samples. So I figured that if I kept the drum samples sufficiently short, I could switch on the fly between playing the base in CTC mode and drums in PWM mode. If a drum sample only requires a short initial fraction of each beat, a base note on the same beat could play for the remainder, leaving a human listener none the wiser.
The editor could simply allow the user to enter a drum and a base note on the same beat (or row, to use mod tracker terminology), and leave it to the playback engine to sort out the details.
A quick test confirmed that this method gives a convincing illusion of drums and base playing on their own separate audio channels. It also gives a nice and "punchy" feel to the drums. It effectively creates an extreme ducking compression of the base audio which is an effect used intentionally in lots of professionally recorded music.
Hardware components and GPIO pin economy
Twelve of the pins on the ATtiny84 can be used for GPIO. I didn't want to use the RESET pin for GPIO since I wanted to keep the MCU reprogrammable in circuit. One pin was reserved for sound signal output. The 7-segment display requires eight GPIO pins. Apart from the 7-segment display, the UI design needed an additional LED diode for output, which required another GPIO pin.
That left only two pins for user input. I knew the UI would need at least three buttons to be workable. Left and Right buttons for selecting and Enter for multi-function purposes. The solution was using two diodes, which allows the user to press Left and Right simultaneously through the Enter button.
Circuit Diagram
While writing this retrospective log I've looked through a few different Fritzing sketches I'd made back then. I can't find the exact design I ended up building, but this one is pretty close. Notice how I hadn't put in any resistors for the buttons. They just short the MCU pins straight to ground.
Sound Volume
The original idea was to drive the speaker directly from a MCU pin. I made one hardware prototype using that design but i felt the resulting sound volume was a bit too quiet. I made a second prototype with a 12V supply, using an LM358 op-amp for driving the speaker.
User Interface
The one thing I felt satisfied with accomplishing in this project was the UI. The device was very limited in what it could do in the audio department but I felt that the three button input method and UI output throgh the 7-segment display worked surprisingly well.
Picking up the project again (2018) I've decided to use the same physical UI and expand on the original idea for how the system UI is organized. I won't get into that subject here, but it will be covered in detail in later posts.
End Result
I got all of the components to fit inside the breathmint tin but it looked really clunky with an old cellphone battery for power, and separate charging and boost modules tacked on top of it. Adding a separate power rail for the amplification circuit compromised the original plan of having a design that was easy to build.
I had added an option in the sequencer for programming base slides (portamento) across consecutive rows in a base track. I also realized that by opening and closing the lid of the tin during playback the base resonance would vary accordingly. By combining those two simple effects I could make some pretty sick tecnho beats with this beast.
Final thoughts
I sortof finished the project in the sense that I had a working, usable device with the bare minimum functionality necessary to compose an play a simple chiptune.
Although the design showed promise in some ways, and the prototype was surprisingly fun to play around with given its limitations, I decided to abandon the project after a few weeks of work. I felt that I didn't have the skills necessary (or rather patience to learn new stuff) to take the project much further at that point.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.