Author |
Message |
nsfx
Joined: Aug 10, 2006 Posts: 7
|
Posted: Tue Aug 13, 2013 10:14 pm Post subject:
Envelope follower that outputs MIDI |
 |
|
Hello, I'm interested in mapping the amplitude of an audio signal to CV or MIDI CC, i.e., in oversimplified terms, as an audio signal gets louder, the control value increases, and it decreases as the audio gets quieter. There are some VSTs that do this (e.g., pizmidi midiAudioToCC), but I'm looking for a dedicated hardware solution. (I suspect there may be are modular units that do this, but I have yet to take the dive into the land of modular synths.)
I've searched on and off for a while, haven't found anything, so now I'm thinking about building one. I have pretty limited experience designing circuits, so I'd like to get some pointers on where to start or maybe where to not start. I'd prefer to use an AVR microcontroller but I'm unsure which chips would be suitable for audio input + MIDI output.
Any tips or words of wisdom are much appreciated. Thanks! |
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Wed Aug 14, 2013 9:07 am Post subject:
|
 |
|
I don't know the AVR, but I assume it's got pins that can be assigned as analog that go to an internal ADC, likely 10 bit. (Note that a dsPIC has 12 bit ADCs available).
If you plan to use this as part of a MIDI pass-through system, you will need to write your MIDI firmware to allow for merging with the incoming stream properly.
There's going to be more than one way to get this done. I will describe two ways here in general language:
A) One would be to input the audio to an analog pin on the AVR and let the AVR do all of the work. It's certainly capable. This method will likely use the fewest electronic parts.
You will need to code a method to detect the peaks of each wave cycle and generate a value that "follows" the peaks There will be some filtering involved and the filter(s) should be made adjustable so that the device can accomodate different sound sources. It may also be wise to add an analog antialias filter as the foldback alias artifacts could cause problems with the peak detection (this would depend a lot on the actual harmonic content of the audio used). Care also needs to be taken concerning the fact that an audio signal is usually true AC, i.e., the signal has both positive and negative voltages. Many microprocessors with ADC inputs do not accomodate negative voltages, so some kind of signal conditioning will be needed to mitigate that.
B) Another way is to do some of the work in analog circuits.
As with "A", the "B" method also needs peak detecting (usually done with a precision full wave rectifier) and will also need filtering. This is normally done with a lowpass filter of some kind and again - it should be adjustable to accomodate different sound sources.
Other things to consider are the rate at which the CC is sent out, i.e., how many CC messages per second. This is going to have several effects, but generally, if they are too slow, there might be stepping and if too fast they could flood the MIDI connection with messages too numerous to process by the receiving device. The rate can either be constant or it may be adaptive such that faster changing input signals cause a the stream to be more dense.
Of course, nothing like this is perfect. For example, the adjustment of the filter is always going to be a headache. If it's adjusted to smoothly ride small slow fluctuations properly, it may respond too slowly for more transient portions of the envelope. This is a common complaint about envelope followers and to date, I've seen no solution that covers all cases. The best you can do is to make the filter adjustable with a knob (whether it is done digitally or in analog) so that you can fine tune it for each piece of music and for each instrument it is used with. Also bear in mind that peaks are farther apart in time with a bass instrument than they are with something like a flute. This has a direct affect on the adjustment of the filter. If the instrument has a wide range, then it can be particularly troublesome to adjust since the "best" setting for use at higher pitches may be poor for lower pitches and vice versa. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
rumblin_cynth_rampo

Joined: Nov 15, 2012 Posts: 35 Location: Cardiff, Caerdydd, UK
|
Posted: Fri Sep 06, 2013 5:55 am Post subject:
|
 |
|
Any of the ATXMega MCUs should be able to tackle this. A number have 12 bit ADCs and a minimum of 6 channels. Pretty sure that some of the ATMegas will do the job too. Most of the XMegas have UARTs which would help in getting the MIDI signal out of the chip easier with out bit bashing.. A couple of the Xmegas also have USB support so that would make life easier if you want to send the MIDI to a DAW.
Best place to get more info would be the AVRFreaks website and forum
You could also have a look at the Arduino stuff and see if anyone has implemented what you are after there. Saves reinventing the wheel if the have. _________________ Ian "Lemmy" Kilmister on Hawkwind;
"Like Brahms but violent."
https://soundcloud.com/rumblin_cynth_rampo |
|
Back to top
|
|
 |
|