Before I start I should add I am a musician and not a native programmer, this was undertook to make my life easier.
Here is the situation, at work I'm given a new csv file each which contains a list of sound files, their length, and the minimum total amount of time they must be played.
I create a playlist of exactly 60 minutes, from this excel file.
Each sample played the by the minimum number of instances, but spread out from each other; so there will never be a period where for where one sound is played twice in a row or in close proximity to itself.
Secondly, if the minimum instances of each song has been used, and there is still time with in the 60 min, it needs to fill the remaining time using sounds till 60 minutes is reached, while adhering to above.
The smallest duration possible is 15 seconds, and then multiples of 15 seconds.
Here is what I came up with in python and the problems I'm having with it, and as one user said its buggy due to the random library used in it.
So I'm guessing a total rethink is on the table, here is where I need your help.
Whats is the best way to solve the issue, I have had a brief look at things like knapsack and bin packing algorithms, while both are relevant neither are appropriate and maybe a bit beyond me.