AudioStretch – real-time audio time-stretching and pitch-shifting in ActionScript

In my very first post, I mentioned that the FFT has many applications in audio signal processing. In fact, the main reason I ported my old C++ FFT to ActionScript is so that I could implement AudioStretch, a real-time time-stretcher / pitch-shifter that runs in Flash, in your web browser.

I first put AudioStretch online in late 2009, and I got a lot of traffic for a while, especially after André-Michelle tweeted about it. In retrospect, though, it really didn’t sound very good. I think people were just intrigued that stuff like this could be done at all in Flash.

Since then, I’ve made some huge improvements to the sound quality – better bass response, better transient handling, vastly better inter-channel phase coherence. I’ve added more speed options as well – you can even go to 0% speed, which can be pretty cool for working out notes of chords. (The UI is still really basic. Improvements coming soon!). So if you haven’t tried it in a while, or if you’ve never tried it at all, I invite you to give it a go:

Try AudioStretch for Flash Now!

Let me know what you think!

Incidentally, I have no plans to publicly release the code for AudioStretch. If you’re wondering how it works, here’s what I can tell you: it’s loosely based on the phase vocoder technique, but also embodies loads of proprietary tricks which I might write up one day…

If you’ve got an iPhone try AudioStretch for iOS.  Free download. Runs on iOS 5.1 and later. Way cooler than the Flash version.


About Gerry Beauregard

I'm a Singapore-based Canadian software engineer, inventor, musician, and occasional triathlete. My current work and projects mainly involve audio technology for the web and iOS. I'm the author of AudioStretch, an audio time-stretching/pitch-shifting app for musicians. Past jobs have included writing speech recognition software for Apple, creating automatic video editing software for muvee, and designing ASICs for Nortel. I hold a Bachelor of Applied Science (Electrical Engineering) from Queen's University and a Master of Arts in Electroacoustic Music from Dartmouth College.
This entry was posted in Uncategorized. Bookmark the permalink.

11 Responses to AudioStretch – real-time audio time-stretching and pitch-shifting in ActionScript

  1. Fred says:

    Well, congratulations Gerry,
    the stretch method used for the sound is really impressive !!
    I’ve tried different sounds, and especially for speeding down them, so undoubtedly, your program is very powerful ; results are better with cleaned sounds (like pieces of piano) than with heavy charged waveforms, but the phase synchronisation looks to be is a very effective method…
    Just a little observation, so : the sound looks to have fewer treble when loaded in the app than the same loaded in a classic mediaplayer…
    Anyway, well done Gerry !

  2. Tyler says:

    Are you planning to sell a license for using this? I would be interested in using this in some of my projects if it ever becomes commercially available.

  3. Gil Amran says:

    Release the code man!
    This is very useful to me!

  4. Barry says:

    So….. you put it online to show off…?

    • Of course! Isn’t that the whole point? 🙂 But seriously… I hope it’ll inspire, and maybe actually be useful (or at least amusing) to some people. I choose not to put up the source code because it’s commercially valuable – some contract jobs I get are based on licensing adaptations of it.

  5. mike says:

    Hi Gerry !
    Thanks for the post it works really good !

    I have a question.. I’m trying to make pitch-shifting work on mobile, but the performance is not good even on a Galaxy S II ! the sound is bumpy and cut..

    Do you think your algorithm solves this problem and is more effective ?
    If you have the chance, run it on mobile and let us know.


  6. mike says:

    It was stupid of me not test it via the phone’s browser 🙂
    It works great !…
    Please do contact me about a SWC license for it, I’m a small developer who needs it badly for a great concept.


    • I’m pleasantly surprised! Not long ago, AudioStretch in Flash just could run on phones. Looks like the combination of faster CPUs in phones plus some performance improvements in the Flash Player have made a huge difference! Will contact you soon…

  7. Any plans on making that FFT you made earlier in adobe assembly using hardware acceleration?

    If you mean Adobe Graphics Assembly Language (AGAL) then no, no plans. If I port it again, it’s more likely to be to Javascript.

  8. Karl Godard says:

    Any change this could be adapted to work as a realtime JavaScriptAudioNode in the web audio api?

    • With relatively small changes I could make it usable in a JavascriptAudioNote by adding an ExternalInterface API to it to pass in/out audio data (as strings, see here), set the speed, etc. That would allow me to keep 90% of the code in ActionScript, but it would also make the project dependent on both Flash and WebAudio. The cleaner solution for sure would be to rewrite it to run entirely in Javascript. It’s definitely possible, just haven’t had the time or motivation to do it yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s