Old 28th March 2008, 07:04   #1
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
First Post/Preset

I have been using milkdrop presets for years but this is my first time to post on this forum. I want to create a series of presets in order to learn the ins/outs of milkdrop, but I also am looking to achieve very specific effects...

I created a basic preset to start with using the per_pixel effect zoom=((x*y)/(x*y)) which I have a particular affinity towards, as well as a gradually shifting rotation.
flyinghamster is offline   Reply With Quote
Old 28th March 2008, 07:08   #2
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
forgot to attach the file
Attached Files
File Type: milk flying hamster - flower borders.milk (1.4 KB, 373 views)
flyinghamster is offline   Reply With Quote
Old 28th March 2008, 07:24   #3
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
Greyscale

Ok, I think I figured out how to do a decent greyscale on the preset.
Attached Files
File Type: milk flying hamster - flower borders (version 2).milk (1.6 KB, 356 views)
flyinghamster is offline   Reply With Quote
Old 28th March 2008, 08:26   #4
Flexi
wellspring of milk
Major Dude
 
Flexi's Avatar
 
Join Date: Apr 2007
Location: 54.089866,12.11168,18.75
Posts: 2,058
Send a message via ICQ to Flexi
Re: First Post/Preset

well, zoom=((x*y)/(x*y)) equals 1 and does... nothing!
Flexi is offline   Reply With Quote
Old 28th March 2008, 09:16   #5
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
Oops

I'm not even sure what I was thinking in retrospect. Looks like I'm off to a good start

Anyway, it took a while, but I made my own beat code. I looked at some other beat codes and found them somewhat hard to decipher so I just started from scratch.

I hooked it up to the dx/dy, made the borders a little smaller, and took out obvious redundancies.
Attached Files
File Type: milk flying hamster - flower borders (version 3).milk (2.1 KB, 357 views)
flyinghamster is offline   Reply With Quote
Old 28th March 2008, 09:36   #6
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
Number 4!!!

Can you tell I am excited? After a reasonable amount of trial and error with absolute values, I managed to get the border shrinking to go at two distinct rates, based on the difference between the inner and outer border. I think I am getting the hang of the syntax of conditionals.
Attached Files
File Type: milk flying hamster - flower borders (version 4).milk (2.2 KB, 370 views)
flyinghamster is offline   Reply With Quote
Old 28th March 2008, 19:06   #7
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
Number 5

I messed with the center of rotation a bit, and added another layer of beats, and some other minor fixes, its looking better now.
Attached Files
File Type: milk flying hamster - flower borders (version 5).milk (2.5 KB, 388 views)
flyinghamster is offline   Reply With Quote
Old 20th April 2008, 06:28   #8
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
Sixth version

Changed a couple of things - wanted to add more but I will wait until the next version. Trying to figure out how to use the pixel shader.
Attached Files
File Type: milk flying hamster - flower borders (version 6).milk (2.5 KB, 372 views)
flyinghamster is offline   Reply With Quote
Old 20th April 2008, 09:13   #9
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
pixel shaders

After some tedious study, I think I have begun to comprehend HLSL language.

The seventh preset in this series uses nested linear interpolations, which are a lot more fun when you know what that means than when you don't.

It took me forever to figure out how text2D worked, and I still get caught up with the wrong datatype, but I am progressing...
Attached Files
File Type: milk flying hamster - flower borders (version 7).milk (2.8 KB, 351 views)
flyinghamster is offline   Reply With Quote
Old 20th April 2008, 20:27   #10
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 919
Re: pixel shaders

Not bad, flyinghamster. Keep it up, HLSL is no mystery after all.

Apart from HLSL and shader programming - which is fun- , one of the major challenges in milkdrop is to bring some rhythm in such that it fits the music. As far as I can see, what you did is to modulate such parameters as the border thickness.

Now this may be a question of personal style - but I feel this introduces odd jitter and lends a "trembling" appearance to the preset (while the overall movement is still controlled by sin(time). It just looks as though some rhythm was meant to be introduced, no matter how.
I struggled with this problem before, and finally found a solution acceptable to me, which in a similar form might work for your preset as well. I used it first in my "reflections on black tiles" preset. Not perfect but then rhythm detection is definitely difficult for a machine, particularly when only bass,mid and treb are available.
Nitorami is offline   Reply With Quote
Old 21st April 2008, 00:53   #11
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
thanks for your post nitorami, i was actually just in the bathroom a second ago thinking about how to most accurately capture the beats of songs - i wrote a pretty basic beat code but i think i need to go back and redo it from scratch.

in any case a solution to that problem will need to be continually evolving, as getting the right balance will be very difficult. i have some good ideas though i am going to go try out right now + i'm going to hook the beat up primarily to the shader. i'll post the results as soon as i am finished
flyinghamster is offline   Reply With Quote
Old 21st April 2008, 20:34   #12
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
Number 8

OK, I spent hours working on the beat code, and I was getting some weird values so I completely changed the syntax and double-assigned variables and i think i got something working ok... I also assigned the beat to modify the shader displacement instead of the border size so it isn't as shaky.

I have figured out how to determine the tempo roughly, but I haven't gotten to the point where I can apply that to the song appropriately. Let me know if you have any suggestions...
Attached Files
File Type: milk flying hamster - flower borders (version 8).milk (3.6 KB, 331 views)
flyinghamster is offline   Reply With Quote
Old 21st April 2008, 22:21   #13
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 919
Some thoughts

Hi Hamster

I've started to tinker with milkdrop a few months ago and learned a few lessons. Maybe this can be helpful.

Never use sin(time) for massive interventions such as controlling the overall brightness from zero to max. You may use it to slowly change zoom center, direction, rotation but not total luminance. It's unpleasant when the screen fades to black in the middle of the music for no other reason than sin(time)=0 accidentally.

Reliable beat detection is NOT possible, try as you might. Don't waste your time with it. The best thing you can probably do is to compare the overall volume - bass, mid, treb or some mixture or maximum of these (hardly matters anyway) - with some level which you adjust continuously. Many others have come to this solution, I coded my own because I found it easier than to grind through code of others but found similar code in Ryan Geiss' and other presets.
I repeat: Don't waste your time. You may find a code which works brillant for a piece of music, then you'll try it with another piece and your code will turn out to be total pig swill.

Once you've got a half decent beat signal, what can you do with it ? I swear it will be unreliable and will regularly fire when you least expect it - the best bet is to use it with care and only to trigger modest changes. It is also a good idea to feed it to a counter and then use the counter output, which will remain stable between two beats and make your preset steady without forcing you to use sin(time).

Your actual preset copies the past frame 1:1 - in the warp shader, basically ret = tex2D (sampler_main, uv). If you do this, you should be aware that things will change very slowly anyway, so why would you bother with beat detection ? If you want a smooth preset you don't necessarily need a beat in it - otherwise you should use more dynamic means of drawing such as waves and shapes, and reduce the feedback in the warp shader.

Finally, BEFORE you start to hate it - put it to one side and start something completely different. Just take another preset you like and play with it, this will be MUCH more efficient than trying to optimise the same preset over and over again. You'll be surprised how many ideas you'll find, and you can still come back later and bring fresh ideas into your original idea.
Nitorami is offline   Reply With Quote
Old 22nd April 2008, 09:03   #14
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
version nine

ok, I have made some aesthetic alterations and addressed a couple specific issues with this last version

the luminance issue had more to do with which variables I was using in the linear interpolations in the shader than the border color, so I just hooked the inputs together to make sure they would never both equal 0 or 1 and that solved the issue of periodic darkness, without having to remove sin(time) related commands

nito, i am not sure what you meant when you wrote that i should be aware of things moving slowly when using the shaders - i don't experience any kind of video lag when i return the previous frame through the shader and i notice beats just as easily, although i'm sure not everyone has a video card as good as mine... but i'm not going to exclude functionality for compatibility.

I would work on another preset, but this is really the only one that I am interested in right now, and in spite of the difficulty, I think I will continue to work on this beat code...
Attached Files
File Type: milk flying hamster - flower borders (version 9).milk (3.6 KB, 374 views)
flyinghamster is offline   Reply With Quote
Old 22nd April 2008, 11:52   #15
Flexi
wellspring of milk
Major Dude
 
Flexi's Avatar
 
Join Date: Apr 2007
Location: 54.089866,12.11168,18.75
Posts: 2,058
Send a message via ICQ to Flexi
even if it's some years old, the tutorial on milkdrop.co.uk is still worth a glance:
here's described a (admittedly very basic) beat detection code snippet

http://www.milkdrop.co.uk/guide.htm#presetwalk_tut4
Flexi is offline   Reply With Quote
Old 22nd April 2008, 17:32   #16
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 919
Hey, I didn't know this tutorial myself !

@flyinghamster:

ret = tex2D (sampler_main, uv) will just add the previous frames content additively to the newly drawn shapes, so the picture will be filled with more and more content, persisting for a long time until it all goes white. Therefore it is always a good idea to use a factor like ret = 0.99 * tex2D (sampler_main, uv).

It's different when you only use the borders for drawing. These are not drawn additively to the previous frame but rather replace it, therefore you won't get the slow colour build-up.
Nitorami is offline   Reply With Quote
Old 24th April 2008, 00:36   #17
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
i'm not really using ret = tex2D (sampler_main, uv) per se, i'm really using the interpolation (interpolated by "sampler_main, uv") of two mutually inverse interpolations between two color values (interpolated by adjusted uv values to include the beat-effect); i'm using the code:

float2 uv_post = uv + float2(0.005*(_qa.y+_qb.y),0.005*(_qa.z+_qb.y));
ret = lerp(lerp(float3(_qa.w,_qa.w,_qa.w),float3(_qb.x,_qb.x,_qb.x),tex2D(sampler_main, uv_post)),lerp(float3(_qb.x,_qb.x,_qb.x),float3(_qa.w,_qa.w,_qa.w),tex2D(sampler_main, uv_post)),tex2D(sampler_main, uv));

(qa.w and qb.x are the color-constraints, and qa.w+qb.x=10
(qa.y and qa.z are the bass and treble beats, and qb.y is the volume)


concerning beat detection:
the sample beat code in that link uses differences in attenuated bass as well as a threshold value - there are some things that I dont really understand about it though, like why random numbers are introduced through the sin function as part of the beat. for my beat code, I define the threshold in relation to the inverse of the determined tempo, which checks the difference in time since the last trigger and the current one and compares it to previous similar instances. There are a couple other aspects I am working on though, like trying to integrate the determined tempo more accurately into something besides the beat threshold.
flyinghamster is offline   Reply With Quote
Old 24th April 2008, 06:36   #18
Flexi
wellspring of milk
Major Dude
 
Flexi's Avatar
 
Join Date: Apr 2007
Location: 54.089866,12.11168,18.75
Posts: 2,058
Send a message via ICQ to Flexi
the random number isn't really part of the beat, they are only set on beats.
i never dealt very much with beat detection yet, but i'm curious about your results.
Flexi is offline   Reply With Quote
Old 24th April 2008, 10:06   #19
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 919
Quote:
Originally posted by flyinghamster
i'm not really using ret = tex2D (sampler_main, uv) per se, i'm really using the interpolation (interpolated by "sampler_main, uv") of two mutually inverse interpolations between two color values
Don't get warp- and comp shader confused. What you describe here is used in the composite shader, which is different because it has no own memory and purely works with the current frame.

As to the beat detection, I also did some experiments, amongst others using frequency dividers and phase-locked-loops, but just didn't manage to keep it synchronised for any reasonable amount of time. When it had synchronised, this was really impressive, but after a few seconds there was an interference from some off-beat event, and then the algorithm went bonkers, searching up and down for its synchronisation, quite disconcerting to watch. I gave it up in the end, but maybe I should dig it out again, now that I have more experience in milkdrop.
Well maybe you'll discover the trick.
Nitorami is offline   Reply With Quote
Old 23rd August 2008, 12:44   #20
flyinghamster
Junior Member
 
Join Date: Mar 2008
Posts: 13
long vacation

Hi everyone, I have been gone for the last 4-5 months, but beat detection has still been on my mind... has anyone come up with any insights into beat/tempo detection algorithms they would like to share?

Not asking for code, just any ideas.
flyinghamster is offline   Reply With Quote
Old 23rd August 2008, 23:47   #21
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 919
Yes. It does not work.
Nitorami 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