Archive for August 8th, 2007

Clarinet

Wednesday, August 8th, 2007

I picked up my clarinet two days ago for the first time in about 5 months, and I was pleasantly surprised with my playing. It definitely wasn’t good, and I used to be a lot better, but after not playing for so long, I expected to really suck. I guess it’s like learning to ride a bike, you never really forget how to do it once you’ve learned. Granted, you’ll be a little rusty if you haven’t ridden for awhile, but you’ll never have to start over and learn again. Apparently it’s the same with music. I’ll probably never entirely forget how to play the clarinet. My playing ability will deteriorate (as it has this time), but it’ll never completely disappear.

So after high school, I pretty much stopped playing the clarinet. I wasn’t part of an ensemble anymore, I had stopped taking lessons, and I didn’t really see myself playing that much in the future. My mom would try to motivate me to practice, but I didn’t have anything to practice for, so I rarely did. I’ve been trying to get into the University Wind Ensemble at school, but rehearsal times always conflict with my classes, so I still don’t really have a strong motivation to practice. This semester, there was the slightest chance that I could squeeze rehearsal into my schedule, so I decided I should practice if I actually wanted to audition well. Just by practicing once, I rekindled some of my passion for music and now, even though there’s no way for me to be in the ensemble, I’ll keep practicing because I thoroughly enjoy it. I no longer need the motivation to practice, because I remembered how fun it was to just practice by myself and notice my own improvement. I’d still like to join the University ensemble, but I no longer need it to motivate me to practice.

After playing for so many years, and spending so much time, effort and money, I don’t just want to drop the clarinet. When I’m older, I’d like to be able to play in a community band or something recreational, and I need to keep practicing if I actually want to pursue that. It has definitely become harder to practice since I started playing the guitar, because I now have to divide my limited time between two instruments. Being in an ensemble really helps, but until I can actually join the group, I need some motivation to practice. I found that motivation on Monday, when I remembered how much I enjoy playing.

File-Renaming Script

Wednesday, August 8th, 2007

Let me preface this by saying that I’m really uptight about my files (especially my media), how they’re named, and where they’re stored. All my music is organized by artist, then by album, and all files are in the form title – artist.mp3. It gets to be a bit of chore to rename any new songs that I obtain, but I’ve been doing for so many years I never thought about having something rename them for me. If you can’t tell from the title of this post, I wrote something to do just that.

A brief outline of the idea: I wanted something that would rename any songs that I downloaded to fit a certain template of my specification (It’s not a very commonly used template). I usually download albums, where all the songs are in the same original template, so rather than rename all the files by hand, I wanted something that would rename all the files with just one command. What I have right now, is a perl script that you call from the directory that holds all the song names, and it asks you some questions about how the files are currently named and how you want them to be named, then it changes all the file names for you. The interface right now is pretty basic, but I just wanted to get the project functional at first. I’ll probably be making a nicer web interface for this in the next couple of days.

I started coding something to do this yesterday, and I’ve got a decently working template. Unfortunately it relies on a Unix-based OS (it’s running on my mac) , so it won’t be compatible with Windows. It takes advantage of perl’s very straightforward interaction with the shell and uses the shell’s mv command to actually rename the files. The harder part was actually coming up with the new name for the file based on some pretty generic user inputs. The script currently asks for: the ordering of the naming elements in the file, how those elements are delimited, how spaces are delimited, and the file extension. Then it asks how you want the elements to be ordered (and which elements you want in the name) and how you want them to be delimited.

From all the input data, I use shell’s ‘ls’ command to get all the file names, then I split them by the element delimiter (one of the arguments). A simple regex converts all the space delimiters to regular spaces, and then I map the ordering of the original file to the desired ordering of the new file. From there, I just join this with the desired delimiter, and add the file extension back on. Then I can just mv from the old file name to the newly build file name and that changes the filename. It’s that simple.

Of course, it won’t end up being that simple. I need to add in a lot of error checking and input validation even before I start improving the interface. I also want it so that you just need to pass in 2 arguments for initial format and desired format and the script figures the rest of it out. Unfortunately I’m not exactly sure how I’d go about doing this. In terms of error checking, I don’t want to rename any files if one of the files fails, so I have to figure out how I can go about this (I haven’t really thought about it and I don’t know off the top of my head). I also want to make the outputs look a lot nice, and as usual I need to document the code a lot better. Then I can get started on that web interface.

This is a pretty quick project that I don’t intend to spend much more time on, but it’s gotten me more familiar with the shell, with using perl for scripting (rather than for web stuff), and also with regex’s and string manipulation. Aside from me learning more, the real motivation is that it’s a script I would use a lot, as I do download a lot of music and I want to have it all named properly. Assuming that I make the interface to the script a lot nicer, it’s a script that I and hopefully some other people would actually use.