Old 31st May 2005, 10:52   #1
titou
Junior Member
 
Join Date: May 2005
Posts: 6
Zoom on every 4 beat..

Hi all,
sorry for my so bad english cuz i'm french...
I'm new on milkdrop and starting to make some preset.

But, i've a question,
I want to make a preset who zoom on every 4 beats in a song (especially electronical music).
My perframe code is:
per_frame_4=nbbass = nbbass + if(above(bass_att, 1.3), 1, 0);
per_frame_5=nbbass = if(equal(nbbass, 5), 1, nbbass);
per_frame_6=zoom = if(equal(nbbass, 4), 1.0075, 1);

But it don't really detect beat, Can someone help me to do a detection on every 4 beat?

Thanks a lot.

Titou
titou is offline   Reply With Quote
Old 31st May 2005, 12:30   #2
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
The bass_att variable is just an approximate value for the bass level of the sound at that specific frame. This doesn't mean that it only goes above 1.3 upon beats. Your code simply increments nbbass and zooms in whenever the music is loud enough; (not upon beats!) Beat detection in milkdrop is an issue that has been troubling authors since the very beginning, and it's certainly not that easy to do (at least not in 3 lines of code!) Some authors have developed algorithms for use in milkdrop, if you really need one, just ask for it. You should know however that they are not perfect, and they will probably never be, since a beat is more of a concept of the human brain and not something well-defined in some book or dictionary.

(btw, Unchained, how's that paper you were working on going?)
someusername is offline   Reply With Quote
Old 31st May 2005, 16:17   #3
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
I've compiled a list of alot of beat detection oriented presets.

Hope this helps, most are pretty good!

YAY! a new preset auther,

Welcome!
Attached Files
File Type: zip beat detections.zip (25.5 KB, 447 views)
Phat is offline   Reply With Quote
Old 31st May 2005, 19:32   #4
titou
Junior Member
 
Join Date: May 2005
Posts: 6
Thanks a lot for your answers, i'll see for beat detection and i'll publish my futur preset...

Thanks
titou is offline   Reply With Quote
Old 31st May 2005, 21:50   #5
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
my first "beat detection" was just
above(bass,bass_att*1.3);
then i did that for treb and mid too, didnt really work too well, since bass can be above bass_att*1.3 for longer than one frame, it causes the beatcount to rise way to fast


anyway, its good to have another preset writer around, heres the last two versions of my db based beat detection with a kinda demonstration of how it works. have fun
Attached Files
File Type: zip templates.zip (3.5 KB, 351 views)

Blah!
redi jedi is offline   Reply With Quote
Old 1st June 2005, 12:47   #6
titou
Junior Member
 
Join Date: May 2005
Posts: 6
Thanks to all, for your help, i'm really a beginner (and my english is really bad lol).
I think that the preset "yin - Beat Detective 007 demo" will really help me.
I'll post my preset when they'll be finish...
titou is offline   Reply With Quote
Old 1st June 2005, 13:46   #7
titou
Junior Member
 
Join Date: May 2005
Posts: 6
I post here my 2 first preset using "yin - Beat Detective 007 demo" thanks all for your help, i hops my presets wont be too bad...
Have a good time...

TiToU
Attached Files
File Type: zip titou.zip (2.9 KB, 758 views)
titou is offline   Reply With Quote
Old 1st June 2005, 21:55   #8
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
your presets are just fine, don't worry! keep them coming. However i just found some major mistakes in that preset ('yin - Beat detective demo', i wrote it) It's all messed up, i used min() instead of max() in 2 statements (!) and the most important division in the entire algorithm should be a multiplication! I can't believe how i hadn't seen that earlier and most of all i can't believe how it SEEMED to work for some BPMs and framerates!

Anyway, what i'm trying to say is, keep an eye on this thread, i'll probably post a new version of the preset in the next few days. (I'll also include comments on what each variable means, how to calculate the phase between beats, the BPM etc.) So see you around, and welcome to the club!
someusername is offline   Reply With Quote
Old 2nd June 2005, 09:43   #9
titou
Junior Member
 
Join Date: May 2005
Posts: 6
Thanks to all for your help and especially someusername for your comment and your help for beat detection.
I haven't problems to uderstand the forum, but it's more difficult for me to explain what i want to say, because of my so poor english
I'm surpised that the preset work with some errors...
I'll wait for your new preset (and especially for the comments who will probably help me more to understand how beat detection work).
Have a nice day

Titou
titou is offline   Reply With Quote
Old 2nd June 2005, 18:56   #10
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
your presets are pretty good, i liked the first one, so i did a remix.

few tips:
prolly want to stay away from the warp var. worked good in this instance, but when you try to combine it with other effects it becomes overkill really quick

dont ever divide by a constant, multiply by its reciprocal(or however you spell that) if i rember correctly devision takes like 4 times as long as multiplcation.

i personaly dont like to use the time var. to control anything(mostly all i use it for is in sin(time) for testing), inless i am multiplying it by some number that atleast represents the bpm. i guess it just kinda bothers me when the music cuts out and the preset keeps doing the same movment/colorchange/render whatever the case may be

the biggest thing to keep track of IMHO is the range of the vars. once you can rember what a var centers on, and its usefull range it becomes alot easyer to create equations that will look good(the first time )


well i cant think of anything else so i guess i stop boring everyone now....

Blah!
redi jedi is offline   Reply With Quote
Old 3rd June 2005, 02:45   #11
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
my new beat detection code

well, i should had gone to bed quite a few hours ago, but here i am. This is a new beat detection algorithm i just finished writing, i believe it works quite well for constant beatrates above 100BPM. If you only listen to rock or drum n bass you probably won't have much use for it since it will probably look lame (i haven't tried it yet). Anyway, have a look at the demo preset, it's funny. If anyone is interested, there is a readme in the zip with lots of explaining on how to use the algorithm.

Titou, i hope it matches your favorite music, have fun

That's it from me, gotta get some sleeep now
happy milking
yin
Attached Files
File Type: zip yin - smileyclubber.zip (4.4 KB, 241 views)
someusername is offline   Reply With Quote
Old 3rd June 2005, 08:54   #12
titou
Junior Member
 
Join Date: May 2005
Posts: 6
WAwwww...

redi jedi, i really like your remix, and it give me idea for some preset... Thanks for your comment and your encouragement..

Someusername, i love your smiley preset lol
I test it on house music, but it don't always really match with beat...
Your read me is very interesting, i'll study it to make a good beat detector...

Thanks to all, thanks to all....

Titou
titou is offline   Reply With Quote
Old 3rd June 2005, 10:19   #13
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
Yin that smiley clubber cracks me up yo.
Phat is offline   Reply With Quote
Old 3rd June 2005, 14:48   #14
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
sure does, i like the new remix (check the new zip) so much i gave it a s/n (it's my 330 now) Seriously though, the beat detection (that's what it was all about in the first place) still needed a lot of job. I just saw titou's post and he's abosulutely right (but you probably alrady know that!). I guess i just posted it because i was working on it for a lot of hours straight and wanted someone to take a look at it! It missed a lot of beats and it completely failed with tracks with lower volume levels (or more compressed signal). It seems i developed it while listening to a limited set of tracks and since it seemed to work for them i thought it was ok.

Anyway, this rework is quite different in the way it determines beats and seems to work much better than the prev and at a much broader range of tracks. (i mean it this time ) it's still not perfect but we've been over this a dozen times!
In a few words, the algorithm tries to find spots in the bass graph where the tangent is horizontal, (those spots could be beats) and based on other calculations (as bass level and estimated proximity to the next beat) it determines whether to flag that spot as a beat or not. The algorithm remembers 3 important frame intervals (the one between the last 2 beats, the average between any 2 succesive beats, and the average of the previous average as its value changes). Finally it estimates the beatrate from a weighted average of the above mentioned intervals using as weights the amount of certainty that it's got the beat right.

Enough with the boring stuff, give it a go even if you're not interested in the BD, i don't know if it detects any beats, but it sure is funny!

ps. i would appreciate any feedback/comments about the algorithm's output, especially bad ones. remember the algorithm was (supposed to be) written for constant beatrates above 100bpm
Attached Files
File Type: zip yin_330_beat detection demo.zip (4.7 KB, 223 views)
someusername is offline   Reply With Quote
Old 3rd June 2005, 20:00   #15
StudioMusic
Major Dude
 
Join Date: Sep 2001
Location: Southern California
Posts: 852
Yin that guy deserve's an award. He is very comical. SM
StudioMusic is offline   Reply With Quote
Old 3rd June 2005, 21:00   #16
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
SM, i hope the funny part isn't that is was supposed to be detecting beats!!! (lol)
someusername is offline   Reply With Quote
Old 3rd June 2005, 21:39   #17
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
version 2 works much better, i was playing the the first one last night(after i stoped laughing, witch took a good hour) it seemed to work ok for very few beatrate ranges worked quite well with the music you described, but not much else.
second one is pretty good in the process of modifying it now.

i like how you found the peaks in the sound, but it seemed kinda out of phase sometimes,
i tryed
below(dbass,avgdbass)*above(pdbass,avgdbass)*....
i fallowed your setup for avg vars.
it seems to work better, pretty much just shifted it

sidenote: should that be above() then below(), so that you get the hit on the up the waveform instead of on the way down?

oh and about the above(frame-lastbeat,fps/3) , witch i am assuming you are using to stop multipul detections of the same "beat", i think that might work better with some form of the beatrate in there, fps will prolly shift too much when there is a large preset running.

a problem i had with my bd, you might want to put all your vars. in the init section, it appears that when you get a whole lotta vars. milkdrop likes them all to be initlized. found out that dbass(or avgdbass, cant rember witch) wasn't getting calculated, untell i put it in the init section, then other things went wrong, so i just put them all in there and it pretty much started working, but i think i was over the max number of user vars. mabye milkdrop thought it was unimportant since it wasnt directly connected to any of the milkdrop vars.

anyway, i'll prolly mess with it some more, and post it if i think its working good, or has some new cool feature, or mabye a bug i cant fix

Blah!
redi jedi is offline   Reply With Quote
Old 4th June 2005, 08:32   #18
shifter
Senior Member
 
Join Date: Jun 2002
Location: Australia
Posts: 149
hehehe such a cute preset..

seems to work pretty well on the right kind of music too
shifter is offline   Reply With Quote
Old 4th June 2005, 15:01   #19
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
redi jedi, the algorithm is pretty much out of phase most times (it gets more obvious all the time) The bass variable is very "poor" for the cause we're trying to use it. The algorithm usually locks on other sounds apart from the bassdrum. Even hihats "leak" in the bass band volume level, i can't help it! I'll try to get past this, but i can't see any obvious ways. The encouraging part is that the algorithm usually locks on the correct beatrate after a short while, so i guess we're half way there.

Anyway, beats do get triggered "on the way down" from a peak in the graph. i think the actual part of the code is something like:
[beat = ... above(pdbass,0)*below(dbass,0) ...] This means that until the previous frame the bass was increasing (pdbass stands for previous bass derivative) and now it starts to decay. Isn't that spot a peak in the bass graph then? A beat is triggered on the "way down", just as you said. I think this is the reasonable thing. If you get satisfying results with anything else i'd love to see it.

The above(frame-lastbeat, fps/3) part clips the beat rate to a max of 180BPM, i think it's high enough. (lastbeat is the frame where the last beat was detected). If you could have 2 succesive beats in less than (fps/3) frames, then you would have at least 3 beats per second, thus at least 180bpm. Using some factor "x*bpm" as the test value would also be correct (i suppose) since the algorithm calculates the bpm based on the fps. The pitfall is to actually use something that is not depending on the framerate. THEN you would be developing an algortihm that would work for a single framerate.

As for the init section, i think it's only used to give per-frame initial values to the q variables. I haven't tried it with custom variables to be honest, but i think that's what i read in the preset authoring guide (ages ago) I don't know if it still holds true, i'll try it and see. However, the variables the algorithm uses do get initialized when you load another preset. MD doesn't seem to get confused by the name ambiguities. I don't know... i haven't had any problems with that...

Anyway, gtg now, if you come up with anything interesting you know the rest... Thanks again for the feedback.
someusername is offline   Reply With Quote
Old 4th June 2005, 15:23   #20
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
the obviousness of my stupidity frightens me sometimes!

Why use the frame variable for timestamping when you've the ...(tada) "time" variable? (that has an infitely better resolution)

I think i hear Homer Simpson now... (doh!)
someusername is offline   Reply With Quote
Old 4th June 2005, 23:24   #21
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
"the obviousness of my stupidity frightens me sometimes!"

I think someone is fishing for compliments now.

Everyone knows you're not stupid, it just takes a while to let that much code optmimize in you're head.
Phat is offline   Reply With Quote
Old 5th June 2005, 12:27   #22
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
well it was a figure of speech, but it hit me a little hard when i realized it! (if you use "FRAME" for TIMEstamping, what would you use "TIME" for?)
someusername is offline   Reply With Quote
Old 6th June 2005, 05:28   #23
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
well i changed it to use time insted of frame, modified the beat= code, tried to optimize it a little, and mabye a few otherthings... anyway, check it out.

mabye if we all toss it back and forth for a while we will end up with something that works well on most music at any framerate, and keeps working when design i large preset around it( i have verified with monitor that my other beatdetection stops working when you use a lot of variables, inless there inisilized)

Blah!
redi jedi is offline   Reply With Quote
Old 6th June 2005, 16:19   #24
unchained
Major Dude
 
Join Date: Jul 2001
Location: richmond, va
Posts: 639
Send a message via Yahoo to unchained
"Everyone knows you're not stupid, it just takes a while to let that much code optmimize in you're head."

And with time always slip-slip-slipping away beneath our feet, with its never ceasing demand for yet another apostrophe and constant calls for more "E"...we are truely dammed.
unchained is offline   Reply With Quote
Old 6th June 2005, 23:24   #25
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
hey redi-jedi, i just checked your modification. Unless you've adapted it to other music genres than those it was originally meant for, i must say it doesn't seem to work better than the previous; However it's only a framerate issue. I'm probably watching it at a different framerate than the one you developed it. To be more specific, the code doesn't seem to be able to estimate a beatrate above 100bpm (on tracks around 140) and it gives different output for the same music in different video resolutions. (framerates essentialy)

Since you used the "time" variable instead of the "frame" one, most of the data doesn't need to be normalized to time in order to compensate for different framerates; (the actual time is now inherent to most variables such as the "interval" ones or the "bpm") However the sound levels read from MD's bass,mid,treb variables still require such a process. (i see you removed mine from the original) If they're not normalized, running the preset at a different framerate will only make sure you won't get the same results on the same music.

I don't mean to sound expert on this or anything (my version doesn't work much better either), on the contrary i want to thank you for spending your time with it. Since it seems you're interested in it too, maybe we can get it somewhere. I just thought i'd let you know 'cause it's really not any difficult to fix but yet it's fundamental. I haven't checked the code very-very thoroughly but i will first chance, i see you made use of the mid and treb variables too)

I must say i've been working on it myself a little, and i'm getting very disappointed!!! The algorithm most times seems to track the beatrate by +/-3bpm, but it's way out of phase most times. Try tapping your finger to the beat while watching the smiley jump around. You get confused because it's out of phase most of the time! I don't know... MD's bass/mid/treb are really bad for such a use, and developing an algorithm within a custom waveform's per point code is pretty much pointless, you can't even pass any values -calculated in the per-point code- to the next frame!

I'm a little frustrated to be frank, i really want to get this working but it seems more and more "impossible" all the time. Anyway, i'll be back with feedback asap

ps. i'm getting 85fps on that smiley preset
someusername is offline   Reply With Quote
Old 7th June 2005, 02:29   #26
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
i run everything at 50fps, didnt see the unlimited option, but anyway, most of what i did was attempted optimization, so i guess its a good thing it does almost the same as yours(actualy i just rembered there was some unused code i forgot to deleat). with the dtreb and dmid vars i was trying to counteract how bad MDs music var.s are, i was thinking mabye subtracting some small part of the dtreb from dbass to minimize the effect but it didnt really work, since i was dealing with the change in bass, subtracting the change in treb was only helping it dectect the treb beats. then i tryed using treb_att, that seemed to work better.

is there a pluging or something that will tell me how many bpm i should be gettting?(imho, we dont need exact the exact bpm, just a number that increases when the music does and vice verca.

oh and had a nother idea, havent figured out how to do it yet, but you did something simmilar. rember that hue-->RGB converter, well pretty much just turn it around, bass/mid/treb in and pitch(?) out

Blah!
redi jedi is offline   Reply With Quote
Old 7th June 2005, 20:06   #27
StudioMusic
Major Dude
 
Join Date: Sep 2001
Location: Southern California
Posts: 852
Yin, I am getting 160 fps with mesh at 40 x 30 dispaly at 1280 x 960 75 hz and texture on auto with your smiley since those factors are the major things that effect framerate. Raised it to 80 x 60 mesh and got 110 fps, but honestly it looks much better at 160 fps. SM
StudioMusic is offline   Reply With Quote
Old 9th June 2005, 14:26   #28
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
Redi Jedi: we don't actually need the bpm, but i guess if we can get an algorithm to estimate it, then we're half way there to detecting the actual beats. I don't know of any winamp plugins that just display the bpm, I was just comparing to things i've mixed (that i'm sure of their beatrates) or roughly estimating it in my mind.
I strongly suggest that you multiply the values read from MD's bass mid and treb variables with FPS, (which is essentially dividing them by the time delta) or the algorithm will be framerate dependent. (if this it's not obvious why, i can explain this. Don't do the same with any test values in if() statements though) However if it only seems to make things worse, leave it as is.
The bad news is that my monitor just won't turn on last couple of days and i'll have to be going to internet cafes for a while, until i get a new one. So i haven't done any work on the algorithm and i probably won't drop by very often in the near future. I hope i'll get a new one as fast as possible.
(Can you explain that hue->RGB approach? I don't understand what you mean...)

SM: 160? i thought MD would clip it to the monitor's refresh rate. (That's how i think i'm getting my 85fps on 1024x768x85Hz) Anyway, it's a relief that the algorithm seemed to behave properly at such high framerate.
someusername is offline   Reply With Quote
Old 9th June 2005, 15:58   #29
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
Yin post you're presets for the update
Phat is offline   Reply With Quote
Old 10th June 2005, 17:29   #30
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
Phat, it's been 3 or 4 days i'm without a pc, (my monitor bit the dust) I just ordered a new one. Should be home by Tuesday... Thanks for reminding though (SM especially who bothered to send me an e-mail) I hope i make it till then...
someusername is offline   Reply With Quote
Old 10th June 2005, 17:41   #31
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
Redi Jedi:

Quote:
I strongly suggest that you multiply the values read from MD's bass mid and treb variables with FPS, (which is essentially dividing them by the time delta) or the algorithm will be framerate dependent.
sorry dude, there's a mistake in this, you don't need to multiply the actual bass/mid/treb values with FPS, only their differences (dbass etc.) with the respective value of the previous frame. E.g. if you're still using sth like 'dbass=bass-pbass;' where pbass is the bass value from the previous frame, it should be (imo) 'dbass=(bass-pbass)*FPS;' The actual bass/mid/treb values should be used as they are.
Sorry again...
someusername is offline   Reply With Quote
Old 10th June 2005, 17:52   #32
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
I accidentally sent Shifter an E-mail thinking it was you're address, so I'm right there with SM man...

Just sent one to fishbrain also. I think if we send people e-mails we should make sure to include the fact that they must have there stuff in before july 1st

Last edited by Phat; 10th June 2005 at 18:09.
Phat is offline   Reply With Quote
Old 13th June 2005, 16:39   #33
someusername
Senior Member
 
Join Date: Sep 2004
Location: greece
Posts: 146
ok dude, thx. I'll go check on that thread shortly...
someusername is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Presets

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump