Audio Project Trade-offs
I want to build a device that serves the audio experimenter in the same way the Arduino serves the artist community. The Arduino won't do the job for audio because AVR8s are woefully underpowered (max clock speed, multiplier performance, very little RAM). The AVR8 also doesn't have an I2S or AC97 interface to a true audio codec. In shopping around, I've settled on the STM32F205RB, a 120MHz ARM Cortex-M3 processor. It has I2S interfaces, so I can hook it up to a real audio codec – I'm thinking the inexpensive but very functional Wolfson WM8731. This should be a powerful platform for running bare-metal audio synthesis and processing algorithms, and some limited Pure Data (pd) or Supercollider patches.
In this design, I'm rapidly running into a bunch of competing constraints:
- Arduino shield compatibility. This makes the board design bigger and awkward to lay out, especially if I include lots of built-in peripherals like MIDI in/out and headphone jack (see below). I'll never be 100% compatible with all Arduino shields anyway, since my processor architecture is totally different than Arduino. So my compatibility would be limited to shields I (or others) make the effort to support on the STM32Fxxx platform. LeafLabs has done some good work on this front already. As an alternative, I can develop my own custom shield format and provide shield kits that customers can hand-assemble.
- Built-in MIDI in/out. It'd be nice to plug my device straight into a keyboard or controller and go to town. But MIDI connectors are big and clumsy and would make my device bigger and harder to build into a hand-held instrument. MIDI ports also add a fair bit of cost – the connectors and opto-isolator, through-hole assembly, and the extra circuit board space. Are MIDI interfaces still important if I can instead provide USB MIDI using the STM32F205's USB OTG functionality (e.g. just plug your USB-MIDI controller straight into my device and play)?
- Headphone output. I'm already building in 1/8" stereo line input and line output. The WM8731 also provides a headphone output. Would you want to listen on headphones, or would a line-out into a headphone amplifier work just fine for you?
- Microphone input. The WM8731 has a mono microphone input, designed for cheap little electret capsules (like those you find built into laptops). It's not a high-quality input. Would it still be worth having a jack where you could plug in a cheap Logitech computer microphone – instead of connecting some sort of microphone pre-amplification to my device's line input?
- Micro SD card slot. Would it be important to have access to vast amounts of data stored on an SD card? Or would the 128K or so of flash inside the ARM chip be enough for most applications?
Leave a comment and let me know what you think.
Comments
This sounds cool! I've done a bunch of work with Arduino, but never dipped my toe into hardware audio (I've done some stuff with Ableton, OSC and some custom scripts, though, so I'm at least not completely clueless) – so take the following with a grain of salt. But:
It's hard for me to imagine tons of people needing MIDI connectors OOTB. If it really could let people pick up the device & get going, that'd be one thing. But realistically, they'll need some expertise to get up and running, right? Maybe you could expose this stuff through a pin header and let folks buy an adapter cable with the optoisolator shrinkwrapped into it? Seems like it'd be fairly easy to work something like that up.
It strikes me as very important to have an SD slot. I know it might not be what you're in to or find interesting, but plenty of folks will probably just want to trigger some PCM audio as a sort of hello world application.
You mentioned wanting to avoid thru-hole, so maybe this is a no-go, but what about solving the microphone/headphone versus line in/line out conundrum with a couple of jumpers? If the thru-hole's a problem, some simple but clever circuit design could probably make adding a jumper an easy mod for folks who want that functionality.
I hope this helps! Good luck.
I like your idea about switching around line-in vs. mic-in and line-out vs. headphone-out. I'm definitely going to borrow that. Might be a little bit tricky since I'll still need to stuff components for both types of inputs and outputs, or find good common-ground component values. But I think it might be workable. Thanks!
My votes:
Shield. No interest. MIDI. USB would be fine. Direct MIDI would be kinda cool, but also a PITA. Headphone output. Moderately to highly useful. Microphone input. Less useful. Micro SD. Moderately to highly useful.
:-)
So pumped on this project!
Micro SD is important for some applications - but I think an add-on board would be totally appropriate for that. Most of my applications would not use more than 128k. (But I do want the option to use it as a little sampler)
I personally use hardware midi for nearly everything.. but I don't know if I'm a good market slice or not. No idea. Also - like I mentioned it would position your project well visually. But worth the cost? Only if everyone else agrees with me I guess.
I would rarely if ever use a mic input. Line input is fine. Anyone who wants to use this thing with a mic would probably want to use a real mic anyway - and need a real preamp.
A headphone output would be really nice. Maybe it could be used instead of a line output?
Arduino Shields - don't have much of an opinion on this one. I think as long as you have options that are similarly expensive/cheap it doesn't matter so much.
I had a comment from Twitter user @anachrocomputer about using the LeafLabs Maple platform. I love the LeafLabs stuff, but there's a few reasons, off the top of my head, why I decided not to build off of it:
I'm keeping an eye on the Maple Native, which might work well. But that's in the undefined future. And still, it looks like it won't have an F2xx part on it. Though I have seen LeafLabs people mention that they're looking at it. I'm sure we're going to wind up sharing a lot of code, since somebody (maybe me!) is sure to develop an I2S audio solution for Native when it comes out.
Arduino shield: As you say, it's not a great platform for audio, so why try to force compatibility on the shield level? If you adopt the idea of the "open pins" that the base arduino board has, then an arduino could be connected to send/receive sensor data to your device - unless your hope was to use the arduino IDE as your development platform? (doesn't sound like that's the plan)
MIDI: go with USB midi as a default, and maybe provide a way that a classic midi in/out port bank could be added, maybe as a separate component (I would imagine a DIY MIDI cable MIDI USB kit would have its own fans anyway). At this point, every piece of midi capable gear I've bought in the last 5 years at least has been usb (but I don't do pro gear, and I don't buy into expensive "retro" gear)
Audio out: Whichever keeps cost down the most should be the default. Again, if there's a way to add audio outs via extensions, that's the best.
Audio In: If the device could handle any kind of audio processing, I'd say it should have an in jack. Left hand path: is a usb-in jack feasible at all? I have several USB microphones, including two decent quality ones - with the Blue Snowball line, etc. good USB mics are pretty common these days (and affordable to the non-pro). Or maybe another question would be if it would be possible to do audio and midi over the same usb port? (so pd/max/etc could send audio data to it, or whatever)
I got a Fluxmasynth* and built it, but never quite got around to coding anything for it (I'm not sure how big of a community ever formed around it, but it was a neat little thing, even though I was disappointed to realize that it wasn't a programmable synthesizer - the voices were all GM midi presets if I recall)
awesome project ived used the same codec and love it http://wiki.openmusiclabs.com/wiki/AudioCodecShield the arduino is rather limited but the maple isnt so bad and the ret6 promises to be even better
the idea of puredata compatability is great id love to write a patch in puredata and just dump it in
microSD: yes MIDI: maybe headphone out: yes mic in: maybe shield compatibility: maybe
Shield compatibility would be a big win, in my opinion, if and only if you can use it to accomplish the other options you have in mind. I know there is at least one MIDI shield on the market already. There might be a microphone shield too. How about a pro mic shield with XLR input(s) and phantom power? Bonus points if it is usable with an Arduino.
Even if you don't support Arduino shields, I think it is important to have some way for people to extend the product with things like headphone out, line out, line in, instrument in, mic in, phantom power, speaker out, MIDI in/out, effects send/return, knobs and buttons, displays, telephony, low bandwidth SDR (like SoftRock-40), and more.
I really want this. This post was 3 years ago, have you done it yet? I've been looking at the Cortex M3 or M4 processors for doing simple DSP stuff with external CODECs, EQ filtering, FFT, delay, etc. I want to use one of these arduino/launhpad type boards, but its' hard to choose and none are specifically set up for this. mbed, teensy3, maple, and arduino due all seem somewhat capable?
hmm: I built it and developed some audio processing code for it, but didn't really follow up. At some point, I became aware of the BeagleBone Black, which sells for $45 (when you can get it) and blows my Cortex-M4F design out of the water. The only shortcoming of the BBB is that it doesn't come with analog audio I/O, only HDMI audio. So I do have a "cape" audio board for the BBB that kinda works…