Comments (5)
The code should still work for your local files. What error do you get? I did rewrite the code for generating playlists more efficiently but that is in the deej-ai.online-app project which is linked to Spotify as you say. There is a more efficient way of generating the vectors using the calc_mp3tovecs and calc_tfidf scripts in the train directory. They were written with Spotify preview mp3s in mind, but will work with any (flat) directory of mp3s (MP3ToVec.py will work with nested directories).
from deej-ai.
Not getting any error so far, other than the CLI not accepting "foreign" tracks when the web tool does. I was just looking to re-use part of the integration work that you did for Spotify :)
I'll give it a go, maybe it's easier than expected ^^
from deej-ai.
I'm not sure I understand. Can you give a more detailed example of what you are trying to do and what you mean by CLI / web tool in this context? Thanks!
from deej-ai.
Sure!
As described in the readme, I ran the following command: python MP3ToVec.py Pickles mp3tovec --scan c:/your_music_library
(with an updated path of course). Now I can start the web tool by running python Deej-A.I.py Pickles mp3tovec
.
At the top, there's an area where I can simply drag-and-drop an mp3 file, and it will generate a mix based on that song. That can be any mp3.
However, I'm trying to generate m3u playlists instead, because this allows me to use the created mix in Jellyfin. Therefore, I'm running the command python Deej-A.I.py Pickles mp3tovec --playlist playlist_outfile.m3u --inputsong startingsong.mp3
.
The problem seems to be that "startingsong.mp3" has to be in the existing keys, because if I use a path that was not within the scanned directory from the first command, I get the following error:
nsongs 10
36 MP3s
Outfile playlist: playlist_outfile.m3u
Input song selected: C:\Users\Chaphasilor\Desktop\test.mp3
Requested 10 songs
Traceback (most recent call last):
File "C:\Users\Chaphasilor\Code\Deej-AI\Deej-A.I.py", line 491, in <module>
tracks = make_playlist([input_song], size=n_songs + 1, noise=noise, lookback=lookback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Chaphasilor\Code\Deej-AI\Deej-A.I.py", line 208, in make_playlist
similar = most_similar(positive=playlist[-lookback:], topn=max_tries, noise=noise)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Chaphasilor\Code\Deej-AI\Deej-A.I.py", line 179, in most_similar
mp3_vec_i = np.sum([mp3tovec[i] for i in positive] + [-mp3tovec[i] for i in negative], axis=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Chaphasilor\Code\Deej-AI\Deej-A.I.py", line 179, in <listcomp>
~~~~~~~~^^^
KeyError: 'C:\\Users\\Chaphasilor\\Desktop\\test.mp3
If I use a path from C:\\your-music-library\
, it all works fine.
As for what I'm trying to do, in the end:
- Pass the Jellyfin ID of any song to Deej-AI
- Have Deej-AI analyze the song and generate a playlist of similar tracks from my library
- Output the Jellyfin IDs of all songs in the playlists, so that I can add them to the queue
That means I need to:
- generate the waveforms/vectors based on my entire library
- pass the Jellyfin ID to Deej-AI
- have Deej-AI output a list of Jellyfin IDs
Given that you've done something very similar for Spotify (plus the whole downloading previews part), I was wondering if there was a way to build on top of the Spotify stuff, or if I would need to implement my own solution that translates Jellyfin IDs to file paths, passes that to Deej-AI, and then translates the resulting file paths from the playlist file back to Jellyfin IDs. But that would be cumbersome, that's why I would like to use Jellyfin IDs all the way through, just like you did with Spotify IDs (I assume).
from deej-ai.
Sorry for the delay.
Yes, the JoinTheDots.py script is expecting you to give it an already analyzed mp3, and the only way of knowing that is to pass the "key". The DeejAI.py script that runs the Flask webapp has some extra code which analyzes any mp3 track on the fly and then builds the playlist based on this, so you could take this code. But, as I say, these scripts are a bit old and clunky. If you are going to do anything at all serious, I would take inspiration from the train/calc_mp3tovecs.py, train/calc_tfidf.py and deej-ai.online/backend/deejai.py scripts. You would need to use the first two to pre-calculate the vectors for your entire library and you could adapt the functions to analyze a track and create playlists etc from the latter. I regret not having made the deejai.py code a bit more modular by separating out the Spotify dependencies, but I haven't really had the time to do that.
Good luck!
from deej-ai.
Related Issues (20)
- Is there a way to link a Spotify account with this? HOT 1
- Mp3ToVec Skips my MP3s HOT 2
- Unable to run MP3ToVec.py HOT 3
- Unable to install requirements on Windows HOT 1
- Amazing results! HOT 1
- Getting ValueError: Unknown loss function: cosine_proximity. Please ensure this object is passed to the `custom_objects` argument. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details. when trying to run HOT 3
- Suggestion for data source: lastfm or listenbrainz HOT 1
- m3u playlist generation: KeyError: 'file.mp3' HOT 1
- Add separate requirement file for MacOS (M1/M2) HOT 1
- python version HOT 1
- No module named 'audiodiffusion.audio_encoder'; 'audiodiffusion' is not a package HOT 4
- suggestion: skip broken files HOT 1
- KeyError generating mp3 mix or playlist HOT 5
- for some reason spotify breaks the tracks scraping after 4900~, it ip banned me. HOT 3
- Developer terms restrictions? HOT 2
- wrong m3u after second scan of a library HOT 3
- Unable to adjust sliders with a screenreader. HOT 1
- Skips all MP3s HOT 1
- Please add FLAC support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deej-ai.