Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_auto_dj (Read 38889 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_auto_dj

Reply #25
The new version crashes even on analyzing single track.
Regards.

foo_auto_dj

Reply #26
The new version crashes even on analyzing single track.

Finally found and fixed not only the crashes, but the cause: When installing the component to the user directory, the OpenCL sourcecode file could no longer be found. It is now embedded in the dll.
Get it here: foo_auto_dj_0.9.4.zip.

foo_auto_dj

Reply #27
Yes, it finally works. But the BPM walues are wrong?
Code: [Select]
Loaded 6993k samples * 2 channels.
Channel[0] kernel took 3s. (541 GFLOP/s, 54 GB/s).
Channel[1] kernel took 3s. (542 GFLOP/s, 54 GB/s).
dB(ISO226) = -13.3818760 -> ReplayGain = -8.5807133
bpm[0] = 19.1651611 -[x6]-> 114.9909666 (-77.1875548)
bpm[1] = 114.9863102 (-77.1875548)
σ = 21595.8365092, max = 179166.1093750 = 8.2963264σ
Moments = 0.3270631, 0.1060129, 1.4457623, 5.2048976, 19.1275056, 466380154.5339364, 3.7956916, 148.1553680,
BPM[0] = 114.9786322 = 1.0000000 * bpm[0] -> 114.9786322
BPM[0] = 114.9786322 = 1.0000000 * bpm[1] -> 114.9786322
Looks like Dance: BPM = 229.9580995

Total time: 31s (10 x realtime)

According to VirtualDJ this track has 115BPM.
Regards.

foo_auto_dj

Reply #28
Since bpm[0] and bpm[1] are both half of the 'dance' estimate, I can add a rule which will correct this and similar cases.
If you know that your tracks have a limited BPM range, enter the median BPM (or geometric mean) in the options and enable "always choose closest to median". This will double or half the result appropriately. E.g. with median = 130, all results will lie between ~210 and ~80.

Here are a few examples of how the BPM detection works:
The most time consuming task is creation of a spectrogram of the entire track, which is also used for replay gain estimation.
The autocorrelation of the raw PCM signal is done at the same time on the GPU, so it's practically free.
It goes from very easy to pretty difficulty:



A very fast track, with a very clear 240 BPM. Normalizing this one to 120 BPM would be wrong.


Techno with 138 BPM. This is the threshold where there are no longer 100% correct answers, as we go from pure beat detection to "rhythm detection".


Still dance, but with some guitar parts. This is already a pretty tough call, and kinda subjective. The lyrics are at 85 BPM, but the strongest beat is at 170.


Girlfriend from Avril Lavigne. Pop music is usually in 4/4 meter, so the best BPM estimate is 4 * fundamental = 164 BPM.


Sk8er Boi from Avril Lavigne. Pop-Punk-Rock; very hard to decide between 75 and 150 BPM.


Power Metal with 200 BPM, but 100 or even 400 are not absolutely wrong - pretty much all the same.

Maybe I'll add a window or UI component to display this and other stuff, to aid in generating rules to get the correct BPM, or simply for visualization.
The moments of these functions, i.e. mean, variance, skewness and kurtosis, should make for a good similarity measure between all kind of tracks and genres.
Unfortunately, I got a few things wrong, so the next version will calculate new moments. ><

foo_auto_dj

Reply #29
0.9.5 gives me the same BPM:
Code: [Select]
file://C:\07-royksopp-what_else_is_there.mp3
Loaded 6993k samples * 2 channels.
Channel[0] kernel took 3s. (540 GFLOP/s, 54 GB/s).
Channel[1] kernel took 3s. (541 GFLOP/s, 54 GB/s).
dB(ISO226) = -13.3818760 -> ReplayGain = -8.5807133
bpm[0] = 57.4962848 -[x4]-> 229.9851391 (-68.5242509)
bpm[1] = 229.3119739 (-68.5242509)
σ = 0.0251324, max = 0.2085064 = 8.2963264σ
Moments = 0.1635099, 0.0027788, 6.0836700, 84.2306887, 0.0000223, 0.0006316, 3.7956916, 148.1553680,
BPM[1] = 19.1623671 = 0.0833333 * bpm[0] -> 229.9484047
BPM[1] = 19.1623671 = 0.0833333 * bpm[1] -> 229.9484047
Looks like Dance: BPM = 229.9580995

Failed:Sharing violation

And small issue - if the track is playing plugin cannot update the tags. I suppose it should do it (atleast foobar itself can update tags).
Regards.

foo_auto_dj

Reply #30
What are BPM[0] and BPM[1] and why does the plugin select the first value in full mode and the second one in light mode?

Code: [Select]
file://C:\Users\Elenhil\Music\300\01 - To Victory.flac
Loaded 3411k samples * 2 channels.
Channel[0] kernel took 2s. (346 GFLOP/s, 35 GB/s).
Channel[1] kernel took 2s. (347 GFLOP/s, 35 GB/s).
dB(ISO226) = -17.1026917 -> ReplayGain = -4.8598976
bpm[0] = 20.0034139 -[x4]-> 80.0136558 (-81.6472195)
bpm[1] = 140.4535746 (-133.0145831)
σ = 6230.2618556, max = 52486.2031250 = 8.4243976σ
Moments = 0.0638778, 0.0044562, 2.4007020, 11.7108559, 3.3358612, 38816162.7896339, 3.5127242, 106.0273694,
BPM[0] = 20.0001613 = 0.2500000 * bpm[0] -> 80.0006451
BPM[1] = 181.1006405
Looks like Pop: BPM = 80.0006451

Total time: 7s (23 x realtime)



Code: [Select]
file://C:\Users\Elenhil\Music\300\01 - To Victory.flac
Loaded 3411k samples * 2 channels.
dB(ISO226) = -17.1026917 -> ReplayGain = -4.8598976
bpm[0] = 20.0034136 -[x4]-> 80.0136542 (-81.6465608)
bpm[1] = 140.4535761 (-133.0138938)

Total time: 7s (23 x realtime)



foo_auto_dj

Reply #31
After the above diagrams are calculated, a few peaks are selected and compared with each other, trying to find the best value.
This is still a work in progress, and while rules are added or simplified, it's possible that one track gets fixed but others become wrong.
bpm[0] and bpm[1] are based on the spectrogram (the red line), which is transformed once more, to remove the bias.
bpm[0] is the first significant multiple of the fundamental peak.
bpm[1] is the first significant peak. bpm_dance is an alternate first peak. The value in brackets, .e.g. (-81.6472195) is the height of the peak and is taken into account when in doubt.
Both are influenced by the median BPM setting in the options: a higher value will lower the threshold for selecting the peaks, increasing the chance to pick a higher BPM peak.
BPM[0] and BPM[1] and BPM_DANCE are similarly based on the raw signal (the blue line) and are not available in light mode.

So light mode and median BPM setting will influence the results as well as the peak finding algorithm which can change from version to version.

foo_auto_dj

Reply #32
Well it crashes alot. Haven't got it to analyze one single file yet in either normal nor light mode.

Didn't try it out much yet. Still need to understand the concept really.

Where does it save analysed information - In tags or it's own database?

Since you seem to have a beatmixing DSP on your todo-list (which would be totally awesome), have you considered making a pitch-analyser as well, to create harmonic playlists easily?
Can't wait for a HD-AAC encoder :P

foo_auto_dj

Reply #33
Well it crashes alot. Haven't got it to analyze one single file yet in either normal nor light mode.

Didn't try it out much yet. Still need to understand the concept really.

Where does it save analysed information - In tags or it's own database?

Since you seem to have a beatmixing DSP on your todo-list (which would be totally awesome), have you considered making a pitch-analyser as well, to create harmonic playlists easily?

Can you send me the crash log? In fact just the version and crash location is usually enough.

It saves the BPM to the %BPM% tag. And the supposed similarity information to the %MOMENTS% tag.
The ReplayGain is stored the usual way and is compatible to the original ReplayGain.

Everything else is kept in a runtime database, like 60 recent titles and 20 recent artists, which are banned. If you have artists which should never be banned, you can enter them in advanced config.
To filter out different versions of the same track, the titles must match up exactly, so I try to move the cover/version information into a %VERSION% tag, and use custom titleformatting to display it.

I'm not sure what you mean with harmonic playlists. Like, a song with high pitched lyrics followed by a similar song, etc.?

The thing, is I'm not really into DJing, more into signal analysis.
So I'm not sure how to do beatmixing properly. If we speed up or slow down a track, the pitch will change slightly. I suppose that's ok? Then how (when) do we actually return to the correct speed?
I'll probably do a more simple initial or alternate version which will approximately match up the beats without changing the speed, and to sort out even more fundamental stuff, like some tracks already fading out "naturally", while others ending abruptly. Making transitions of approx. the same length and with constant loudness should be possible, but it might be boring? Should there be some alternatives, like hard cuts? Also some tracks, like very long ones, might benefit from an "end after xx:xx" hint (tag).

foo_auto_dj

Reply #34
I'm not sure what you mean with harmonic playlists. Like, a song with high pitched lyrics followed by a similar song, etc.?

More likely key detection. So you could create playlists with same and related keys. I'm guessing, but that's potentially quite handy if it can be done well.

C.

ps. I had a look at the spreadsheet, but it was hard to understand quite what it's doing (without any idea as to its particular aims). Can you, outline in general terms what the approach is. For example, hotness tries to tell you which tracks are currently big hits with you, DAR attempts to rate tracks on a level playing field negating such factors as track age and track duration. What is Auto DJ doing?
PC = TAK + LossyWAV  ::  Portable = Opus (130)

foo_auto_dj

Reply #35
I'm not sure what you mean with harmonic playlists. Like, a song with high pitched lyrics followed by a similar song, etc.?

More likely key detection. So you could create playlists with same and related keys. I'm guessing, but that's potentially quite handy if it can be done well.

C.

ps. I had a look at the spreadsheet, but it was hard to understand quite what it's doing (without any idea as to its particular aims). Can you, outline in general terms what the approach is. For example, hotness tries to tell you which tracks are currently big hits with you, DAR attempts to rate tracks on a level playing field negating such factors as track age and track duration. What is Auto DJ doing?

It's like the reverse. It'll not rate tracks by how they are played but play them by their rating and other data.
The priority in the spreadsheet shows the evolution of how likely a track is to be added to the auto playlist after it was last played. The actual probability is priority / sum of all priorities.
Higher rated tracks as well as new tracks have a shorter cool down time and higher limit probability. Also tracks are unlikely to be played at exactly the same time of day as before.

I've taken a look at the wikipedia articles on Harmonic mixing and Beatmatching. Looks like you're supposed to change the speed independent of the pitch. Ah, difficult. Is there a good free algorithm which can do that? As for the key detection; it would be easy if you already have the tags, but finding the dominant key looks like quite the challenge.

foo_auto_dj

Reply #36
but finding the dominant key looks like quite the challenge.

I think so.

So, when you're talking about rating, are you talking about the rating that people have manually applied to their songs? Like 4 stars?

C.
PC = TAK + LossyWAV  ::  Portable = Opus (130)


foo_auto_dj

Reply #38
I'm not sure what you mean with harmonic playlists. Like, a song with high pitched lyrics followed by a similar song, etc.?

If you do key-detection, you will find that songs with the same (or compatible) key usually fits "harmonically" together.

There are some great examples here.

So I'm not sure how to do beatmixing properly. If we speed up or slow down a track, the pitch will change slightly. I suppose that's ok? Then how (when) do we actually return to the correct speed?


From a programming perspective that's probably where things get complicated. There are tools that allows speed-change without pitch-shift, but they vary much in quality. zplane has some libraries available that should do it for you, but they'll probably cost you. They also have a tool for key detection.

You could also take a look at Mixmeister to see how they line up things. It automatically finds the best overlapping of tracks and does a smooth transition of tempo-change through the transition and revert to the initial tempo outside of the transition.
Can't wait for a HD-AAC encoder :P

foo_auto_dj

Reply #39
You could take a look at this project also:
http://www.sonicvisualiser.org/
http://www.sonicvisualiser.org/features.html

Quote
# Run feature-extraction plugins to calculate annotations automatically, using algorithms such as beat trackers, pitch detectors and so on.
...
# Time-stretch playback, slowing right down or speeding up to a tiny fraction or huge multiple of the original speed while retaining a synchronised display.

Distributed under the GNU General Public License (v2 or later) and available for Linux, OS/X, and Windows.

C.
PC = TAK + LossyWAV  ::  Portable = Opus (130)

foo_auto_dj

Reply #40
Code: [Select]
file://C:\Users\Elenhil\Music\Alan Stivell\1971 - Renaissance Of The Celtic Harp\05 - Gaeltacht.flac
Loaded 24975k samples * 2 channels.

Failed:bad allocation

foo_auto_dj

Reply #41
Not sure if it's a bug or feature. I've configured foobar to continue playback of tracks after restart. But if I restart foobar a track it gets removed from the autodj list and playback goes to the next track. I think it should contiune the last played track. (autodj 0.9.9)
Regards.

foo_auto_dj

Reply #42
Not sure if it's a bug or feature. I've configured foobar to continue playback of tracks after restart. But if I restart foobar a track it gets removed from the autodj list and playback goes to the next track. I think it should contiune the last played track. (autodj 0.9.9)

The track was removed on shutdown because it was stopped, but the funny thing is that foobar still saved the playtime and later "continued" playing the next song from this time on. Will be fixed in the next version.


foo_auto_dj

Reply #44
the features sound impressive!

unfortunately foobar stucks every time trying to dragndrop an mp3-file to any playlist.
this happens straight after installing the component and creating 3 playlists, called AutoPlaylist, Pool Alternative, Pool Electronic

this is my console's view

Warning sscanf = 0
.Warning sscanf = 0
.playlist[6] = "New 201010"
playlist[7] = "New 201011"
playlist[8] = "New 201012"
playlist[14] = "Auto"
Warning sscanf = 0
.Warning sscanf = 0
.
Pool update: ptr_diff = 240, nodes = 5, items = 782
max. age in "new" pool: 14963 days
Startup time : 0:03.378734
AutoDJ: No more tracks with non-zero priority!

working without "new"-playlists, didnt change anything. when adding songs, foobar hangs in processing-files-window and foobar2000.exe-process has to be stopped.
i'm going to test around again tomorrow, but any help would be helpful!

anyway, nice component, keep goin!

greetz, dls

foo_auto_dj

Reply #45
the troubles i had yesterday  have been on my win7-machine with foobar 1.1.1.
was trying the component on another pc with windows xp & foobar2000 1.1.1 installed...
under these conditions foobar doesnt load the component and says...
...this component is missing a required dependency, or was made for different version...
but it seems, this is because of missing opencl compatible cpu...

foo_auto_dj

Reply #46
Here's the new (and probably final) version 1.0.

@delusion:
The lock-ups should be gone, but you have to put the relative priority in the playlist name, like: "Pool 10 Alternative", "Pool 15 Electronic", "New 100". I guess it's kind of ugly and non-intuitive.
The "New" playlist only modifies the entries of existing pools by their age, so a single one should usually be enough.
There's now a context menu command for creating a number of example playlists, to be used as a starting point after installation.

It doesn't look like I'll make the beatmixing dsp component, but here's my preferred crossfading setup, using Continuator:






foo_auto_dj

Reply #48
I have just tried 1.0 and it still causes a full system lockup when I run analyse.

I'm unable to save a screenshot, or any debug info as it locks up.

Here are the system specs:
http://imgur.com/X3fSk

And the foobar report:
http://pastebin.com/EQEJMaYP

Does the "light mode" work, or very short tracks?
Your GPU can probably not process average length tracks in under two seconds. In that case Windows will (try to) reset the display driver: WDDM Timeout.
You can increase that limit with registry keys. I've set it to 60s, to be able to run more complex kernels.

foo_auto_dj

Reply #49
Does the "light mode" work, or very short tracks?
Your GPU can probably not process average length tracks in under two seconds. In that case Windows will (try to) reset the display driver: WDDM Timeout.
You can increase that limit with registry keys. I've set it to 60s, to be able to run more complex kernels.

Light mode works, but GPU doesn't. Even in CPU only mode, the sound stutters while the CPU is processing foo_auto_dj.

I noticed when in GPU mode that Bandwidth and clock speed are coming up as 0 GB/s and 0 MHz respectively.

Has anyone successfully managed to use an ATI card rather than an nVidia card?