audio (music) signal processing

beny1949

Senior Member
hello,
I have been trying to think of a way that I can process audio signals, to create a robot that will respond to music. The inspiration for this has come from a bot called 'keepon'<A href='http://univ.nict.go.jp/people/xkozima/infanoid/robot-eng.html#keepon' Target=_Blank>External Web Link</a>

I if used a low pass filter would i be able to use a falling edge pulsin comand(possibly more than one) to determine the amount of time between beats?

If anyone could shine any light on this or suggest a better way to find the frequency of a beat (with a pic-axe) i would be very greatful

Ben

 
 

womai

Senior Member
Analyzing a full sound spectrum in real time takes WAY more computing power than a Picaxe has. Even a raw 8-bit Microchip PIC programmed in assembler is probably not up to the task. There are specialized DSP (digital signal processor) controllers for that sort of thing, usually running at above 100 MHz and with integrated hardware DSP.

That said, if all you need is to listen (react) only to a single frequency then what you need is a bandpass filter (not a lowpass filter) as your first stage, tuned to the frequency of interest:

input -&gt; bandpass -&gt; peak detektor -&gt; Picaxe ADC input

If you want to react to ANY sound, then omit the bandpass filter.

The peak detektor can be as simple as a diode feeding a resistor in parallel with a capacitor (same idea used in any old detector (crystal) radio set).

Wolfgang
 

hippy

Technical Support
Staff member
Yes, that filter plus peak detect can work well. With the right attack and decay rates on the sampling capacitor you have a good basis on which to analyse music. This is how simple disco sound-to-light systems work ( level as sampled sets the light intensity ), and with a PICAXE you can get much more fancy, especially bass beat synchronising and even crescendo detection. The nice thing about music is that beats rarely come in at more than two a second, so it's quite a leisurely processing task, once you've synched up.

It's been a long time since I did any of this. I used three or four bandpass filters, but recall the bass and low-mid were the two best suited for tempo related processing. With the intensity of each band you can determine rising edges and so on.

On an aside; it was noted that a 240V, randomly flickering Neon 'mains on' indicator would always appear to be responding perfectly to whatever music was playing, so it's probably reasonably easy to produce something which appears to respond well no matter how simplistic - Who still owns a &quot;dancing flower&quot; ?

One tip - 'Not dancing' when there's no music is a key factor in making it look responsive and good even if its not ! Better to under react than over react.
 

beny1949

Senior Member
thanks for your help so far guys. can i ask why a band pass filter would be used opposed to a low pass filter?



 
 

Dippy

Moderator
You could use a low pass if you just wanted it to respond to boom-boom-boom.

If you want it to respond to boom-titty-twang-peep then you'll need to look at bands.

Can you get a Graphic Eq chip/circuit to just look at bands?

I'm currently designing a real-time FFT Audio analyser and having to use a dsPIC flat out, so you can guess how much processing and memory that requires.

Edited by - Dippy on 12/04/2007 22:11:38
 

beny1949

Senior Member
yeah, hit the nail on the head dippy. i want to purely get the head banging boom-boom-boom. and use that to set the speed at which my robot will perform a series of funky dance moves. I will put up some details of the chassi design on my site in the morning <A href='http://www.ben-howes.co.uk' Target=_Blank>External Web Link</a>. the morning: *ok maybe not this morning, Girlfriends coming over (thanks dippy, maybe i should start revising for my english GCSE)*

My dad has offered to help me out with the analogue side of things as most of what i know about all this filter stuff was learnt this afternoon! much prefer programing! anywho, i will post his circuit up on my site when he has something for me.

In the mean time i shall make the chassi with some very nice little escap motors. mmmm...swiss....

Ben

&#160;

Edited by - beny1949 on 13/04/2007 10:53:52
 

premelec

Senior Member
There is a fairly cheap chip incorporating 3 channel &quot;color organ&quot; capability in a tiny package - filters and light driver outputs - I think it was from National Semi... anyhow it would help you a lot in your endeavor.. If you want I can dig in my back files [about a year ago] to get a part #.
 

hippy

Technical Support
Staff member
If you can find a chip like premelec mentions then that would cut out a lot of effort. Even if you can't, filters are easy to make with few components, and you can start off with a simple design and get more complex as you go on - it makes sense to build it on separate strip-board / PCB if you are thinking of going that way.

My recollection of beat detect was that a simple low-pass filter let too much in to allow good processing and a low-end band-pass gave better results. By all means though experiment, and this is a great project to do it with. You have three separate modules -

* Hardware / motor drive / actuation
* Audio filtering / level detection
* PICAXE software control

You can make each as complex or as simple as you like, and improve each part on its own if you feel like it, even add more.

Somewhere I've got a design for an electronic parrot going back decades which was to have 'personality', light, temperature, sound and other sensors, plus some slow running up-down out-of-step ramps so it could have 'moods' like with biorhythms. Once you get going you'll only be limited by your imagination, so good luck.
 

premelec

Senior Member
The chip I recalled is the National LP3954 &quot;Advanced Lighting Management Unit&quot; -and it has up convertors, vib motor drivers and a lot of other stuff as well as the audio features - for cell phone use - see page 17 of the data sheet for audio sync... they cost about $4US and you'll need an adapter board :) 3x3 mm 36 bump SMD package - I knew there was a reason I wasn't using one! I'm going to have to train some fleas to do soldering on this .5mm SMD stuff.
 

Michael 2727

Senior Member
A single LED read by an ADC input could be used.
If you used a Red LED (1.5V) and a white LED
(3.6V) would give better peak detection.
Driven from a small OP Amp etc.
 

beny1949

Senior Member
Thanks very much for your advice!

I have set my tame analogue circuit designer on the Audio filtering stage (thanks hippy)

For now at least he wants to attempt a low pass filter, but neither of us know what the cutoff frequency should be. I was reckoning on about 2-3 Khtz? Any advances?

Ben
&#160;

Edited by - beny1949 on 16/04/2007 19:40:11
 

beny1949

Senior Member
Thanks very much for your advice!

I have set my tame analogue circuit designer on the Audio filtering stage (thanks hippy)

For now at least he wants to attempt a low pass filter, but neither of us know what the cutoff frequency should be. I was reckoning on about 2-3 Khtz? Any advances?

Ben

 
 

hippy

Technical Support
Staff member
No advice, but bass is a lot lower than 1kHz. Take a trip along Google way.
 

BeanieBots

Moderator
Have look at a HiFi with graphic equaliser.
The frequencies are nearly always shown by the sliders.
Drop all down except one which should be full up and listen to the sound. That will indicated what sounds will activate your trigger.
If you don't have one yourself, pop into a HiFi shop and try it out on theirs.

'normal' bass is around 150Hz, 'boomy' bass is below 50Hz. A 'typical' female screem is about 3kHz. Cymbals are about 10kHz.

IMHO your best bet for 'rhythm' would be to go for a 3db/octave band pass covering 50Hz to 200Hz.
 

beny1949

Senior Member
thanks very much beanie bots!
I used the equalliser on my pc, it would seem that what you suggested is in fact the optimum way to get the sound i want!


Ben


 
 
Top