Archive

Posts Tagged ‘music’

Music Solutions

December 23rd, 2008

A couple of months ago, I spent a lot of time working on a solution for handling all my music and its various uses. Namely, I wanted to keep separate track of:

  • All my music (even the music I don’t listen to, so I don’t have to get rid of it)
  • The music I listen to on my computer
  • The music I have on my limited-space iPod

In addition, I wanted to make sure there was as little wasted disk space as possible, so I used hard links and had all the files in separate directories.

You’d think there would be a relatively simple solution, and I’d hope so too, but I came up with this really convoluted system that involved synchronizing three directories with two scripts whenever music had to be added or removed. What it results in is that I never add music anymore. And somewhere along the line, my “music on my computer” folder got messed up, so I’m back to square-one with that one. Hundreds of songs I filtered out back in the mix.

I wonder if some of my problems would be solved if I used a GUI music player, but I’m not so sure. My current setup uses MPD, which runs nice and light. Anyway, I’m out of mental energy, and am hoping someone else might have a better idea. Does anyone have any good ideas how to maintain my music? Or perhaps a better ideal to work under? Until then, I’ll just suffer under a horrible manual version where I just delete and add things at will to everything and hope I don’t miss things.

linux ,

Concatenate/Combine mp3 Files

October 10th, 2008

So I had a bit of difficulty with this one, and a difficulty that I really only got because I chose to test my files with mplayer. I essentially tried to use the widely suggested method of using cat to combine mp3 files like so:

$ cat a.mp3 b.mp3 c.mp3 > d.mp3

Believe it or not, it works. Apparently the mp3 file format is such that you can do this. However, if you have id3 tags on any of the files, this will cause some issues for playback with finicky audio players like mplayer. While some players (ffplay for example) will ignore such garbage it finds in files, mplayer won’t do it so gracefully. In order to fix this, you have to strip all id3 tags from the files first. After a bit of searching, I found a nice utility which can do just that, aptly named id3v2. All you have to do is use it like so:

$ id3v2 -D a.mp3

And voila! id3 v1 and v2 tags are removed from the file. Simple and easy.

You can pick id3v2 up on sourceforge, but if you’re using Gentoo, there’s an ebuild in the portage tree.

linux ,

Music Syncing Issues

October 5th, 2008

I can sum up most of my computer-related decisions over the last 3 years or so as all being related to dealing with my hardware as best as possible. This first led me to ditch Windows XP and try out Linux (Ubuntu first). Then I tried fluxbox because GNOME was too heavy. Then I decided that Ubuntu didn’t deal all too well with switching out your desktop environment for a window manager, so I naively tried out this distribution I’ve come to know and love called Gentoo. Now that I’m with Gentoo/fluxbox combo, I’ve managed, over time, to slim down my machine to just what I want, and have a pretty lean box, IMHO. Not the leanest, but I did want a functional and pretty box as well. ;-)

Anyway, this all correlates to a recent issue I’ve had with my music accounting system, and how I got around it with some frenzied bash scripting. Because I’ve got a 4GB iPod Nano, I eventually came into the position of having too much music to fit on the device. So I looked at my music and thought about compression. Unfortunately, I couldn’t glean nearly enough space from that. Then I realized that I have way more music than I actually listen to, so why not keep some music for computer listening, and some for mobile? Well that’s a fantastic idea, but implementation gets a bit sticky. I can try some convoluted system in which I keep a file of the unwanted files, update that manually, and… yeah, not too pretty. Although I can’t quite say my solution was much prettier.

My current system involves a ~/music directory, and a ~/music-all directory. My intention is to delete nothing from ~/music-all, ever. ~/music contains music I actually want to listen to, and ~/music-ipod will contain music that I like enough to carry in my 4GB of space. The key is that all the files within these three directories are hard links, so I’m not actually increasing my disk usage very much, and operations on the sets of files are much faster than if I had more than one copy of my files. So assuming I hard link everything in ~/music-all to ~/music, I can then delete things from music at will, without losing it from my drive, but getting rid of it from listening.

With a schema in mind, then there’s the question of how to keep it up to date. There are times when I want to add music to my collection, but then what do I do? I could manually link the new files over, but… well, in retrospect, perhaps that would have been simpler. But I decided I needed a script which would note the differences, relink ~/music-all to ~/music, then remove the files that I noted earlier (which were saved in a text file). The benefit of all my toil was that it now makes my updates lightning fast and not tedious in the least. I had to come up with two scripts, however: one to be run prior to changes to ~/music-all, and one once they’re made. Below are the scripts, which probably won’t be of much use to anyone else, but they can essentially be used to keep two directories in sync, but with certain persistent changes.

mtree-1
mtree-2

Wow, I just spent way too much time figuring out how to post code here, and I’m still not satisfied with the result, so I ditched it. The built-in <code> tag doesn’t seem to take to multiple lines all that well… If anyone knows how to do that, do let me know!

linux , ,