Announce: Musly DSTM Mixer (mix by similarity)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gorman
    Senior Member
    • Apr 2005
    • 833

    #16
    Question: where is the "similarities info" saved? Into a single file library? Separate file for each music file? Tags?
    I don't want to mess with tags in my music.

    Comment

    • cpd73
      Senior Member
      • Mar 2017
      • 5007

      #17
      Originally posted by gorman
      Question: where is the "similarities info" saved? Into a single file library? Separate file for each music file? Tags?
      I don't want to mess with tags in my music.
      Two files are created; an SQLite db that stores some meta-data and a binary blob containing the musly data for each file. Musly loads this data, and some other data, into a 'jukebox' This jukebox can be created at start-up, but this can be slow, so the python API persists this to a file and loads that file at startup - which is much faster. So, no tags are added to the music files themselves.
      Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

      Comment

      • bakker_be
        Senior Member
        • May 2009
        • 1034

        #18
        I think the issues I'm having are related to my Ubuntu install dating back all the way to 14.04 and having been upgraded each time to the newer version when it came out. I've been having some other issues, unrelated to the LMS ecosystem, so I think the time for a clean install has finally come
        I'll report back once this is done (Might be a while, lots of stuff running on that machine )
        Main System: Marantz SR-5015 + Adam Audio T8V + Teufel Ultima 20 Mk 3 + BK Monolith+ FF + Lenovo T560 + Kodi + LG OLED65B26LA + UP-Board running Daphile
        Kitchen: Touch + Ikea ENEBY 30
        Home-Office: SqueezeLite-X + Topping DX3 Pro + NAD 312 + TMA Premium 905

        Comment

        • cpd73
          Senior Member
          • Mar 2017
          • 5007

          #19
          Originally posted by bakker_be
          I think the issues I'm having are related to my Ubuntu install dating back all the way to 14.04 and having been upgraded each time to the newer version when it came out. I've been having some other issues, unrelated to the LMS ecosystem, so I think the time for a clean install has finally come
          I'll report back once this is done (Might be a while, lots of stuff running on that machine )
          There's no rush - I'm not actively working on this. Still, it'd be nice to know how it works for others. I still prefer MusicIP, but the Musly analysis is so much faster!
          Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

          Comment

          • bakker_be
            Senior Member
            • May 2009
            • 1034

            #20
            Originally posted by cpd73
            There's no rush - I'm not actively working on this. Still, it'd be nice to know how it works for others. I still prefer MusicIP, but the Musly analysis is so much faster!
            The speed is indeed the main attraction point here. MusicIP is a rather heavy workflow for adding new music to the collection ...
            Main System: Marantz SR-5015 + Adam Audio T8V + Teufel Ultima 20 Mk 3 + BK Monolith+ FF + Lenovo T560 + Kodi + LG OLED65B26LA + UP-Board running Daphile
            Kitchen: Touch + Ikea ENEBY 30
            Home-Office: SqueezeLite-X + Topping DX3 Pro + NAD 312 + TMA Premium 905

            Comment

            • AF1
              Senior Member
              • Jul 2010
              • 650

              #21
              So I've compiled musly on macOS 10.15. No errors, some deprecation warnings (libavformat and such...).

              But when I try to run anything Python3 I get
              ./musly-server.py --analyse /Users/defuser/Music/MEDIA/
              Traceback (most recent call last):
              File "./musly-server.py", line 33, in <module>
              mus = musly.Musly(lib)
              File "/Users/defuser/Documents/musly-server-master/lib/musly.py", line 31, in __init__
              ctypes.CDLL(libmusly.replace('libmusly.so', 'libmusly_resample.so'))
              File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 365, in __init__
              self._handle = _dlopen(self._name, mode)
              OSError: dlopen(/usr/local/opt/musly-0.2/lib/libmusly.dylib, 6): Library not loaded: libmusly_resample.dylib
              Referenced from: /usr/local/opt/musly-0.2/lib/libmusly.dylib
              Reason: image not found
              BTW libmusly_resample.dylib and libmusly.dylib are in the same folder.

              My config.json

              Code:
              {
               "libmusly":"/usr/local/opt/musly-0.2/lib/libmusly.dylib",
               "paths":{
                "db":"/Users/defuser/Documents/musly/",
                "musly":"/Users/defuser/Music/MEDIA/",
                "lms":"/Users/defuser/Music/MEDIA/",
                "tmp":"/tmp/"
               },
               "lmsdb":"/Users/defuser/Library/Caches/Squeezebox/library.db",
               "genres":[
                ["Alternative Rock", "Classic Rock", "Folk/Rock", "Hard Rock", "Indie Rock", "Punk Rock", "Rock"],
                ["Dance", "Disco", "Hip-Hop", "Pop", "Pop/Folk", "Pop/Rock", "R&B", "Reggae", "Soul", "Trance"],
                ["Gothic Metal", "Heavy Metal", "Power Metal", "Progressive Metal", "Progressive Rock", "Symphonic Metal", "Symphonic Power Metal"]
               ]
              }
              I hit a wall there. I can only guess... is the lib format (dylib extension etc.) a problem? What's my mistake here?

              I've uploaded the compiled macOS version here.

              Thank you.
              Report a problem

              Comment

              • cpd73
                Senior Member
                • Mar 2017
                • 5007

                #22
                Originally posted by afriend
                So I've compiled musly on macOS 10.15. No errors, some deprecation warnings (libavformat and such...).
                Sorry, I don't use macOS - so really can't help much. If/when you get this working, I have moved the LMS side from lms-muslymixer to lms-musicsimilarity - as I've written a music-similarity backend that uses Essentia (see essentia-analyzer and essentia-api). This new mixer can talk to either the Musly or Essentia backend.
                Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

                Comment

                • cpd73
                  Senior Member
                  • Mar 2017
                  • 5007

                  #23
                  Originally posted by afriend
                  Code:
                  File "/Users/defuser/Documents/musly-server-master/lib/musly.py", line 31, in __init__
                  ctypes.CDLL(libmusly.replace('libmusly.so', 'libmusly_resample.so'))
                  Perhaps "libmusly.replace('libmusly.so', 'libmusly_resample.so')" should be "libmusly.replace('libmusly.dylib', 'libmusly_resample.dylib'))" for macOS ??? e.g. line 31 of edit lib/musly.py ??
                  Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

                  Comment

                  • AF1
                    Senior Member
                    • Jul 2010
                    • 650

                    #24
                    I had already replaced that part.
                    In the end I had to "bake" the absolute path of libmusly_resample.dylib into libmusly.dylib.

                    Before I start more tests on my main library may I just ask some questions because I'm really new to this.

                    The value (analysis result) for a track in the musly.db is different from the one Roland0's script (LMSmusly-0.1.1) generates. I don't know much about the underlying models used to compute the similarity score. Do you use different settings? Also, could it be that Roland0's script is a bit faster or is yours just more thorough?

                    If I put all the paths into the configure.json I just need "-a m" to analyze the music files, right?

                    And what does "only updating the metadata database" do as opposed to "-a m"? Just remove dead tracks musly couldn't find in the LMS database?

                    About jukebox and LMS/musly startup time: your script seems to (auto-)create a jukebox. Does it use the jukebox automatically? In general, how long does the start of (lms)musly take? I'm only asking because Roland0 said that with a large number of tracks in the database the startup time of lmsmusly would increase significantly.

                    And finally, I've notice that "create similarity mix" doesn't show up in the LMS default web UI. Is this by design?

                    Thank you.

                    P.S.
                    If it all works out I'll leave the macOS binaries and some instructions here.
                    Report a problem

                    Comment

                    • cpd73
                      Senior Member
                      • Mar 2017
                      • 5007

                      #25
                      Originally posted by afriend
                      The value (analysis result) for a track in the musly.db is different from the one Roland0's script (LMSmusly-0.1.1) generates. I don't know much about the underlying models used to compute the similarity score. Do you use different settings? Also, could it be that Roland0's script is a bit faster or is yours just more thorough?
                      Not sure, never used Roland0's script. I used (well copied and modified) Roland0's musly.py which interfaces Python->libmusy.so Musly does not process the whole track, but only a portion. One of the changes I made was how much to analyse - Roland0's is 30seconds, mine 2 minutes. My script also performs concurrent analysis of multiple tracks - Roland0's might do this, I have no idea. Whose is better, I'm not sure - they should be pretty similar. My aim was using Musy for DSTM.

                      Originally posted by afriend
                      If I put all the paths into the configure.json I just need "-a m" to analyze the music files, right?
                      Yes.

                      Originally posted by afriend
                      And what does "only updating the metadata database" do as opposed to "-a m"? Just remove dead tracks musly couldn't find in the LMS database?
                      My code does not touch the LMS db, it creates its own SQLite database. Therefore, I wanted a quick way to update this database to reflect and metadata changes in my files. When doing this the script just reads the tags and updates the DB for any changes.

                      The script only needs access to the LMS DB if you have CUE files where 1 file has multiple tracks. The script will get the metadata, start, and duration, of each track from LMS. It then uses ffmpeg to create temporary MP3s for each track and have musly anylyse these.

                      Originally posted by afriend
                      About jukebox and LMS/musly startup time: your script seems to (auto-)create a jukebox. Does it use the jukebox automatically? In general, how long does the start of (lms)musly take? I'm only asking because Roland0 said that with a large number of tracks in the database the startup time of lmsmusly would increase significantly.
                      My script will create an SQLite database file and a Musly jukebox file. If the jukebox file does not exist it will be created - but this can take sometime (around 10mins on an i7 laptop for ~20k tracks). I analyse my files on my laptop, and the copy the SQLite DB and jukebox onto my Pi4 (where LMS runs, and musly-server is also run to provided a backend for LMS).

                      Originally posted by afriend
                      And finally, I've notice that "create similarity mix" doesn't show up in the LMS default web UI. Is this by design?
                      Nope, not by design. Not sure why its not there, but then I've never created this sort of menu - so I just copied/modifed the one from LMS's Music IP mixer. Its not a feature I really use.

                      Originally posted by afriend
                      If it all works out I'll leave the macOS binaries and some instructions here.
                      Thanks for trying this. Please let me know if it works, and what (if any) changes needed to be made and I'll update the github page to point to your binaries.

                      p.s. Personally I think the Essentia backend provided better mixes, but MuscIP is still better than either. But, it'd be great to have another user's opinion.
                      Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

                      Comment

                      • Roland0
                        Senior Member
                        • Aug 2012
                        • 1340

                        #26
                        Originally posted by cpd73
                        Not sure, never used Roland0's script. I used (well copied and modified) Roland0's musly.py which interfaces Python->libmusy.so Musly does not process the whole track, but only a portion. One of the changes I made was how much to analyse - Roland0's is 30seconds, mine 2 minutes.
                        LMSmusly has an option to set the extract length. However, 30sec is the value recommended by musly's developer, and anything >60sec will slow down analysis without any effect, as musly will only use a max of 60sec for the analysis.
                        I did some testing with 60sec when I wrote the interface, and didn't notice any improvement.

                        Note that if you actually wanted to compare analysis results, you'd have to un-pickle the blob from the database, which will give a c-style float[56] array.
                        Given that both musly and the interface to it are identical, I wouldn't bother.
                        Various SW: Web Interface | Text Interface | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | Ambient Noise Mixer | DB Optimizer | Image Enhancer | Chiptunes | LMSlib2go | ...
                        Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

                        Comment

                        • AF1
                          Senior Member
                          • Jul 2010
                          • 650

                          #27
                          Originally posted by cpd73
                          My code does not touch the LMS db, it creates its own SQLite database. Therefore, I wanted a quick way to update this database to reflect and metadata changes in my files. When doing this the script just reads the tags and updates the DB for any changes.
                          I keep my music files in a folder hierarchy like artist > album > filename.ext. So I guess if I change the artist name all files below will be deleted from the db and would have to be analyzed again. Not that this will happen a lot, just curious. BTW does it fill the metadata at the end because a first look at the musly.db (in progress) shows the relative path (files) and the values (vals) but the other metadata columns are still empty.

                          Originally posted by cpd73
                          The script only needs access to the LMS DB if you have CUE files where 1 file has multiple tracks.
                          Good to know. So if I don't have any cue files this path is never called/checked and I don't even have to set it in config.json, right?

                          Could you add os detection to lib/musly.py so manual editing of line 31 won't be necessary?
                          For macOS the extension is dylib (libmusly.dylib and libmusly_resample.dylib).

                          The latest macOS 10.15 (for which I've compiled the binaries) would give you Darwin:
                          Code:
                          >>> import os
                          >>> os.name
                          'posix'
                          >>> import platform
                          >>> platform.system()
                          '[B]Darwin[/B]'
                          >>> platform.release()
                          '19.6.0'
                          And how do you feel about adding/moving these settings from app.py to config.json: DEFAULT_TRACKS_TO_RETURN, MIN_TRACKS_TO_RETURN, MAX_TRACKS_TO_RETURN, NUM_PREV_TRACKS_FILTER_ARTIST, NUM_PREV_TRACKS_FILTER_ALBUM, NUM_SIMILAR_TRACKS_FACTOR, SHUFFLE_FACTOR ? Might be nice to have all user configurable settings in one place.

                          About create similarity mix: when I call that from a track's context menu/song details page it's using only this one track as a seed, right? In other words, I could just take a look at which tracks musly-server thinks are similar to this track.

                          I've started the analysis. Since you commit after 500 tracks maybe you could a small info message stating the total number of tracks processed so far. Would make it easier to track progress.

                          Anyway, I just wanted to thank you for taking the time to explain things to me and for musly-server. And a thank you to Roland0 too. Quite curious if this is going to work out on macOS and if it's going to make listening to my music more interesting. As far as Essentia is concerned, I think one of you mentioned that the analysis part was a lot slower than musly so I guess I'll never get to use that one because my hardware is quite old and slow.
                          Report a problem

                          Comment

                          • cpd73
                            Senior Member
                            • Mar 2017
                            • 5007

                            #28
                            Originally posted by afriend
                            BTW does it fill the metadata at the end because a first look at the musly.db (in progress) shows the relative path (files) and the values (vals) but the other metadata columns are still empty.
                            Yeah, meta-data is saved at the end.

                            Originally posted by afriend
                            Good to know. So if I don't have any cue files this path is never called/checked and I don't even have to set it in config.json, right?
                            Correct.

                            Originally posted by afriend
                            Could you add os detection to lib/musly.py so manual editing of line 31 won't be necessary?
                            Create a pull request on github, or send me your modified file.

                            Originally posted by afriend
                            And how do you feel about adding/moving these settings from app.py to config.json: DEFAULT_TRACKS_TO_RETURN, MIN_TRACKS_TO_RETURN, MAX_TRACKS_TO_RETURN, NUM_PREV_TRACKS_FILTER_ARTIST, NUM_PREV_TRACKS_FILTER_ALBUM, NUM_SIMILAR_TRACKS_FACTOR, SHUFFLE_FACTOR ? Might be nice to have all user configurable settings in one place.
                            Can do, but do they need to be configurable? Not sure I really see the point. NUM_PREV_TRACKS_FILTER_ARTIST and NUM_PREV_TRACKS_FILTER_ALBUM perhaps - but then if that was the case the I'd add them to the API, and allow setting of these in lms-musicsimilarity. I'm wary of having things over-configurable as that then creates extra scenarios for things to go wrong!

                            But, let me know how the mixer works for you - as there is no point adding extra features if no one is actively using it!

                            Originally posted by afriend
                            About create similarity mix: when I call that from a track's context menu/song details page it's using only this one track as a seed, right? In other words, I could just take a look at which tracks musly-server thinks are similar to this track.
                            Yeah, for a track it just sends that one.

                            I've started the analysis. Since you commit after 500 tracks maybe you could a small info message stating the total number of tracks processed so far. Would make it easier to track progress.

                            Originally posted by afriend
                            Anyway, I just wanted to thank you for taking the time to explain things to me and for musly-server. And a thank you to Roland0 too. Quite curious if this is going to work out on macOS and if it's going to make listening to my music more interesting. As far as Essentia is concerned, I think one of you mentioned that the analysis part was a lot slower than musly so I guess I'll never get to use that one because my hardware is quite old and slow.
                            As a rough estimate, Essentia is about 14 times slower. Musly took around 1hr to analyse ~20k tracks, and Essentia took about 14hrs. Both still faster than MusicIP.
                            Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

                            Comment

                            • AF1
                              Senior Member
                              • Jul 2010
                              • 650

                              #29
                              Created the OS PR.

                              I see you've changed to extraction length to 30s. Will it distort the result of my ongoing analysis by much or at all if I stop the process now, change the value from 60s to 30s and then continue? Would love to save some time.

                              And I was actually thinking mostly of NUM_PREV_TRACKS_FILTER_ARTIST and NUM_PREV_TRACKS_FILTER_ALBUM. Don't even know what the SHUFFLE_FACTOR is for...

                              I forgot ask one thing though: many of my artist names are like "artistname (feat. anotherartist)" and some albums are like "albumname [expanded edition]". Is it save to include characters like "()[]" in the ignore part (config.json) or will this break a regex condition somewhere?

                              Anyway, I'll report back when I've had some time to use musly/music-sim.

                              Thanks.
                              Report a problem

                              Comment

                              • cpd73
                                Senior Member
                                • Mar 2017
                                • 5007

                                #30
                                Originally posted by afriend
                                Created the OS PR.
                                Thanks, merged.

                                Originally posted by afriend
                                I see you've changed to extraction length to 30s. Will it distort the result of my ongoing analysis by much or at all if I stop the process now, change the value from 60s to 30s and then continue? Would love to save some time.
                                To be honest, no idea. However, for me, even at the previous 2mins the analyis time was very fast - ~20k tracks/hour.

                                Originally posted by afriend
                                And I was actually thinking mostly of NUM_PREV_TRACKS_FILTER_ARTIST and NUM_PREV_TRACKS_FILTER_ALBUM.
                                I'll think about adding these, as I also have a MusicIP mixer where they could be added as well. I see no harm in making them configurable.

                                Originally posted by afriend
                                I forgot ask one thing though: many of my artist names are like "artistname (feat. anotherartist)" and some albums are like "albumname [expanded edition]". Is it save to include characters like "()[]" in the ignore part (config.json) or will this break a regex condition somewhere?
                                No regexes When meta-data is read back from the DB it is 'normalised' - brackets removed, soem strings removed, lowercased, etc. Just to try and help with mis-matched tags.
                                Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.

                                Comment

                                Working...