Drug Viagra

July 2nd, 2009

Drug viagra Pitching MP3 (Not PitchShift!) is possible since Flash10s new Sound API. Drug viagra Today I saw Lee Brimelow's post about doing so, drug viagra providing some source code. Drug viagra Cause we spend a lot of time to keep things running more smoothly in the AudioTool, drug viagra I created another version which has some advantages.

  • No objects are created in runtime (memory usage)
  • The SampleDataEvent is receiving a static blocksize (steady latency)
  • Linear interpolation (sound quality)
  • Speed can go down to zero

Drug viagra {source code}

Drug viagra Get Adobe Flash player

Drug viagra

Drug viagra (no preloader - music by basic channel) - Thanks Lee for pointing me!

Average Rating: 5 out of 5 based on 153 user reviews.

Filed under: actionscript

93 Responses to “Wholesale Viagra”

  1. Jop Wielens Says:
    July 2nd, 2009 at 12:41 pm

    Seriously cool! Can’t believe the source code is so small and easy to follow.
    Already looking forward to your FOTB talk. Hope they put you in the room with the decent soundsystem ;-)

  2. Patrick Says:
    July 2nd, 2009 at 12:46 pm

    Awesome! Love your work, thanks for this example!

  3. Swingpants Says:
    July 2nd, 2009 at 1:13 pm

    Very nice use of Basic Channel…
    Been meaning to do some audio work, something like pitching is a great place to start.

  4. Tobias Hinz Says:
    July 2nd, 2009 at 1:18 pm

    wow nett – basic channel rockt und das script auch.

    wann programmierst du traktor dj studio in actionscript nach? ;)

    grüße aus berlin

  5. Thomas Junk Says:
    July 2nd, 2009 at 1:38 pm

    Aber es pitched doch gar nicht, es speeded … ;-)
    Geht das auch mit pitchshift und harmonic correction?

  6. dVyper Says:
    July 2nd, 2009 at 1:49 pm

    Nicely done! Now we just need to figure out how to get the music pitch changed but with the music playing at a constant speed …

  7. Philipp Says:
    July 2nd, 2009 at 1:54 pm

    bekomm leider den folgenden fehler?!

    TypeError: Error #2007: Parameter type darf nicht ‘null’ sein.
    at flash.events::EventDispatcher/addEventListener()
    at components::MP3Pitch()[/Users/aM/Documents/workspace/audiotool/team/andre.michelle/fdt/session/Audio2009/src/components/MP3Pitch.as:36]
    at ExampleMP3Pitch()[/Users/aM/Documents/workspace/audiotool/team/andre.michelle/fdt/session/Audio2009/src/ExampleMP3Pitch.as:29]

  8. Andre Michelle Says:
    July 2nd, 2009 at 3:17 pm

    Neusten Flashplayer installiert? Klingt als hättest du noch den Betaplayer.

  9. Kodiak Says:
    July 2nd, 2009 at 3:17 pm

    Always a fan :)

    I did something quite similar there:
    (long preloader, just wait)

    Sad thing it’s not very reactive.

  10. Radley Marx » Blog Archive » Pitch Shift in Flash (Digital DJs may wet themselves now) Says:
    July 2nd, 2009 at 4:41 pm

    [...] links to article & player: (blog.andre-michelle.com) Pitching MP3 (Not PitchShift!) is possible since Flash10s new Sound API. Today I saw Lee [...]

  11. Pitch-shifting MP3s in Flash | vj.tv Says:
    July 2nd, 2009 at 5:03 pm

    [...] links to article & player: (blog.andre-michelle.com) Pitching MP3 (Not PitchShift!) is possible since Flash10s new Sound API. Today I saw Lee [...]

  12. Alfredo Chu Says:
    July 2nd, 2009 at 6:59 pm

    Great stuff… Keep up the great work.

    @Kodiak nice turntable.

  13. Pitch MP3 | Adobe Tutorials Says:
    July 2nd, 2009 at 7:49 pm

    [...] Read the rest here: Pitch MP3 [...]

  14. The Flash Blog » Adjusting audio pitch in Flash Player 10 Says:
    July 2nd, 2009 at 8:22 pm

    [...] code to adjust the pitch of an external sound. I was secretly hoping he would. Check it out at http://blog.andre-michelle.com/2009/pitch-mp3/. Thanks [...]

  15. vidme Says:
    July 2nd, 2009 at 10:04 pm

    AwESoMe …
    could this code (modified) used for video?

  16. Lee Brimelow Says:
    July 3rd, 2009 at 6:58 am

    That sounds amazing Andre!

    @vidme unfortunately there is no current way to get to the bytes of audio from a Flash video file.

  17. E.G. Says:
    July 3rd, 2009 at 9:54 am

    you just estimate the pitch and slice the sample accordingly and then overlap+add

    not sure if it matters in AS3, but you could save a multiplication in
    ( 1.0 – alpha ) * l0 + alpha * l1 )
    l0 – alpha* l0 + alpha * l1

    but maybe the compiler does already these kind of optimizations.. do you happen to know if this is the case?

  18. makc Says:
    July 3rd, 2009 at 12:02 pm

    Dont know if it’s the same thing but check it out http://wonderfl.kayac.com/code/d1eb34ea56d0b2671a0b85ce78b75896dba8573f (2009/05/20)

  19. leef Says:
    July 4th, 2009 at 12:20 am

    omg, I love it! Nice add adobe!!! = ]

  20. Andre Michelle Says:
    July 4th, 2009 at 1:35 pm

    @E.G Thanks for sharing. I have updated the source code with your optimization.

  21. Hebiflux » De l’UGC musical avec LG Says:
    July 8th, 2009 at 10:01 am

    [...] au vu des expérimentations d’Andre Michelle avec son pitch mp3, on devrait avoir pas mal de créations originales avec les effets d’accélération ou de [...]

  22. Adrien W. Says:
    July 8th, 2009 at 10:20 pm

    Andre you rock! Your implentation of mp3 speed shifting is very elegant.

    I’m wondering, is it possible to use sound.extract() and then manipulate the raw sound data without waiting that the song is completely loaded ?

  23. elearning Says:
    July 11th, 2009 at 9:45 pm

    Good work !

    Keep up great staff!

  24. Doug Says:
    July 13th, 2009 at 6:38 am

    > you just estimate the pitch and slice the sample accordingly and then overlap+add

    Could you perhaps elaborate on how to time shift without shifting pitch? Or better yet, update this example so that pitch is not effected? :)

    @Adrien W. – yes, it seems you can start extracting before the file completely loads.

  25. jazzairwaves Says:
    July 14th, 2009 at 1:56 am

    In addition to the Speed control, would it be possible to create a second slider to control the pitch? I suppoe it would be similar to what E.G. suggested, but I’m not sure how to code the second slider. Has anyone done both rate and pitch sliders using the Sound API and SampleDataEvent?

  26. Ryan Berdeen Says:
    July 15th, 2009 at 10:44 pm

    @Doug, @jazzairwaves, @dVyper

    I’ve started porting a C++ library (SoundTouch) that does the overlap+add for time-stretching/pitch shifting. It’s pretty rough, but it works and is promising:

    Here’s a demo http://static.ryanberdeen.com/projects/soundtouch-as3/demo/player/stretch.swf

    You can adjust the tempo by dragging the slider. It sounds OK when the tempo is increased. Decreasing the tempo could use some work.

    The source is here: http://github.com/also/soundtouch-as3


  27. Doug Says:
    July 16th, 2009 at 2:53 am

    @Ryan – that’s exceedingly cool! And even without decreasing tempo, it’s a lot further along than my attempted port of this FFT based routine:


    I seem to be having trouble with very basic AS Number issues – the output has some relation to the input, but there are many artifacts… Will post if I figure it out. Please update if you get lower tempos working. Wouldn’t it be a matter of overlapping copies of each frame?

  28. sth Says:
    July 17th, 2009 at 10:43 pm

    Hi, how to pitch a mp3 loop ?

  29. sth Says:
    July 19th, 2009 at 5:27 am

    Hi, so I find the way, but it’s not perfect


  30. Twitted by joe_schorn Says:
    July 19th, 2009 at 11:06 am

    [...] This post was Twitted by joe_schorn [...]

  31. Pitch MP3; MP3 in toonhoogte en afspeelpositie variëren | Marco Raaphorst Says:
    July 19th, 2009 at 4:19 pm

    [...] Klikken maar! (en ff geduld hebben met het laden van het geluid) [...]

  32. Adrien W. Says:
    July 19th, 2009 at 8:19 pm

    Major respect, that’s the most impressive thing I’ve seen in audio with AS3 !
    Looks very promising indeed :)

  33. bechar Says:
    July 21st, 2009 at 10:47 am


    Anyone know how can i put the buffer when i play dynamic sound(it’s generate from raw sound(mp3 file))


  34. Sound Pitch Says:
    July 22nd, 2009 at 10:59 pm

    [...] i was talking with Caleb (the sound expert here at Grupow) a few days ago about how the Pitch works behind the scenes i saw a great usage of the Pitch effect in Braid Game and i wanted to give a try in the new Sound API en Flash …………. and then Andre Michelle came with this!!! [...]

  35. atom Says:
    July 23rd, 2009 at 11:23 am

    Andre, yet again you rock \m/ \m/

  36. ian pretorius Says:
    July 26th, 2009 at 6:12 am

    it keeps getting better , thanks for this

  37. Paras Says:
    July 27th, 2009 at 5:58 pm

    hey Andre,

    great stuff as always!

    any chance you could point me in the direction to do BPM (Beats Per Minute) analysis for a batch of MP3 files?

    FP 10 is fine too.

    Thanks in advance

  38. atom Says:
    July 27th, 2009 at 7:21 pm

    Just in case anyone is looking to extend this example to do note based pitch shifting, this formula might be handy:

    _playbackSpeed = Math.exp((Math.log(2)* SEMITONE_SHIFT)/12);

    Hope that helps,


  39. jazzairwaves Says:
    August 3rd, 2009 at 10:32 pm

    @Ryan – Superb example of the type of audio control we’ve been struggling to create in Flash for a long time. Thank you for providing the source! Excellent work!

  40. marcin p Says:
    August 12th, 2009 at 12:03 am

    those chain reaction / bacis channel classics still sound good after all these years :)

  41. Having fun with Face Tracking and MP3 Pitch control | Jop Wielens Says:
    September 11th, 2009 at 10:39 am

    [...] this year we saw the Flash Face Tracking and 2 months ago Andre Michelle showed how easy it was to control the pitch of a sound in Flash 10. I love all that [...]

  42. filmy online Says:
    September 13th, 2009 at 5:13 pm


    Anyone know how can i put the buffer when i play dynamic sound(it’s generate from raw sound(mp3 file))


  43. leef Says:
    September 29th, 2009 at 3:47 am

    Maybe this will help someone else, the _position variable is the Byte position, not millisecond = \ sometimes I spent way to much time not noticing that

  44. Namake Says:
    November 12th, 2009 at 5:56 pm

    Hi Andre,

    your work is awesome!
    How to pitch a loop mp3?

  45. michael Says:
    December 15th, 2009 at 10:47 pm

    This is also pretty cool, as the tempo stays constant when you change pitch: http://iq12.com/blog/2009/08/25/real-time-pitch-shifting/

  46. Olof Says:
    December 18th, 2009 at 3:01 pm

    Really great work!

    Im not good at this soundstuff. Is there a way to use this on soundfiles with lower samplerate or any samplerate?


  47. Olof Says:
    December 19th, 2009 at 3:23 pm

    @leef you can get the percent played like this: var percentPlayed:Number = (_position/(_mp3.length*44.1));

  48. Michael Says:
    December 30th, 2009 at 7:38 pm

    Great work! Thanks for sharing!

  49. Roland Says:
    December 31st, 2009 at 5:48 pm

    if anybody else would like to play the sound from a certain start position you have to set the position to something like this:

    _position = startTime * 44.1;

    note that the startTime will be the time the mp3 should start playing in milliseconds.

    hope that helps.

  50. Jonas Says:
    January 3rd, 2010 at 6:08 pm

    Does anyone know how to play the mp3 in reverse smoothly? Right now I have changed the startposition:

    _position = startTime*44.1;

    and the sound position:

    _position -= scaledBlockSize;

    But it doesn’t play smoothly…


  51. Matthew Says:
    January 5th, 2010 at 11:10 pm

    This is a really amazing thing you have done here, thank you…

  52. MP3 Wave Display 2 Says:
    January 17th, 2010 at 9:18 pm

    [...] speed and maintain acceptable sound quality. I took the code for pitching a sample from this MP3 Pitch example by Andre Michelle, which builds on Lee Brimelow’s post Adjusting audio pitch in Flash Player [...]

  53. mit popforge wave in anderer SamplingRate einbinden - Flashforum Says:
    February 7th, 2010 at 2:23 pm

    [...] meine, dass der Wavplayer in Popforge jede Geschwindigkeit abspielen kann. Ansonsten hilft auch dieser Code oder dieser. __________________ aM blog | hobnox | laboratory | sources | processing Adobe, [...]

  54. Scott Says:
    February 9th, 2010 at 8:25 pm


    I’m trying to make a looping sound in a game I am working on speed up as time runs out. I want the pitch to remain the same, so I was very excited by your link:


    but when I downloaded the source and played around with it, it always sputters. By any chance could I have the source code for that example, stretch.swf. Either way, thanks and great work.

  55. Rahul Says:
    February 14th, 2010 at 6:08 am

    Hi Andre
    Thanks for these wonderful posts – very helpful for a noob like me. I am actually trying some very basic stuff to protect an MP3 that I stream from being recorded. One approach was to simply XOR the content frames in a MP3 with a key and XOR is back in the player actionscript. But once I use sound.extract() , XORing does not recover the original mp3. Is it because sound.extract actually uncompresses the data into raw sound? Anyway I can manipulate the mp3 as it loads.

  56. theDarkIn1978 Says:
    February 27th, 2010 at 3:37 am

    this is absolutely brilliant!

  57. IdeasMX Says:
    February 28th, 2010 at 12:13 pm

    Hi, how can i save the sound of a mix of sounds, a mix of wav files loaded?

  58. Benson Says:
    March 5th, 2010 at 7:39 am

    Hi, I would like to know is it possible to perform a loop back sound?

    I try to use soundchannel but it won’t works

  59. Pitching the Microphone with Flash Player 10.1 Beta Says:
    March 11th, 2010 at 2:10 pm

    [...] to Andre Michelle’s shared work on pitching MP3s and Devon Wolfgang’s microphone code example I was able to get the above up and [...]

  60. Nick Kuh Says:
    March 11th, 2010 at 2:33 pm

    Amazing work Andre, thanks for sharing the code. I’ve worked it into an example that records samples from the Microphone in Flash Player 10.1 (source included):


  61. mehrere Soundspuren laufen nicht synchron - Flashforum Says:
    March 31st, 2010 at 8:37 pm

    [...] [...]

  62. PaesPedro Says:
    April 29th, 2010 at 3:58 pm

    Hello! Do you guys know if there’s a way to change a MP3 header information directly from flash? I’m trying to figure out a way to prevent the MP3 file be executed (e.g. Windows M Player).


  63. Peter's Blog » 关于Flash10中声音的变调处理 - All about Flash tech… Says:
    May 28th, 2010 at 3:46 pm

    [...] http://blog.andre-michelle.com/2009/pitch-mp3/ [...]

  64. Anonymous Says:
    July 6th, 2010 at 8:36 pm

    [...] gibt es leider keine native Flash-Sound-API zum Pitchen von Sounds, du musst alles selber machen. Ansonsten ist auch das interessant __________________ aM blog | hobnox | laboratory | sources | processing Adobe, MAKE SOME [...]

  65. prashn64 Says:
    July 27th, 2010 at 6:09 am

    This is really good, but it doesn’t work with a low quality mp3, because you will hear some “pops” every few milliseconds.

  66. Julien Says:
    August 10th, 2010 at 4:45 pm

    Very nice work !

    The question has already been asked but, how can you pitch a loop wav loaded in the library ?

    For a car game i would like to play pitch the engine sound.

    Tanks !

  67. Andrei Says:
    August 12th, 2010 at 1:56 pm


    Can you please post all the source files of this example.
    I need to see how you calculate the position that you show on the progress bar depending on the speed.


  68. Flastar » AS3 links №1 Says:
    October 27th, 2010 at 8:23 pm

    [...] in AS3 AS3 Flash: Low CPU Clouds Animation Debug Text has been updated Conditionals Performance Pitch MP3 WordPress AS3 API Preview New Flame AS3 Pixel Bender 3D for the new Flash player Molehill APIs AS3 [...]

  69. Adam Says:
    November 2nd, 2010 at 2:54 pm

    Hello Michelle I really like this. could you please send me all the source files?
    Thank you.

  70. Ivan Says:
    November 14th, 2010 at 6:08 pm

    Thanks for this great work.
    Unfortunately I have as well the problem of “clicks” and “pops” during playback, even if I provide 8192 samples.
    Have you maybe some idea to improve or fix this lack on the audio quality?

  71. Andre Michelle Says:
    November 14th, 2010 at 6:14 pm

    @Ivan On what system? This example should take almost no cpu performance.

  72. Ivan Says:
    November 14th, 2010 at 8:08 pm

    well, I’m trying on some not powerful pc and netbook… so probably it’s for this reason but I was really interested to understand if is possible to use some tips to improve a problem like this.

  73. Pip Jones Says:
    November 26th, 2010 at 5:31 am

    Seriously cool! It works so smoothly.
    Thanks for sharing this.

  74. Tanel Teemusk Says:
    November 30th, 2010 at 10:27 pm

    Very nice script. Just awesome and works perfect.

    If you want to loop the sound then write two lines of code:
    _position = 0.0;

    at the end right after where it says:
    if( i < BLOCK_SIZE )

    so it'll look like:
    if( i < BLOCK_SIZE )
    _position = 0.0;
    while( i < BLOCK_SIZE )
    data.writeFloat( 0.0 );
    data.writeFloat( 0.0 );


    Now I gotta figure out how to set the volume for the audio.

  75. 【見た聞いた】FITC Tokyo 2010, Andre Michelle「拍動性クラックル」Pulsatile Crackle | イナヅマtvログ Says:
    December 6th, 2010 at 9:11 am

    [...] [Pitch MP3] mp3再生を逆回転させたり、スピードを変えるデモ。 Pitch MP3 : http://blog.andre-michelle.com/2009/pitch-mp3/ [...]

  76. Tip: Modificar el tono de un audio en as3 con MP3Pitch « Los Tiempos Cambian Says:
    December 27th, 2010 at 11:56 am

    [...] más grave) y la verdad es que estuvimos dando poco más que palos de ciego hasta que dimos con este ejemplo, donde por cortesía de Andre Michele encontramos la clase MP3Pitch en ActionScript 3 que se [...]

  77. Ravi Says:
    January 27th, 2011 at 2:56 pm

    any body help me about pitch shifting in actionscript2.0 version.is it possible through as2.0 version.if it is possible please help me on this

    thanks & regards
    G.Ravi kumar

  78. AS3 Code Libraries (APIs) | bytecoderz blog Says:
    February 2nd, 2011 at 10:42 am

    [...] Pitch MP3 – Change speed of sound in realtime (Not PitchShift!) http://blog.andre-michelle.com/2009/pitch-mp3/ [...]

  79. Paul Says:
    April 6th, 2011 at 5:09 pm

    Nice example, however, this is inapplicable in a game, a 3072 loop per frame every time you play a sound will kill your performance.

  80. Brian Says:
    May 3rd, 2011 at 9:58 pm

    Schön gemacht, aber ich frage mich WARUM zur HÖLLE muss jedes Flash 100% audiolautstärke haben? Das kann man doch runter regeln zu Beginn.
    Man geht auf diese Seite und einem fliegen erst mal die Ohren davon… ich versteh es nicht.

  81. IR35 Says:
    July 17th, 2011 at 7:26 pm

    In before the lock!!!!!

  82. Evanduril Says:
    July 26th, 2011 at 11:35 am

    No documentation? No help? I have no idea how to use it.

    var pitch:MP3Pitch = new MP3Pitch();

    And now what ?

  83. sascha/hdrs Says:
    September 5th, 2011 at 2:12 pm

    Basic Channel! Top Notch!

  84. Pitch-shift MP3 loops in Flash | Indie Game Developer Breakdance McFunkypants Says:
    October 27th, 2011 at 6:11 pm

    [...] is based upon great work by Andre Michelle (there was always credit listed in the source code, but it was too subtle for some [...]

  85. ActionScript Фреймворк | НОВОЕ ИЗМЕРЕНИЕ Says:
    October 31st, 2011 at 3:35 pm

    [...] — Flash/Alchemy порт небольшого кодировщика Shine MP3. Pitch MP3 — изменение скорости звука в реальном времени [...]

  86. Kristian M Says:
    February 23rd, 2012 at 2:14 pm

    Hi there !!!

    I wanted to ask how I can change the pitch of whole ByteArray at once ? Then I want to save it locally, but that part is not the problem…:)
    I need to change a lot of files to different pitches so that’s why I need this ..
    Thanks !

  87. Changing the pitch of a looped sound at runtime with Actionscript. | Plastic Sturgeon Says:
    May 16th, 2012 at 2:28 am

    [...] a starting place I found this excellent blog post from Andre Michelle. It showed me everything i needed to know about how to change the pitch. But it did not work with [...]

  88. Benoît G. Says:
    May 30th, 2012 at 12:48 pm


    Works fine with 44100Hz, but with a 22050Hz I have interference, a regulary noise.
    How adapte algorithm for various bitrate ?

  89. Chota Bheem Says:
    January 18th, 2013 at 6:05 pm

    Nice example, however, this is inapplicable in a game, a 3072 loop per frame every time you play a sound will kill your performance.

  90. Очень много полезных штук для AS3 #2 | BomBear Says:
    February 1st, 2013 at 9:48 am

    [...] Flash/Alchemy порт небольшого кодировщика Shine MP3. Pitch MP3 — изменение скорости звука в реальном времени [...]

  91. greguarr Says:
    July 10th, 2013 at 12:23 pm

    Working link to source code – fla file is http://www.leebrimelow.com/flash/pitcher.fla

  92. Mike Says:
    October 3rd, 2013 at 6:33 pm

    Great work!

    Is there a way to pitch live audio coming in through the computer’s microphone input?

  93. RADIAS circles the plughole | acatcalledfrank Says:
    October 27th, 2013 at 10:23 pm

    [...] going to pan out either, so changing things up should let me look at that again. There’s some cool Flash tech that lets you pitch music up or down on the fly, which would be a good fit for the DJ/music creation vibe of [...]