Sound Bytes

A coding competition


Project maintained by coding-competitions Hosted on GitHub Pages — Theme by mattgraham

Song of Thrones

by Ken Gros

Listen

Editor’s Note: This entry produces audio output directly as well as a file. The audio file must then be manually converted to ogg / pcm and the resulting file produced does not exactly match the original. For technical reasons, only the converted audio file can be shown here.

Readers are encouraged to run the original for themselves, but your mileage may vary.



Song of Thrones

A minimal sound generating coding challange

Challange Accepted

Technique

Step 1


The body tag is created and a button is placed inside with a click event attached.

Step 2


When the button is clicked an async function calls a secondary function that will return a promise to the primary.

Step 3


The secondary function accepts 3 variables frequency, wave shape and duration from an array of notes.

Step 4

In the next phase of the primary function the chunks of audio are combined with Blob and encoded. Once this step is complete the url of the encoded media is assigned to an <a> tag and a click event is fired on it starting the download of the file.

** All images show non-minified code for readability **

Golf Score

How To

Language

Chrome (JavaScript + WebAPI)

Golf Score

989

Parameters

Sample Rate: Hz
Sample Size: bits
Channels:
Encoding:

Spectrogram

Spectrogram