SoundCloud Energy App 2.0

Peter Rukavina

I’ve made some updates to the SoundCloud Energy Web App (that’s the actual app to the right; if you’re using Safari or Google Chrome you can press the “play” button to stream music right here).

From the original somewhat primitive version I’ve made the following updates:

  • In the original app I wrongly assumed you could treat multiple source elements for an HTML5 audio element as a “playlist.” This isn’t the intended use of multiple sources – it is intended to allow for multiple formats for a single track. To allow for a “playlist”-like functionality of multiple tracks I’ve loaded the SoundCloud tracks into a JavaScript array and written some simply JavaScript code to loop through them.
  • I got rid of the default HTML5 audio controls and replaced them with JavaScript-bound “play” and “pause” graphical buttons.
  • I removed the wordy explanation of what this actually is and replaced it with a Pachube-generated graph of the last 24 hours of energy interchange.

The updated code is in the github repository for your enjoyment.

Comments

Submitted by Martin Cathrae on

Permalink

Thanks for all the work you’re doing on this, it’s both fun and informative. I’m most of the way through a long winded blog post about PEI wind energy and what you’ve been up to with this stuff.

Submitted by Martin Cathrae on

Permalink

I have a question though, what happens with the soundcloud app when our energy import gets really low, or even negative like briefly last night? I don’t know of much music out there recorded at 5bpm… :)

Submitted by Peter Rukavina on

Permalink

When the energy is “negative” – we’re sending energy to New Brunswick – I simply take the absolute value of the figure in MW. So -5 MW plays the same as 5 MW. I suppose if I could figure out a way of having the audio played backwards that would be more appropriate.


SoundCloud returns plenty of tracks at 5 BPM - here’s an XML dump of some of them from their API. Of course any API&#160is only as good as the metadata backing it up, so it’s possible that at least some of those tracks are mislabelled.


There are even words in Italian to describe these very, very slow pieces, like Larghissimo.

Submitted by Peter Rukavina on

Permalink

I”ve updated the app with “next track” and “previous track” buttons, and change the “play” button to a “loading” icon (I suppose it really should be an animated spinner) when the stream is loading. HTML5’s audio element makes all of this very, very easy.

Submitted by Peter Rukavina on

Permalink

And once you do this, if you click on the (i) in the corner of the widget and uncheck the “Only play audio in dashboard” then you can stream the audio directly from the dashboard while you work away on something else (if you don’t do this then the audio will only play as long as you have the dashboard open).

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). 

You can subscribe to an RSS feed of posts, an RSS feed of comments, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email.

Search