At A Glance Main Projects Tutorials Resume

Contact


Email: palen1c at gmail.com




Real Time Voice Alteration Using Flash 10 and Actionscript 3 with the Flex Compiler

Fri, 27 Aug 2010 10:47:27 EST

A little critter that will help alter your voice.
I have put together a rough example of using the new functionality in Flash Player 10.1 of altering the microphones raw byte data as it is fed to the speakers. A lot of the examples out there force you to record a small bit first, then do the alteration. The class I put together has the ability to do good alteration on an mp3 and rough alteration on microphone input in real time. The example below just shows the functionality of altering the microphone in real time. It may be that people don't have any good real-time examples because it isn't possible?

I was originally fooling around with the mp3 pitch modification for some of the functionality in the messaging system I have been working on since November, 2009. I attempted for a long time to do rapid pitch modification during playback in Java, but it was a big mess, so I switched over to Flash and got something working in a week. You will need Flash Player 10.1 or higher for the example to work correctly. It is also using your default system microphone. If you have multiple audio inputs, it may not work correctly.

Obviously the real time microphone manipulation is still a little bit rough. I think it has to do with the rate at which the microphone is being sampled. If anyone has any ideas about how to improve it, I would be very interested. You can download the entire project which I made using pure Actionscript 3, the Flex compiler, and Flashdevelop.



The graphics used in this project are Creative Commons Attribution so there are some people I need to thank:
"Red Squirrel with pronounced winter ear tufts in the Dusseldorf Hofgarten", Ray Eye, Wikimedia Commons
Katanga lion "Matadi" (*2001) and lioness "Luena" (*1998) in the Leipzig Zoo., Appaloosa, Wikimedia Commons
Knobs Icons by Deviantart artist iTweek

Link to Source Code Zip Archive

In order to do real-time mp3 playback modification; in the main.as file, instead of passing an index of your microphone as an integer, pass a string of the relative path to the mp3 file you want to play back.

private function createTempSoundPlayback():void {
if (tempSound == null) {
tempSound = new SpecialSoundPlayback();
tempSound.addEventListener(SpecialSoundPlayback.SOUNDLOADED, handleSoundLoaded, false, 0, true);
// You can pass this a relative path to a mp3 OR the system index of your microphone! Make sure to pass
// the path as a string and the mic index as an int
tempSound.loadNewFile('SoundFX/TestCount.mp3');
} else {
destroyTempSoundPlayback(true);
}
}


Charles Palen has been involved in the technology sector for several years. His formal education focused on Enterprise Database Administration. He currently works as the principal software architect and manager at Transcending Digital where he can be hired for your next contract project. Charles is a full stack developer who has been on the front lines of small business and enterprise for over 10 years. Charles current expertise covers the areas of .NET, Java, PHP, Node.js, Javascript, HTML, and CSS. Charles created Technogumbo in 2008 as a way to share lessons learned while making original products.

Comments

Charles
Charles
January 12, 2011 11:25 am

Although it doesn't include the microphone, Kevin Luck actually wrote a much more simple implementation then this one for people starting out. It's a lot easier to understand.

http://www.kelvinluck.com/2008/11/first-steps-with-flash-10-audio-programming/

Comments are currently disabled.