Today Alan Queen pointed me to his AIR application that allows to mix wave samples. It`s a really nice AIR application but what was the most remarkable thing is that it actually mixes samples and outputs a new wave file. That`s what i always (and still ;-)) dream to do with RichFLV but reencoding FLVs and Mp3 files with actionscript may not be possible because of the complex algorithms used for compression. But still i had to find out how it`s possible with Wave files. The trick is that the wave files have to be in PCM format. PCM is a periodical measure of acoustic pressure at regular intervals and thats why it`s possible to easily modify samples of PCM data with simplest math lik addition π In order to mix two samples you just sum up the values of the two samples. Crazy easy!
So here is a quick and really dirty test:
This AIR app mixes two wave files. The wave files should have the same sample rate and have to use PCM encoding. I did not test it really well and stopped working on it when i got some results so this might not work with all waves. Yeah it`s pretty ugly (codewise) but i think i will not put more time into this so i thought i share this information and my code. I was also able to do some other modifications like modifiying the volume and stuff like that.
Get the AIR app: WaveReader.air
Get the Flex Project (source): WaveReader.zip
Now I go back to my super cool AIR project I`m working on ( to be released in december 08 07 ;-)) . And I`ve also started to work on RichFLV Version 2! Yeah i skip version1.0 and go directly to 2.0. In this version you`ll be able to import multiple FLV and Mp3 files and merge them together with all the export and editing functionality of version 1. Ah yeah and i`ve not forgotten my article series π I`ll continue that soon – hopefully.
Leave a Reply