20100901

#creativepact 20100901

Background

In May 2010 these three blog posts filled me with both excitement and dread:

http://createdigitalmusic.com/2010/05/03/real-sound-synthesis-now-an-open-standard-in-the-browser/
http://weblog.bocoup.com/web-audio-all-aboard
http://vocamus.net/dave/?p=1084

others to, but these three the most and this is what they were talking about this:
https://wiki.mozilla.org/Audio_Data_API

My excitement was much in line with the spirit in which those three were written, and enhanced by my personal circumstances; there follows a fragmented snapshot of where I'm coming from on this:

In May 2010 I was just over way through the first year of a PhD project looking at looking at sound through software for composing new music. One premise of my compositional aesthetic is that the software itself is in intrinsic part of a composition. I am a MaxMSP-aholic: this is relevant here for two reasons: first, I am looking to move away from my Max dependancy, and second, I have always known that writing HTML in the late 1990s was the gateway psudo-programming practice that lead directly to develop a serious Max habit. My current research is focused on circular forms and how they manifest everywhere in music and life, but not enough in visual representations of sound. I had previously proposed a PhD project which would have been to look at issues of portability and obsolescence in computer music.

I'm being vague and obtuse because I want to get on with it. One last thing to deal with though: the dreadful feeling of overreaching which sweeps across the waves of excitement. Perhaps it's enough to have said that.

On with the show

Here's a short (5min) video which I came to today via
http://www.reddit.com/r/programming/comments/d5vu6/html5_audio_demo_wow



The first comment on that reddit page points out that the Audio API is not actually a part of HTML5. We shall redress that point now and move towards what I made today with a few quotes from https://wiki.mozilla.org/Audio_Data_API


Abstract
The HTML5 specification introduces the <audio> and <video> media elements, and with them the opportunity to dramatically change the way we integrate media on the web. The current HTML5 media API provides ways to play and get limited information about audio and video, but gives no way to programatically access or create such media. We present a new Mozilla extension to this API, which allows web developers to read and write raw audio data.

[…]

API Tutorial
This API extends the HTMLMediaElement and HTMLAudioElement (e.g., affecting <video> and <audio>), and implements the following basic API for reading and writing raw audio data

[…]

Writing Audio
[…]
Complete Example: Creating a Web Based Tone Generator
This example creates a simple tone generator, and plays the resulting tone.

To run this example I am downloading the latest 'nightly build' of firefox from http://nightly.mozilla.org/ -- firefox-4.0b5pre.en-US.mac.dmg

And it works!

well, it works running the saved html file from the local disk: minefield seems unwilling to connect to the internet, but that is not important at this stage. I will put the examples online anyway:
This is the un-edited example:
http://sdfphd.net/creativepact2010/mozToneGenExample.html

Ok so what's next?

add a second tone at 3 times the set frequency and make it automatically stop after 2 seconds:
http://sdfphd.net//creativepact2010/mozToneGen_sdf01.html

let the user change number of seconds for the tone to play for:
http://sdfphd.net//creativepact2010/mozToneGen_sdf02.html

apply some Fourier Synthesis to the frequency spectrum of the tone:
http://sdfphd.net//creativepact2010/mozToneGen_sdf03.html

let the user set the number of harmonics (amplitude set as 1/n, where n=the harmonic number)
http://sdfphd.net//creativepact2010/mozToneGen_sdf04.html


seems to be working, but it is going to get more difficult to hear objectively the changes in timbre --it's too easy to convince oneself that what you expected to happen is happening -- I want to see the sound!!

I will get round to doing this within the browser over the next few weeks, it's part of the pact, but for now I will use SoundFlower to route the audio generated by the JavaScript in the browser into MaxMSP for analysis display with the spectroscope~ object:




!! warning !! loud test tones !!



Tomorrow I will have a go at using the DSP.js library: https://wiki.mozilla.org/Audio_Data_API_JS_Library

No comments:

Post a Comment