squeal Posted August 29, 2007 Report Share Posted August 29, 2007 Hey guys! I'm a noob here, so forgive the potentially dumb question....I want to turn audio signals into midi-cc values. I plan to implement some kind of envelope follower to turn the audio signal into a usable control voltage, then into midi cc from there.My question is: can I just input the audio into the ain module, and then perform the envelope following digitally, using the pic in the core module? I was originally planning to use a hardware envelope follower design, but I thought that if I could use the core module to do this, I would save money and time and maintain more design flexibility. I need to do a minimum of 4 distinct audio stream>>envelope followers. Quote Link to comment Share on other sites More sharing options...
squeal Posted August 29, 2007 Author Report Share Posted August 29, 2007 Thanks for moving this...Didn't notice the design concepts section. Sorry. Quote Link to comment Share on other sites More sharing options...
audiocommander Posted August 29, 2007 Report Share Posted August 29, 2007 Hi squeal,no prob.welcome to the forum ;-)in guess this should be possible, but IIRC line-in signals are 1.2V max; the AIN would reach it's maximum at 5V.Maybe someone else can say something about possible dangers, dunno about the currents?Although it's not exactly what you're after, this userproject might from lylehaze might have some infos of value to you:http://www.midibox.org/dokuwiki/midiboxmixerBest,Michael Quote Link to comment Share on other sites More sharing options...
/tilted/ Posted August 29, 2007 Report Share Posted August 29, 2007 Your best bet in terms of ease of programming and reliability would be to take a leaf out of old audio compressor design and use an optical coupler or similar strategy.The basic premise is that you:1) connect a light source (ie an LED) to your audio signal (I would suggest using an op-amp buffer to avoid overloading your audio output, and to give you more juice to drive the LED). Also, the op-amp wants to be optimised so that your hottest signal will give it nearly +5v output.2) physically coupled to this LED (and shielded using black tape or a small tubing sleeve, you connect an LDR device.3) connect one lead from the LDR to ground, the other end to the analog input on the PIC.The pic would then treat the LDR as a voltage source, not too different to a pot or fader.This is the concept. You'll find it needs a little refining and experimentation. Quote Link to comment Share on other sites More sharing options...
squeal Posted August 29, 2007 Author Report Share Posted August 29, 2007 thanks for the replies. :)A.C.: could you explain what iirc is? As far as AIN, I would need my audio signals to be between 0 and 5V. Is that right?tilted: I was trying to avoid any extra work (since I need to do 4-6 of these) but that might be the ticket. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted August 29, 2007 Report Share Posted August 29, 2007 Hi squeal,IIRC = If I Remember Correctly ;) You do need 0-5V, but as AC mentioned there may be issues with current.... I have no idea !The method which tilted mentioned is often referred to as a 'vactrol'. Though you might like that as a search term so you can find schematics. Quote Link to comment Share on other sites More sharing options...
Ashiman Posted August 29, 2007 Report Share Posted August 29, 2007 modern compressors use THAT2252 ::) Quote Link to comment Share on other sites More sharing options...
Ashiman Posted August 29, 2007 Report Share Posted August 29, 2007 http://www.koen.smartelectronix.com/KTDrumTriggerseen this one? Why you need envelope data? Quote Link to comment Share on other sites More sharing options...
squeal Posted August 29, 2007 Author Report Share Posted August 29, 2007 IIRC, meh. ;DOkay, it seems a little background info is in order.My plan is to create a guitar-like midi synth controller. I plan to use these pickups:http://www.stewmac.com/shop/Electronics,_pickups/Pickups:_Guitar,_electric/1/Graph_Tech_Ghost_Pickup_System_for_Guitar/Details.html#detailsto get separate signals for each string.I would then need to turn the volume of each signal into a midi-cc value which could be mapped to parameters in a synth engine. Now I could use vactrols or some other analog envelope follower method to create a usable voltage to put into an AIN module, but I was wondering if I could avoid that extra work by simply inputting the raw audio (scaled appropriately of course) to the AIN, and implementing envelope followers in the code.@ playbo$$- That VST looks awesome, but I don't necesarily want to use a computer with this midi controller. Thanks for the link, though. :) Quote Link to comment Share on other sites More sharing options...
squeal Posted August 29, 2007 Author Report Share Posted August 29, 2007 OK based on what A.C. says I am gonna go ahead and give this a shot. If I can't do a digital env follower in the box, then I will just go ahead and build analog env followers. Does anyone know what the sample rate of the AIN module is? Same as the core(40mhz)?If anyone has any thoughts or questions on this project, let me know. Quote Link to comment Share on other sites More sharing options...
nebula Posted August 29, 2007 Report Share Posted August 29, 2007 Unprocessed audio into AIN wouldn't give the results you're looking for. The sampling rate is not high enough, so as a result you'd get somewhat unpredictable results - and if you tried to "smooth" the input in software it would likely introduce far too much latency.You will need an analog envelope follower of some sort at the input stage. There is a variety of simple envelope follower schematics all over the net, including a couple that don't appear to require expensive and fragile vactrols:http://www.uni-bonn.de/~uzs159/envf.htmlhttp://www.angelfire.com/music2/theanalogcottage/envfol.htm(fyi: as i was typing this you posted your last reply, but i'm too lazy to change it) Quote Link to comment Share on other sites More sharing options...
ultra Posted August 29, 2007 Report Share Posted August 29, 2007 if you come up with something, be sure to document it in the wiki! Quote Link to comment Share on other sites More sharing options...
squeal Posted August 29, 2007 Author Report Share Posted August 29, 2007 if you come up with something, be sure to document it in the wiki!I definitely will :)@ nebula: do I REALLY have to build envelope followers? :-[ What is that sample rate? Quote Link to comment Share on other sites More sharing options...
Ashiman Posted August 29, 2007 Report Share Posted August 29, 2007 the PIC ains go into a single successive approximation ADC so its a single converter . Nebula says processing these signals would take big effort and mcu cycles, I think he is right. Please check THAT2252 datasheet and app notes it might be what you want (...) Quote Link to comment Share on other sites More sharing options...
squeal Posted August 30, 2007 Author Report Share Posted August 30, 2007 the PIC ains go into a single successive approximation ADC so its a single converter . Nebula says processing these signals would take big effort and mcu cycles, I think he is right. Please check THAT2252 datasheet and app notes it might be what you want (...)THAT looks pretty easy. Maybe I will use.......THAT. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted August 30, 2007 Report Share Posted August 30, 2007 What is that sample rate? MIOS samples the AINs every 100ns, so 10khz. I guess that keeping Nyquist in mind, that means the highest frequency you could track would be 5khz. Quote Link to comment Share on other sites More sharing options...
bugfight Posted August 30, 2007 Report Share Posted August 30, 2007 MIOS samples the AINs every 100ns, so 10khz. I guess that keeping Nyquist in mind, that means the highest frequency you could track would be 5khz.given that you aren't interested in returning to frequency domain,10k sample rate should be enough. envelope followers roughly follow thethe power level of the input, and the energy level of audio signals above 5k is usually not very high. you would only really lose energy information ator near harmonics of 1/2 sample rate: 5k, 10k, 15k, 20k...so give it a shot.(unless you are wanting to track glockenspiel or something, hehe) Quote Link to comment Share on other sites More sharing options...
Ashiman Posted August 30, 2007 Report Share Posted August 30, 2007 given that you aren't interested in returning to frequency domain,10k sample rate should be enough. envelope followers roughly follow thethe power level of the input, and the energy level of audio signals above 5k is usually not very high. you would only really lose energy information ator near harmonics of 1/2 sample rate: 5k, 10k, 15k, 20k...so give it a shot.I would not want to see the resulting transients - even if possible :P Quote Link to comment Share on other sites More sharing options...
squeal Posted August 30, 2007 Author Report Share Posted August 30, 2007 OK cool. I'm going for it. :DNo real reason to not try it.Also, the "audio" that I will be tracking is kind of irrelevant, so I can tailor it to the processing. I am tracking the vibrations of guitar strings, and I am not using the audio for any other thing. The strings could all be tuned to the same note for all I care. I just want it to feel like a normal guitar and extract a usable envelope.Tomorrow is payday, so I'll order the pcbs and such and get started. Thanks everyone for the info and advice. :) Quote Link to comment Share on other sites More sharing options...
bugfight Posted August 30, 2007 Report Share Posted August 30, 2007 I would not want to see the resulting transients - even if possible :Pi think transient frequency domain information is irrelevant in this case.however, this does suggest a problem with midi rates.if you are interested in the transient info of a guitar pick attack,i think probably midi is not sufficient to transmit this, no matter howthe data is collected.on the other hand, if you want to follow average power levelsto control say filter cutoff, you should be alright... Quote Link to comment Share on other sites More sharing options...
squeal Posted August 30, 2007 Author Report Share Posted August 30, 2007 i think transient frequency domain information is irrelevant in this case.however, this does suggest a problem with midi rates.if you are interested in the transient info of a guitar pick attack,i think probably midi is not sufficient to transmit this, no matter howthe data is collected.on the other hand, if you want to follow average power levelsto control say filter cutoff, you should be alright...Now I do want it to twiddle the volume parameter of my synth engine, among other possible uses. I don't really need it to be very guitar like in the shape of the transient, but I do want it to be as fast as possible. A slow attack would make it less satisfying to play, I would imagine. Quote Link to comment Share on other sites More sharing options...
squeal Posted August 31, 2007 Author Report Share Posted August 31, 2007 OK so I've been mucking about with some VST code putting bit reduced audio into envelope followers, and I'm fairly convinced that any signal degradation due to the bit reduction causes negligible change to the envelope. I mean this depends on the env folloewer's parameters and structure, but I think that in most cases it won't matter.Specifically, I compared 44.1k audio into env follower with 4.41k audio into env follower, and the outputs looked about the same. New question:The C code envelope follower I am thinking of using is comprised of 2 cascaded single pole filters. There is more to it than that, but that is the part I want to implement in code. So, for four channels I would need to do 8 individual single pole filters. Could the pic reasonably handle this using the mios framework? Quote Link to comment Share on other sites More sharing options...
squeal Posted August 31, 2007 Author Report Share Posted August 31, 2007 On second thought maybe I will do the envelope followers all in hardware. Then I could have some CV outs to plug into my MG-1 and rock out analog style. ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.