TTW: Add a little music to your blog.
A few people have asked me how I use the little Odeo player to include sound clips in my blog posts, like this:
I've hijacked Odeo's spiffy little Flash/Shockwave player to play a clip that I've uploaded onto my web server. Here is the code I used (you'll want to copy/paste this into your favorite text editor to see it all):
For those who don't need the ubergeek explanation of what that chunk of code does, here is a quick rundown of what I do:
1. Upload the .mp3 file to my web server.
2. Paste the HTML code above into my Blogger post (in "Edit HTML" mode).
3. Change the URL section (http://yoursite.com/tune.mp3) to point to the location of the new tune I uploaded.
4. Change the duration (audio_duration=64) to the length of the new tune in seconds.
That's it. Easy, eh?
Ok, for those who are interested in how this thing works, here is what I've learned about the code from my own experimentation. The Odeo site does not have much info on how to tweak this stuff, so I had to tinker for awhile.
The first part of the code links to the Shockwave player itself on the Odeo site. I use the standard black player, but there are other sizes and colors to match your site. The quality section seems to have zero effect on the playback of any files I've tried with it, set to "high" or "low". So I leave it on "high". Width and height refer to the size of the player window as it displays on your webpage. I've had the best luck with it looking right at the size above - it doesn't seem to scale very well. Allowscriptaccess should be set to "always", but I honestly don't know any other settings for that one. Ditto for wmode. The type section tells the browser what sort of embed is being used. The flashvars section is one that I should probably do some research on, as I have only been able to make the player work with .mp3 files encoded at a bitrate of 128k or higher, and Odeo says sample rates of 11.025, 22.05, and 44.1 are the only ones that will work. The URL section is key, as this tells the player the location of your sound file - in my example here, the file lives in a directory called "music" on my web server, and is called "yaketysax.mp3". (For ease of coding, I always strip out any spaces in the file names." The next section is duration, which refers to the length of the clip, in seconds. My example here runs 1:04. The last section is a link for people to get Flash if they don't have it.
Enjoy.
I've hijacked Odeo's spiffy little Flash/Shockwave player to play a clip that I've uploaded onto my web server. Here is the code I used (you'll want to copy/paste this into your favorite text editor to see it all):
<embed src="http://www.odeo.com/flash/audio_player_standard_black.swf" quality="high" width="300" height="50" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=http://stevelyon.com/music/yaketysax.mp3&audio_duration=64" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
For those who don't need the ubergeek explanation of what that chunk of code does, here is a quick rundown of what I do:
1. Upload the .mp3 file to my web server.
2. Paste the HTML code above into my Blogger post (in "Edit HTML" mode).
3. Change the URL section (http://yoursite.com/tune.mp3) to point to the location of the new tune I uploaded.
4. Change the duration (audio_duration=64) to the length of the new tune in seconds.
That's it. Easy, eh?
Ok, for those who are interested in how this thing works, here is what I've learned about the code from my own experimentation. The Odeo site does not have much info on how to tweak this stuff, so I had to tinker for awhile.
The first part of the code links to the Shockwave player itself on the Odeo site. I use the standard black player, but there are other sizes and colors to match your site. The quality section seems to have zero effect on the playback of any files I've tried with it, set to "high" or "low". So I leave it on "high". Width and height refer to the size of the player window as it displays on your webpage. I've had the best luck with it looking right at the size above - it doesn't seem to scale very well. Allowscriptaccess should be set to "always", but I honestly don't know any other settings for that one. Ditto for wmode. The type section tells the browser what sort of embed is being used. The flashvars section is one that I should probably do some research on, as I have only been able to make the player work with .mp3 files encoded at a bitrate of 128k or higher, and Odeo says sample rates of 11.025, 22.05, and 44.1 are the only ones that will work. The URL section is key, as this tells the player the location of your sound file - in my example here, the file lives in a directory called "music" on my web server, and is called "yaketysax.mp3". (For ease of coding, I always strip out any spaces in the file names." The next section is duration, which refers to the length of the clip, in seconds. My example here runs 1:04. The last section is a link for people to get Flash if they don't have it.
Enjoy.
Labels: things that work
0 Comments:
Post a Comment
<< Home