PDA

View Full Version : Computational Playlist Optimization


Chris Stratton
03-19-2008, 08:40 PM
Can anyone propose an algorithm for computationally optimizing a social playlist?

What I'd like to do is input a set of frequency coefficients, ie something like

W5 T4 V3 F5 Q4

And then have it randomly generate a list. That would be easy - just total, calculate an random number over that interval, assign anything in the first 5 to waltz, anything in the next 4 to tango, etc.

Except that it should also give some weight to how frequently that style was last played.

And it probably should not put Vw and Quickstep back to back.

I could do some kind of history decreases probability thing, but then it could still happen.

Or maybe I should just build in a "roll again" rule - roll again all the time if the dance was just played, and some fraction of the time if it was played recently - and half of that for Qs vs. Vw rather than themselves....

Or maybe some kind of genetic algorithm?

I wonder if a journal paper could be written by the end of the month...

tanya_the_dancer
03-19-2008, 09:24 PM
I would try something like this:

Assume you have your lists with their weights.

Initialization: all flags are at 0.

Step 1: Choose random list. Flag it with its weight. Choose random song from that list. Flag it, cannot choose it again until all songs in the list are flagged.

Start loop

Step 2: Choose next list from the ones that are not flagged yet. Flag it with its weight + 1. Choose song, flag it.

Step 3: Decrease all non-zero flags by 1.

End loop

If at some point you get a list and all songs in it are flagged, clear flags in that list.

In this model the dances you want to show up less frequently should have higher weight.

Do you want to write a paper on this? :)

tanya_the_dancer
03-19-2008, 09:30 PM
More suggestions:

If you do not want some dances show up back to back, if that list was chosen, and the other list is not flagged, so it may show up next, flag it as well with 2 (or how many dances you want to guarantee in between + 1), this way after the decrease its flag will be still positive and the list will not be considered on the next pass.

Also, consider adding "force" condition to some lists, i.e. if it did not show up for x dances, force it in.

Chris Stratton
03-19-2008, 09:34 PM
I'm a little confused. Were you proposing to list all the tracks with a desireability weighting? I had been trying to come up with something that would generate a list of dances, and then I'd manually fill in tracks for dances (basically I want to use personal preferences to choose music, but keep the numbers and sequence 'fair'). But maybe I could use your method instead, if I can fully figure it out.

Specifcally, I'm a bit confused about what does and doesn't get flagged during the setup phase.

What is the meaning of "list" in your system - is it the list of dances, the list of tracks, or an individual list of tracks for each dance?

BasicsFirst
03-19-2008, 09:44 PM
Here's what one guy does around here:
- always plays dances in pairs i.e. W,W,CC,CC,F,F,R,R etc.
- he also always alternates between Standard & Latin (works socially) but those of us who change shoes, not very good,
- he even has it down to the pause between like dances as being half of the pause between a switch in dances (a bit of overkill in my opinion) of if I recall 4 and 8 seconds respectively,

BasicsFirst
03-19-2008, 09:47 PM
ANOTHER guy does this:
- always play 3 of one style (Std or Ltn) and also in pairs which means you get six in row of Std and then six in row Ltn (I suppose less desirable socially) but he does always mix up the 3 dances being chosen each round;
- for me (perhaps as a competitive 10-dancer), I LIKE this format;

tanya_the_dancer
03-19-2008, 09:52 PM
I'm a little confused. Were you proposing to list all the tracks with a desireability weighting? I had been trying to come up with something that would generate a list of dances, and then I'd manually fill in tracks for dances (basically I want to use personal preferences to choose music, but keep the numbers and sequence 'fair'). But maybe I could use your method instead, if I can fully figure it out.

Specifcally, I'm a bit confused about what does and doesn't get flagged during the setup phase.

What is the meaning of "list" in your system - is it the list of dances, the list of tracks, or an individual list of tracks for each dance?

I thought you wanted a two-tiered list: list of types (waltz, quickstep, etc) and a list of songs within that type. But if you just want a set of tracks to fill out manually, you can just have a list of dance types. In this case you do not need to do the part about chosing a song from the list of songs for the dance type.

samina
03-19-2008, 09:57 PM
my instructor and his partner wrote a program that constructs playlists on-the-spot for practice or socials, depending on how many of each type of song you want. very handy. can adjust length, bpm, fade, spacing in between...

as to how they did that... tch... am clueless.

tanya_the_dancer
03-19-2008, 10:57 PM
Hey Chris, I tried my idea out in Excel, it seems to work OK, if you pm me with your e-mail I can send you the spreadsheet to play with.

Chris Stratton
03-19-2008, 11:26 PM
Sounds worth a try - and here I contemplating plugging the external drive containing C compiler into the laptop, because the build environment on my desktop is messed up...

Me
03-19-2008, 11:54 PM
Chris I think if you adapt the algorithm you already use to plan out your monthly wardrobe you should be fine.

:together:

hamstersphere
03-20-2008, 08:04 AM
Samina, if someone sold that program, I'd definitely buy it. :)

cornutt
03-20-2008, 02:07 PM
The other interesting way, although it would be a bit of work to set up and get tweaked properly, would be to use a directed graph. Say you choose a starting node and that node is quickstep. From there, the possible transitions to the next state could be rumba, waltz, or foxtrot. It randomly chooses one of the transitions. Then, say, the rumba node could have a transition that leads down a path where the next node is a cha-cha, and from there it could pick from a foxtrot or a samba or a bolero. If it picks, say the bolero, the next dance might be VW, and so forth. I believe this might more closely duplicate the way that DJ's think of songs when they are putting sets together. I might try to draw such a graph if I can find the time.

tanya_the_dancer
03-20-2008, 02:38 PM
The other interesting way, although it would be a bit of work to set up and get tweaked properly, would be to use a directed graph. Say you choose a starting node and that node is quickstep. From there, the possible transitions to the next state could be rumba, waltz, or foxtrot. It randomly chooses one of the transitions. Then, say, the rumba node could have a transition that leads down a path where the next node is a cha-cha, and from there it could pick from a foxtrot or a samba or a bolero. If it picks, say the bolero, the next dance might be VW, and so forth. I believe this might more closely duplicate the way that DJ's think of songs when they are putting sets together. I might try to draw such a graph if I can find the time.

That process should have a certain logic in it so that you don't get a path which gets "heavy" in one style. I.e. if your rumba node has possible transitions to chacha or foxtrot and your chacha node has a possible transition to rumba or waltz, you want to prevent a situation when you have rumba-chacha-rumba, while still allowing for them to follow one another as a pair. So in other words, your transitions should be path dependent.

I tried to implement back-to-back conditions as a matrix (i.e. viennese cannot be back-to-back with quickstep or samba), but that still requires some tweaking.

Chris Stratton
03-20-2008, 03:06 PM
I think maybe cornutts path graph could be implemented with something like Tanya's dwindling flags on the transition paths - ie, a base weight for going from this dance to the next, combined with a variable one based on how much that possible dance has been used lately overall.

Chris Stratton
03-20-2008, 03:07 PM
When we get tired of this, we can do it for figure precedes and follows ;-)

nucat78
03-20-2008, 03:24 PM
Dude.

Go to your favorite bar. Tell the waitperson you want a Mojito every twenty minutes until you fall off your chair. Then tell them you want one every ten minutes. You'll be optimized.

Kitty
03-20-2008, 03:49 PM
woooow
invoooolved


if you are only running a social one or two times within the next 12 months,
you could just pick 6 favourite waltzes, 5T, 5F, 4Q, 3Vw, 5CH, 6R, 4Sa, 4Swing etc, and then mix them at home and burn 3 cds.

2nd time you organize a social - play cds in a different order

wooh
03-20-2008, 04:04 PM
Yeah, I don't think anything can substitute for an actual person paying attention to what the people like to hear. Maybe not a "live" dj changing the music at the time. But a person paying attention and making a mental note of what kinds of songs people like and using that knowledge when they burn a few mix CDs.
(Imagining Chris Stratton as a wayward 80s teenager, making a mix tape of REO Speedwagon songs for his true love, computing it all out on a Commodore 64.:) Come to think of it, that's what's wrong with kids today. They never made their mix tapes by waiting for the radio station to play their song so they could record it on their boombox before waiting for their next song so they could record that! And the pain of waiting for them all to play so they can get on the tape in the perfect order! Ohhhh, those were the days!!)

Chris Stratton
03-20-2008, 04:22 PM
if you are only running a social one or two times within the next 12 months,
you could just pick 6 favourite waltzes, 5T, 5F, 4Q, 3Vw, 5CH, 6R, 4Sa, 4Swing etc, and then mix them at home and burn 3 cds.

2nd time you organize a social - play cds in a different order

That's basically what I'm doing - making a set of party CD's.

I thought it would be fun to come up with a program that would assign an order so there's a desired number of each dance, but the order is somewhat random, only without unfortunate combinations such as Vw->Quickstep. I was going to select the actual tracks by hand - just have the computer say "and then pick a waltz"

Yes, a system like this could be used to pick the music in real time, though that's not really what I was trying to accomplish at the moment.

tanya_the_dancer
03-20-2008, 04:28 PM
OK, I figured out how to handle back-to-back constraints as a matrix. Anyone wants version 2 of Tanya's Track Generator?

Chris Stratton
03-20-2008, 04:36 PM
Sure

Chris Stratton
03-20-2008, 04:38 PM
Chris I think if you adapt the algorithm you already use to plan out your monthly wardrobe you should be fine.

"And - and - and YOUR COMPUTER DRESSES YOU FUNNY!!!!"

tunape
03-20-2008, 04:41 PM
sounds like the fundamental problem is a lack of output measure. That is, if input is the playlist, and output is, say, "energy" level of the floor, then we can start talking about algorithms to perfectly match inputs and outpus. Without an objective metric, we can theorize all we want - Chris, you're sounding less like an MIT number cruncher, and more like that other school down the road. ;p

It's like creating a recommendation system - NetFlix has a USD $1 M(granted, it's not that much anymore) prize for creating the perfect(better) recommendation system.

There's also a number of research on group voting systems(MIT Media Lab has a few where you broadcast your music preferences, and the room picks up the party's aggregate preferences to play something).

Chris Stratton
03-20-2008, 04:54 PM
I'm not necessarily proposing a system without feedback, but it's not a continuous feedback process. Instead:

- "That doesn't look right" while examinging the program output

- That {really / kinda / sorta / totally didn't} worked after using the CD at an event

tunape
03-20-2008, 05:01 PM
I'm not necessarily proposing a system without feedback, but it's not a continuous feedback process. Instead:

- "That doesn't look right" while examinging the program output

- That {really / kinda / sorta / totally didn't} worked after using the CD at an event

But every event is going to be different if there were no overlap of attendees. A genetic algorithm might be best here since it can evolve to better fit a particular studio's party where there is some a high overlap of attendees from one party to the next.

Even so, there will be variances from party to part - say between ratio of latin and standard people as a simple case. Furthermore, it's not clear whether people want to hear constantly the "best" stuff which they have learned to like in the past, or have a higher propensity for "discovery" of new stuff. This is the distinguishing factor between good and bad human DJ's, no?

I guess one metric for "energy" level for social might be the slight temperature fluctuations of the room. of course, this depends a lot on HVAC, human/volume ratio, age group, etc... Or possible image processing of video. I'm just not seeing a good objective measure that can ideally be picked up by sensors.

Chris Stratton
03-20-2008, 05:18 PM
But every event is going to be different if there were no overlap of attendees.

I'm not trying to solve the general problem, I'm trying to solve a highly specific one.

Joe
03-21-2008, 06:46 AM
You would need to assign a speed parameter to each dance to avoid back-to-back undesireables like your Q/VW example, because you similarly do not want a J/Q combo.

kimV6
03-21-2008, 10:01 AM
Come to think of it, that's what's wrong with kids today. They never made their mix tapes by waiting for the radio station to play their song so they could record it on their boombox before waiting for their next song so they could record that! And the pain of waiting for them all to play so they can get on the tape in the perfect order! Ohhhh, those were the days!!)

hey, i spent plenty of time sitting in front of my receiver + tape deck waiting for songs to come on the radio. then again, my dad's an audiophile, and i'm pretty sure my kid card has been revoked haha.

my thought would be to weight the BPM like Joe alluded to so that the average of two songs could not reach a certain point (so the average between a rumba and a VW would be acceptable, but not a jive and quickstep). also, i prefer mixing standard, latin, and social dances when making a playlist, so i liked Cornutt's idea of pathing. my thought on that was to weight standard vs. latin (something simple, like making every standard song value 1, and latin value 0, and having the computer minimize back-to-back of values). all i know is having an algorithm would be great; every time i make a social playlist, it takes me a whole day to get right.

Joe
03-22-2008, 09:34 AM
With practice, you can knock it down considerably. ;)

Me
03-22-2008, 11:17 AM
"And - and - and YOUR COMPUTER DRESSES YOU FUNNY!!!!"


LOL!!! :o