Commit 48cb2698 authored by Erik Strand's avatar Erik Strand

Improve final project description

parent 719076af
......@@ -140,16 +140,30 @@ My go-to algorithm for most audio processing tasks is the [DFT](https://en.wikip
So my plan is to perform a constant-Q transform, then perform a least squares optimization to determine which note is most likely to generate the observed overtone distribution (assuming each note generates a harmonic series with roughly exponential decay). Ideally I'd be able to incorporate past states into the model, so I'd really want to compute the probability that a given note is playing conditioned on the observed frequency distribution and prior states.
This sort of algorithm sounds like fun, but it's also not the sort of thing I'm in this class to learn. I already have enough experience with software. For this reason, and to avoid having possibly having to duplicate circuits five times (one for each string) as I'm learning the basics, I decided to pivot once again.
### Audio & MIDI I/O
The main questions for audio are how to provide gain, and how to orchestrate regular sampling. The XMEGA 128A4U has an internal gain stage, but I'd like to use my own analog circuitry instead so that I can vary the gain continuously. I developed the necessary circuit during [inputs week](../09_input_devices). During that same week I sampled audio in the laziest way: poll the result register, and manually start another conversion when it's finished. This won't work when we're doing a lot of additional computation. So I dove into the datasheet and set up a timer to provide regular interrupts. [This code](https://gitlab.cba.mit.edu/erik/xmega_audio/blob/master/xmega_test/main.c) demonstrates this system, by blinking an LED.
I experimented with MIDI output during [outputs week](../10_output_devices). MIDI is a form of serial communication, so at the time I used an existing board and Neil's bit-banging serial implementation. On the XMEGA I can use the USART peripheral. Alternatively, I can send MIDI over USB, as I did during [wildcard week](../14_wildcard). However by that time I had already come to the following conclusion...
### Reality Check
There are a few weeks left, and though I've made good progress, I'm doubtful I can complete all that I set out to do. I have an analog gain stage, and a sampling system using the XMEGA's timer, interrupts, and ADC, but still need to make the pickup and design the board. Since a lot of this material is new to me, I imagine it will take me a few revisions to get it right. So I definitely don't want to aim for processing each string separately at this point -- that's probably too many spirals away. So, one obvious option is to process all the strings together, and accept that it will only work if one note is played at a time. But there's another idea...
## Idea 3: DIY USB Audio Recording Interface
Instead of turning the audio into MIDI, I will aim to transmit it to my computer via USB. This still has a strong software emphasis, but learning about USB is much more tightly coupled to hardware than learning about constant-Q transforms.
Instead of turning the audio into MIDI, I will aim to transmit it to my computer via USB. At this point I think this idea has a number of advantages over the MIDI pickup. First, if I write the pitch extraction algorithm now and it doesn't work well, it will be hard to determine if it's the algorithm's fault, or if something is off with my audio sampling. So being able to stream samples to the computer is a helpful first step even for the MIDI project. Second, though learning about pitch extraction algorithms is very interesting to me, it's not the sort of thing I'm in this class to learn --- it's mostly a dive into signal processing math, rather than hardware. Shifting my software focus from constant-Q transforms to USB keeps me tightly coupled to hardware.
I'll stick with the XMEGA because I'm becoming familiar with its registers and don't want to change. My board design/fabrication and software are described on my [networking](../13_networking) and [wildcard](../14_wildcard) week pages. So here I'll talk about the system integration.
I'll stick with the XMEGA because I'm becoming familiar with its registers and don't want to start from scratch with another microcontroller. All the board design, fabrication, and software for this project are described on my [networking](../13_networking) and [wildcard](../14_wildcard) week pages. So here I'll talk about the system integration.
I designed an enclosure in Fusion. Its main chassis is printed, and it has a transparent acrylic top held on by magnets (left over from my pickup plans). The magnets are seated in recesses and held in place with epoxy. It has a 1/4" audio jack input, a knob to control the pre-amp gain, and a MIDI output. Currently I'm not using the MIDI output, but I want to leave the option open for the future. These three features are mounted to the enclosure, so that they can't put any mechanical strain on the circuit board. The MIDI connector and circuit board are held in place using plastic thread-forming screws. The fusion file is [here](/designs/01_enclosure.f3z).
![](/img/01_enclosure.jpg#c)
Here's the result.
![](/img/01_end_product.jpg#c)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment