Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Waveform encoding details from Engine Library Format wiki page #14194

Open
david-res opened this issue Jan 19, 2025 · 12 comments
Open

Missing Waveform encoding details from Engine Library Format wiki page #14194

david-res opened this issue Jan 19, 2025 · 12 comments

Comments

@david-res
Copy link

david-res commented Jan 19, 2025

I'm building a custom standalone media player based on an imxrt1062 and want to use Mixxx as my playlist source

The only way to load the tracks + metadata is to export to Prime Engine OS db.
I specifically need to understand how the waveform data is formatted/encoded?

For example, in Rekordbox track waveform data, each second of a track is split into 75 frames, each frame holds a 2 byte payload of the line color format(9 bits) and the line length(5 bits) - https://djl-analysis.deepsymmetry.org/rekordbox-export-analysis/anlz.html#color-detail

Is there something available for Engine OS as well?
if someone can point me to the export code, specifically that of the waveform section - I could have a go at it myself

@JoergAtGithub
Copy link
Member

We use https://github.com/xsco/libdjinterop for this. Best to look in the sources there.

@david-res
Copy link
Author

@JoergAtGithub thanks!

For some reason, the m.db file in the Engine export is missing the highResolutionWaveFormData column and data

Image

I used the following query to validate
SELECT highResolutionWaveFormData FROM 'PerformanceData' WHERE trackId = 1 ;

Attached is the export file

Engine Lib Export.zip

@david-res
Copy link
Author

After looking at the libdjinterop code amd some experimenting with the Export Engine version options
I found that the high res waveform is only available in p.db/m.db until version 2.0
Anything above does not include it as the waveform analysis is done in realtime on device when a track is loaded (?)

@Swiftb0y
Copy link
Member

Anything above does not include it as the waveform analysis is done in realtime on device when a track is loaded (?)

I vaguely remember @mr-smidge mentioning something like that.

@david-res
Copy link
Author

david-res commented Jan 24, 2025

Anything above does not include it as the waveform analysis is done in realtime on device when a track is loaded (?)

I vaguely remember @mr-smidge mentioning something like that.

Yep, it’s commented in the code!

Now I need to figure out how the data is packed.
Seems like there is a byte per band. 4 bits are the length, 4 bits are the opacity? Saw this from a glimps

@mr-smidge
Copy link
Contributor

mr-smidge commented Jan 24, 2025

Hi @david-res , indeed the high-resolution waveform was removed from Engine 2.x onwards, and it's thereafter derived on-the-fly on hardware players.

You can see the encoding/decoding code for the overview waveform in libdjinterop here if you are curious on the exact format: https://github.com/xsco/libdjinterop/blob/main/src/djinterop/engine/v2/overview_waveform_data_blob.cpp

Note that the overview waveform always has exactly 1024 entries.

@mr-smidge
Copy link
Contributor

Also @david-res , I'm assuming you're referring to https://github.com/mixxxdj/mixxx/wiki/Engine%20Library%20format when you talk about the wiki page missing encoding details?

I don't think anyone maintains that wiki page anymore - I wrote an initial version to help me before I had written libdjinterop, but after that point the code became the authoritative source of my understanding of the schema. If anywhere, perhaps a plain-English explanation ought to become part of the libdjinterop project instead and evolve with the codebase.

@mr-smidge
Copy link
Contributor

Btw, if you plan to write a media player that reads the Engine Library format, if you're writing in C++ then perhaps consider libdjinterop as your library of choice for loading the Engine database? It would save you having to decode things yourself!

@david-res
Copy link
Author

Hi @david-res , indeed the high-resolution waveform was removed from Engine 2.x onwards, and it's thereafter derived on-the-fly on hardware players.

You can see the encoding/decoding code for the overview waveform in libdjinterop here if you are curious on the exact format: https://github.com/xsco/libdjinterop/blob/main/src/djinterop/engine/v2/overview_waveform_data_blob.cpp

Note that the overview waveform always has exactly 1024 entries.

Hi @mr-smidge
Thank you for confirming this information!
I saw that the overview waveform 1024 points in the codebase as well

Also @david-res , I'm assuming you're referring to https://github.com/mixxxdj/mixxx/wiki/Engine%20Library%20format when you talk about the wiki page missing encoding details?

I don't think anyone maintains that wiki page anymore - I wrote an initial version to help me before I had written libdjinterop, but after that point the code became the authoritative source of my understanding of the schema. If anywhere, perhaps a plain-English explanation ought to become part of the libdjinterop project instead and evolve with the codebase.

Yeah I was using that as my starting point, while it seems outdated, as it was last updated in 2022, it was still very helpful to me!

Btw, if you plan to write a media player that reads the Engine Library format, if you're writing in C++ then perhaps consider libdjinterop as your library of choice for loading the Engine database? It would save you having to decode things yourself!

Im actually building a standalone media player using an old CDJ 1000 MK1, a custom Teesny 4.x with SDRAM, an 800*480px LCD and some other bits and bobs

So far I have decoded the SPI communication for the CDJ control panel, replaced the jog wheel VDF display with a 2nd smaller LCD display and now I am at the part where I want to load the metadata in

I have written my algorithm and sequence to scan a selected WAV file on the SD card an analyze it to extract a Loudness+RMS waveform, and used Beat-and-Tempo-Tracking library to detect the BPM.
But this is a bit time consuming (around 15 seconds for a 3 minute track) and so I decided to use Mixxx as the analysis source, and thus here I am.

I'm not sure I would be able to make a full implementation of libdjinterop as I need to use an embedded downsized version of zlib and sqlite3 (been challanging but with the help of a friend got it working)
But I am defiantly taking much inspiration from Mixxx and libdjinterop for my project!

@mr-smidge
Copy link
Contributor

Im actually building a standalone media player using an old CDJ 1000 MK1, a custom Teesny 4.x with SDRAM, an 800*480px LCD and some other bits and bobs

This sounds really cool 😎 !

@david-res
Copy link
Author

This sounds really cool 😎 !

Thanks!

Is there a place I could pick your brain on some things?
For example, in the high res detailed waveform(and the overview too), what scale do I use to reference a line?

On the CDJs/Rekordbox the split each second up into 75 frames.

@mr-smidge
Copy link
Contributor

Is there a place I could pick your brain on some things?

@david-res - Please feel free to send me an email - if you clone the repo, you'll find my address in the commit logs if it's not visible on GitHub 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants