CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Song peak detection (bpm counter)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nuno12345



Joined: 16 Jul 2008
Posts: 50

View user's profile Send private message

Song peak detection (bpm counter)
PostPosted: Sat Aug 15, 2009 11:45 am     Reply with quote

Hello, I'm trying to develop a BPM counter for music beatmatching but I can't find references anywhere so I started a new thread.

My guess is that I've to make a lowfreq filter first for "beat" detection, then detect each peak and the time between those peaks.

Any help? Smile

Thanks
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Thu Aug 20, 2009 1:46 am     Reply with quote

I did something similar recently. (VU meter. Fun!)


Do you have your filter/peak detector circuit yet?

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
nuno12345



Joined: 16 Jul 2008
Posts: 50

View user's profile Send private message

PostPosted: Tue Aug 25, 2009 8:31 pm     Reply with quote

well i think for filter we can simply use an RC circuit, low pass filter quite simple....dont have a peak detector but probably i can use ADC right?
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Aug 25, 2009 11:02 pm     Reply with quote

I would make sure to use a good low pass with an op-amp.

You'll need the drive of an op-amp to make most ADC's happy.

If you look on Microchip's website, they have a free download for a "filter designer" called FilterLab.

In a sense, you could just as easily use a peak detector on a comparator as you could an ADC to figure out at what point you have what level.

But either way, you still need to start with a good filter that takes out the stuff that can interfere with the signal you want to measure.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Wed Jul 07, 2010 9:21 am     Reply with quote

Anyone found solution already?
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Jul 07, 2010 2:04 pm     Reply with quote

I did a peak detector for another project (the VU meter) that worked quite nice.

The software just drives a VU display though.. it's not trying to detect peaks.

So I don't know if that's a solution for you.

I used a low-pass filter with an active rectifier.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Wed Jul 07, 2010 2:17 pm     Reply with quote

Hello, again.

After this post here today, i started working in MATLAB to test some filter and peak detections and later write in C and put in a PIC.

My idea is this:
-We have a sound from 0~20KHz
-Since we need to detect beats, we need only arround 500Hz of max frequency.
-In my case, i will use 2KHz of ADC conversion frequency in the PIC, which will make 1KHz of max frequency, and its enough
-Then i will make a simple convultion filter with 16 points, wich is enough to not start having echo after the calculations
-Then we can apply to all points: x^4
-Then we just need a threshold value
-After... well i will do tomorrow, but we need to filter the beats, give some time to wait for the next one, and measures, automatic gain and so on...

(NOTE: Of course we need normalizations and so on... i added them in the matlab file)
(NOTE2: I am just planing to use a voltage divider, condensator and 2 resistors to put mean value of sound in 0.25V)

Picture here:
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Wed Jul 07, 2010 3:34 pm     Reply with quote

I forgot to tell, the song is Into The Future (The Aston Shuffle Remix) :P
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Wed Jul 07, 2010 4:23 pm     Reply with quote

Here I am back again.

I made some tests in Proteus about the input circuit... At a first approach I didn't want to use opamps and so on, yes, you may ask about the input power, well this circuit is to work with high sound power, not a regular headphones output. That's why the idea of the voltage divider. Anyway, after some mins playing with Proteus I got this:

vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Thu Jul 08, 2010 5:22 am     Reply with quote

Finally i spent some more time improving the MATLAB C file.
Its not finished yet:
> I need to make the auto gain code, which is not easy to make in MATLAB because i am not running in real-time, but i will try.

Here is the latest picture:



I will upload the files soon
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Sat Jul 10, 2010 7:46 am     Reply with quote

Check my latest update!

http://www.youtube.com/watch?v=ALCoSOcjPY8
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Thu Aug 19, 2010 5:40 am     Reply with quote

CHeck my website, i made the first working prototype (more or less) :p
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group