Previous Entry | Next Entry

Dictionaraoke

  • Dec. 1st, 2005 at 10:37 PM
walle
About a week ago, [info]celenus turned me on to the phenomenon known as Dictionaraoke. That site defines the musical genre as "audio clips from online dictionaries sing the hits of yesterday and today. The fun of karaoke meets the word power of the dictionary." Karaoke and dictionaries are two of my favorite things, so I figured I'd have to try my hand at making one.

I decided on the song "Can't Fight This Feeling" by REO Speedwagon, because not only is it a sweet monster ballad, but it was the last karaoke song I sung, and I felt like I could have done a better job at it. And the whole reason I picked that song to begin with is that I heard it in the supermarket earlier in the day, and it struck me as a great karaoke song. This whole situation seemed so cosmic, and making the song into dictionaraoke felt fitting.

First, I wrote a script to case-and-punctuation-insensitively¹ remove duplicate words from the lyrics (which I'll leave as an exercise to the reader, I just set each word as a key in a perl hash).

Next, I took the output and ran it through a script to grab the associated sound sample from Merriam-Webster Online.

Almost every file is in the form:

http://cougar.eb.com/sound/[first_letter_of_word]/[first_7_chars_of_word]1.wav

Words shorter than 7 chars are padded with zeros, so every file name is always 8 chars. Eg:

http://cougar.eb.com/sound/f/find0001.wav

The following block of perl got me most of the way there

foreach my $word (sort { $a cmp $b } keys %hash) {
    my $len = length($word);
    my $cmd = "wget http://cougar.eb.com/sound/" . substr($word, 0, 1) . "/"
        . ($len > 7 ? substr($word, 0, 7) : $word)
        . ($len < 7 ? "0" x (7 - $len) : "")
        . "1.wav -O " . $word . ".wav";
    `$cmd`;
}
Don't ask me why I sorted the lyrics.

It's probably against m-w's TOS, and it definitely pegs their servers for a minute or so depending on how big your song is, but it beats looking each word up.

This script got me most of the words. Contractions and inflections have different file name rules, so I just grabbed them by hand.

Next, I found an instrumental (read: midi) version of the song, and placed the speech samples in the right positions (the most time consuming part). Here's the finished product:

Can't Fight This Feeling - REO Speedwagon [6mb .mp3]



¹ Since punctuation was in my input string, "You" and "You," would be considered unique words. Only now did it occur to me that it would have been easier to strip out non alpha characters.

Comments

[info]drbrain wrote:
Dec. 2nd, 2005 07:52 am (UTC)
Bleh, perl
Behold the power of Ruby!

ARGF.read.scan(/[a-z]+/i).map { |w| w.downcase }.uniq.sort.map do |word|
  next if File.exist? "#{word}.wav"
  cmd = 'wget http://cougar.eb.com/sound/'
  `#{cmd}#{word[0, 1]}/#{word[0, 6].ljust 7, '0'}1.wav -O #{word}.wav`
end


I hope that's not unreadably dense. ARGF is the concatenation of all the input files. I read that entire thing, then #scan creates an Array of matches which I downcase. I check if the file exists because 'actual' and 'actually' will download the same sound file, and I'm trying to be nice. ljust performs handy '0' padding on the right (left justifies the word). ` is just like perl's.


For some reason I had to do XXXXXX01.wav instead of YYYYYYY1.wav (6 instead of 7).
[info]bostonsteamer wrote:
Dec. 2nd, 2005 09:44 pm (UTC)
Re: Bleh, perl
Makes sense. I figured I could either bang out a perl script in 5 minutes, or struggle with ruby for 2 hours... It's like learning to snowboard when you already know how to ski: it's cooler, but still so frustrating.
[info]calliste wrote:
Dec. 2nd, 2005 09:40 am (UTC)
I've heard a version of the "Girl from Ipanema" which probably used the same method, because the voices sound exactly the same. Chris Coco played it in the Blue Room, I think. Or maybe someone played it on Solid Steel. They did have a better sound file though, maybe one day, you'll find a not-midi file? That would be fun. Because, frankly, midi sounds terrible.
[info]calliste wrote:
Dec. 2nd, 2005 12:26 pm (UTC)
Now that I actually looked at the Dictionaraoke page, I saw that you can listen to the Girl from Ipanema song right then and there.
[info]calliste wrote:
Dec. 2nd, 2005 12:29 pm (UTC)
And no, they do not have a better sound file. =)
[info]bostonsteamer wrote:
Dec. 2nd, 2005 03:06 pm (UTC)
you must have been on some really good drugs that night.
[info]jenn wrote:
Dec. 2nd, 2005 03:14 pm (UTC)
this is so awesome, holy shit.
[info]jenn wrote:
Dec. 2nd, 2005 03:22 pm (UTC)
OMG HAHAHAAHSJAhkjh i went to the site and i think i died.

it's like stephen hawking's greatest hits.
[info]bostonsteamer wrote:
Dec. 2nd, 2005 06:08 pm (UTC)
it's more like a chorus of male and female stephen hawkings taking turns with each word!
[info]celenus wrote:
Dec. 3rd, 2005 12:55 am (UTC)
Dude.

Did you hear the version of Nine Inch Nails' Closer?

Cracks me up.
[info]bostonsteamer wrote:
Dec. 3rd, 2005 03:51 pm (UTC)
Which one, radio edit or original? They're both hilarious! Though I was hoping the radio edit woud have that whip noise in place of the f-word.

It's amazing that the song is so good that even dictionaraoke can't make it bad.
[info]celenus wrote:
Dec. 3rd, 2005 07:22 pm (UTC)
Never stop dreaming
Maybe someday someone will dictionaraoke one of my songs...

[info]bostonsteamer wrote:
Dec. 4th, 2005 05:11 am (UTC)
Re: Never stop dreaming
If you have instrumental versions and lyrics out there, I will!
[info]celenus wrote:
Dec. 4th, 2005 12:18 pm (UTC)
Re: Never stop dreaming
...I should work on that...
(Anonymous) wrote:
Jan. 25th, 2006 02:47 pm (UTC)
Very nice job on this
I don't know what made me do it, but I typed "Dictionaraoke" into Technorati and found your journal - nice to see that people are still doing D'oke tracks! One of my ex-coworkers did a few of the early tracks ("Bohemian Rhapsody" and "Highway To Hell"); I'll send him an e-mail and let him know about this...
[info]bostonsteamer wrote:
Jan. 25th, 2006 02:57 pm (UTC)
Re: Very nice job on this
Thanks!

Latest Month

July 2009
S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Tags

Powered by LiveJournal.com