Another automation, a bit off-topic
In my spare time, I listen to a whole slew of netcasts. When I am at home, I listen to these on my Crapbook, so I can use a handly little piece of Applescript whipped up by Randal Schwartz that passes the current track from iTunes to QuickTime, adjusting the playback speed to 1.5 times the normal speed.
I found netcasts to be a very pleasant distraction from the horrible music usually played at the gym. Unfortunately my portable MP3 player doesn't let me adjust the playback speed, so I need to adjust it in the MP3 files themselves. The following script does just that.
require 'rubygems'
require 'rbosa'
RATIO = 1.5
target_dir = "/tmp/#{$0}/#{Time.now}"
`mkdir -p "#{target_dir}"`
iTunes = OSA.app('iTunes')
iTunes.selection.each {|track| `cp "#{track.location}" "#{target_dir}"`}
%x(
cd "#{target_dir}"
for f in *
do sox -t mp3 "$f" "$f.wav" tempo #{RATIO}
lame "$f.wav" "$f@#{RATIO}.mp3"
rm "$f" "$f.wav"
done
open .
)
First I select the tracks I want to convert in iTunes, then I invoke this script. When applied to 10 or more tracks, the processing done by sox and lame can easily take a few minutes, so I added the call to open ., which opens a Finder window with the converted files as soon as everything is done, so I can grab them and move them to my MP3 player.
1 Response to “Another automation, a bit off-topic”
Sorry, comments are closed for this article.
November 9th, 2009 at 11:06 AM Glückwunsch zum neuen Blog!