kelvinluck.com

a stroke of luck

Wave Sequencer experiment

A couple of weeks ago I attended the FitC Amsterdam conference which was great fun. One of the most inspiring sessions I saw was Andre Michelle‘s “Making REAL Music Within Flash” where he talked us through generating sound in flash using the infamous flash sound hack and then showed us how he is redefining what should be possible in flash by building the hobnox audio tool.

I travelled to Amsterdam by train and ferry which meant that I had some spare time on the way back to play and luckily Andre and Joa Ebert have released the complex code behind the flash sound hack as part of their popforge open source library.

So I built my Wave Sequencer. The idea is that it loads in a wav file and splits it into 16 equally sized chunks. You can then re-arrange these chunks to create new variations on the beat. Each 16 chunk section is a pattern and you can create up to 16 different patterns by choosing different patterns from the “pattern bank” at the bottom of the screen.

The loop I’m using is the famous Amen break and I’ve sped it up a bit (and given you a slider so you can control the speed yourself). If you play around with it you’ll see you can slice and dice your own old skool jungle riddims :)

Screenshot of Wave Sequencer Experiment

Note: If you are experiencing choppy audio then you are probably running the latest revision of the flash player (9.0.115.0) which breaks onSoundComplete. So join the petition and ask Adobe to make some noise. I’ve compiled a standalone version of the app against the older 9.0.28.0 player and you can download the PC standalone version which doesn’t have the audio issues.

Obviously this little experiment is very rough around the edges and there is a lot that can be done to improve it but I’ve been too busy with “real work” to look at it in the weeks since I got back from FitC and I thought it was better to publish it as is than to leave it to get lost on my hard drive…

My code here is really simple, all of the complex stuff is done by the popforge library. So big thanks to Andre for the inspiration and the sourcecode :) Hopefully I’ll find some time in the coming months to take this a lot further and to turn it into an AIR app which is actually useful!

14 Comments, Comment or Ping

  1. Coooooool ;) I like it!

    March 17th, 2008

  2. Wicked :) Hopefully I’ll get some time to finish it up sometime soon…

    March 18th, 2008

  3. Jonas Nyström

    Hi Kevin!

    I was hoping to find the code for this interesting solution… Any chance that you could provide a link to it?

    September 3rd, 2008

  4. Hi Jonas,

    The sourcecode is a bit of a mess because it was stuck together on a long boat trip so I’m not too keen to post it…

    I basically started from the popforge play wavfile example and rearranged the samples array as it is being played based on the UI changes…

    If you have any other questions I’d be happy to help…

    September 3rd, 2008

  5. I would like to see the source code even if it is not so clean…
    Thanks to you and André Michelle for inspiration: this give me the way to follow for my new website…

    September 10th, 2008

  6. this is so good..

    September 13th, 2008

  7. On my macbook with flash player 9 and now 10 installed I still get the “You need Flash Player version 9+ to view this sample” message.
    I have to view source and find the direct path to the swf to see it: http://www.kelvinluck.com/assets/wavesequencer/WaveSequencer.swf

    October 19th, 2008

  8. Thanks for the headsup Morten… I was about to say that it must work because it’s embedded with swfobject etc etc then I took a closer look and saw that Textpattern was putting in BR tags in the javascript code… Another reason I need to update my blog software!!

    Anyway – it should be fixed now, thanks again for the headsup :)

    October 19th, 2008

  9. Hi there,

    We were a drum 'n bass act from Holland.
    In the old days (1999) I had a website running with an amen-step-sequencer in javascript.

    Now that we are online again [www.timeconvert.nl] after all those years, the sequencer doesn't work anymore.

    So, I want your code badly ;-) It's for fun and music. I will credit you with name and link on the website.

    Kindest regards,
    Richard

    May 6th, 2009

  10. Gary

    How did you get the timing to work well?

    I have tried both flash's AS3 Timer class and the improved Timekeeper class written by Aneurin Barker Snook and both cannot play audio clips reliably enough for a sound sequencer. It stutters a bit every now and then. This is not really noticeable in your sequencer or in the hobnox tool. So any ideas how reiable timing was done so it doesn't vary or have bad latency etc?

    USing sound objects in the library, not loaded sounds.

    thanks,
    Gary

    October 10th, 2009

  11. Hi Gary,

    This example uses the popforge library which does the "sound hack" to allow you to generate your own sound objects from wav data (see the links above). With flash player 10 you can do this without the hack by using the sampleData event - see my examples here: http://www.kelvinluck.com/2009/03/second-steps-with-flash-10-audio-programming/

    Hope that helps,

    Kelvin :)

    October 12th, 2009

  12. Insatiable

    Great work Kelvin :-)

    Are you still holding out on the source? Why not just post a link? Everyone wants to see it, even if it is sloppy... we're coders, we'll figure it out ;-)

    January 8th, 2010

  13. T

    Just wanted to raise my hand to show interest in the source as well.

    March 25th, 2010

  14. Steve

    Great stuff Kelvin, and like the others said let's see the source code.

    Also, a little heads up on travelling by train to and from Amsterdam, you should check out raileurope dot com, as they have great offers, loads of destinations etc.

    Waiting for the source,

    Steve

    June 29th, 2011

Reply to “Wave Sequencer experiment”