Cleaning up music libraries.

If you stream everything, well, let us say you can stop reading.

This is a quick journey on why we play with music files and how we tend to fix them over 20+ years of collecting them. So if you have playlists on Spotify or YouTube, or SoundCloud or MixCloud. This article is probably going to be boring for you.

Read on to listen to our diatribes.

There's still a percentage of us who believe in backing everything up onto spinning rust known as hard drives. Granted, this is not the most reliable way of backing things up, which is often why you have three to five of these units happily mirroring themselves, just in case. But it gets the job done.

Why? you think the internet is going to crash? - Anonymous.

Probably! If we use AI as weapons. The internet will most likely crash. A slow and horrible death underneath the Ouroboros effect. Where information is fed from one AI to another AI until everything shortcuts down to keywords, it just shouts at one another. Leaving petabytes of grey goo for anyone who dares to look anything up. In the best-case scenario, the internet may move onto other protocols beyond 'web version whatever' and back into little cages of self-enclosed applications.

Your just data hoarding. - Anonymous

Yeah, strangely, we're okay with this. Because there have been bands I've seen live, which if you go to Bandcamp, or decide to try other services such as SoulSeek-QT for Windows or Nicotine for Linux. Typing in such bands yields zero results.

You fucking pirate! - Anonymous

In many cases, I still have the original CD of the bands. When we were young and stupid, we thought backing it up to MP3 would be good enough. Perhaps not hearing about the good word of FLAC. Or, more precisely, we didn't live in an age where you could pick up a 500 GB M.2 drive for $40. Perhaps my original disc or record we picked up is starting to go bad. Thus, instead of sitting down and mastering the track yourself, well! Jump on the high seas and get a nice FLAC file from someone who has already done the mastering.

Piracy, backup restoration, or simply keeping the artist alive long after the copies run out and the links rot away. Waiting 75 years after the artist's death for it to be public domain isn't a great solution either.  We guess this will have to do.

But it doesn't solve the problem of old libraries pre-dating FLAC. Or perhaps you have live recordings from a band back when you had a 486, and for some reason, your modern player thinks the file is corrupt.

The data hoarding problem.

If anyone downloads a file off of YouTube via command line, and does not execute a command like:

yt-dlp -x --audio-format mp3 --audio-quality 0 https://youtu.be/LinkGoesHere

You will probably be left with these .m4a files. which on the surface appears just fine. Except when you decide to take the sound file and bring it into DJ software. As most DJ software is expecting some structure.

Right, so with the help of both FFmpeg and MP3val . Using both of these programs saved our asses since there was possibility hundreds of ways to encode music and perhaps not all of them were the nicest ways of going.

 

for /r %%x in (*.mp4) do set "filename=" & set filename=%%x & call :processaudio
for /r %%x in (*.wma) do set "filename=" & set filename=%%x & call :processaudio
for /r %%x in (*.m4a) do set "filename=" & set filename=%%x & call :processaudio
for /r %%x in (*.ogg) do set "filename=" & set filename=%%x & call :processaudio
for /r %%x in (*.aac) do set "filename=" & set filename=%%x & call :processaudio
for /r %%x in (*.opus) do set "filename=" & set filename=%%x & call :processfourletteraudio 
for /r %%x in (*.mp3) do set "filename=" & set filename=%%x & call :checkaudio

goto :ending

:checkaudio
C:\bin\mp3val\mp3val -f -nb "%filename:~0,-1%"
goto EOF

:processaudio
C:\bin\ffmpeg\bin\ffmpeg -i "%filename:~0,-1%" "%filename:~0,-5%.mp3"
del "%filename:~0,-1%"
goto EOF

:processfourletteraudio
C:\bin\ffmpeg\bin\ffmpeg -i "%filename:~0,-1%" "%filename:~0,-6%.mp3"
del "%filename:~0,-1%"
goto EOF


:EOF
:ending

Yeah, that's a lot of goto statements.. Never said we were great programmers.

STRUCTURE

It's a rather simple script, to be honest. On Windows, just drop the script into a folder. Run the script. Off it goes.

The flags we're passing by mp3val's manual are -f to FORCE the rebuild process. This could potentially destroy an MP3 if it's badly done. We've fixed hundreds of files with it so far. No death.

The -nb flag is just to remove the .bak files, which allows a user to undo.

We wouldn't recommend passing this script across your entire music library (unless you've already done a backup of it. Always do backups of your data.), but for me. It helped load ancient Windows Media files and made them playable again in Virtual DJ.

Final thoughts.

We went with a command-like approach because there are plenty of GUI options that felt a little too manual, with dropping them in one at a time. If you have a small number of files to fix, we guess the GUI is safer and more controllable as to exactly what it is you want the program to fix. But if people have better programs to fix sound files with, we'd like to hear it, as this was just one way we solved an issue, allowing us to fire up Mixxx, which is totally free. Or, if you're rich SAM or VirtualDJ to mess around within our library.

Until next time. Server protect you.

+++END OF LINE.

Leave a Comment to the Void