SoundMixer.computeSpectrum + Microphone?
This weekend I got the idea to try creating a chromatic tuner in AS3 using input from the Microphone and SoundMixer.computeSpectrum. According to the Adobe livedocs:
“The SoundMixer class contains static properties and methods for global sound control in the SWF file.”
This however does not seem to be fully the case. There is a caveat in computeSpectrum docs stating “this method cannot be used to extract data from RTMP streams”, but it doesn't say anything specifically about getting spectrum information from the Microphone object. I'm not sure how - technically - compute spectrum works currently (IE: tech limitations on generating it off microphone or streaming - imagine visualizations on streaming radio like Pandora ).
It seems to me that there would be all kinds of interesting applications we could build with access to the spectrum for the microphone. Is there something I'm missing? Can anyone else see potential ideas for this?
Others Have Said
Did you manage to get anywhere with this?
Unfortunately no. However I did speak with Mike Chambers last night briefly at the on AIR bus tour. It seems that this is a fairly common request - though the loaded sounds / streaming sounds / and mic inputs probably are all processed differently. If we keep letting them know it's a feature we'd like to see, then maybe we could see it in the future. =)
you cannot get spectrum data from the microphone object - I remember in beta that it is indeed a different path for that audio than through the Sound object. You can still access activity level, etc. but its not quite the same. Thanks for asking Mesh about it.
Yeah, that's pretty much exactly what he said about it. Though it does give me hope to know that it is a commonly requested feature, as it means we can have hope for more exciting possibilities. Being able to throw a visualizer on streaming audio or video, or creating chromatic tuners or voice recognition or beyond. Good stuff!
Sorry for repeating, but I just can't believe it. So I have to be sure. You CAN NOT get spectrum data when using microphone??? I was about to build by graduation work on it.. :-((
That's correct blackie. You can only get spectrum data from loaded sounds, it is *not* available from Microphone, Line Input, or streaming sources. However, as I said it seems to be a popular request. So make your voice known to Adobe to try and get this feature added!
I have also been looking all over the net for microphone stuff. I don't understand that they havent fixed it, i have seen maybe 50 people request it online suggesting at least 20 times as many trying to get it to work ;). Hope they listen!
Does somebody know of a workaround to display the spectrum with streaming sounds? Anywhere.FM seems to have a solution that seems to work... (sometimes) ;) Go check it out on http://www.anywhere.fm/player
Hans - I wasn't able to get the visualization to actually work at all. Off the top of my head I would say there are a couple possibilities: It could be faked, or the spectrum information could be generated beforehand from the mp3 and sent down to the client.
I'm building a little program to do this. I made a short video of this first step; http://www.youtube.com/watch?v=7zlyO0adKMU If anyone is interested, let me know!
Cool stuff! You accually wrote a fourier transform function?
jankees - that is some cool stuff, can't wait to see what comes of it! Boris - there is an option built into the SoundMixer object to do a fast fourier transform when you get the spectrum information, so there was no need for me to write my own. =)
Is adobe plan to fix that fucking class for the microphone ? S.
Sakana: Never. Flash Media Server is $1500 and a huge moneymaker for Adobe. That's why the mic input and video input go into black boxes -- so you can't get the raw data from it and transmit or save the bytes. Otherwise there would be no need for Media Server. Adobe (and Macromedia before them) are not interested in being charitable. It sucks, but this is one reason why Flash is closed-source and it gives Adobe the ability to remain in control of their product. Companies like Apple, MS, and Adobe can do stuff like this because their software is used everywhere anyway, so doing immoral things with their code, forcing developers to abide by their rules, and pay for endless upgrades and components will continue to be done unless people simply stop using their software (which won't happen).
Correction: Media Server is $5000. My bad.
When Red5 will be released you won't have to worry about FMS being $5000
I´m not able to get the visualization to actually work at all.
Because sound data from a microphone or from RTMP streams do not pass through the global SoundMixer object, the SoundMixer.computeSpectrum() method will not return data from those sources.
so what was the conclusion/ did u make it or not
So with Flash Media Server, is it possible to process the mic audio into the SoundMixer? I need a solution for this, even if it cost 5 grand for the software to enable it.
You can record a sample using FMS (or Red5 btw) and then process it on the server. It will be 'offline' and not 'realtime' but as realtime as possible. Other solution is to build something else than Flash, think out of the box. Java. ActiveX. Will take a while to build but if you -need- 100% access to mic-data then that's the best option.
Been waiting on this for a while, exhausted the forums as have many others it seems. with a mic, computspectrum could be amazing, ESP in the VJ world. Lets hope theres a change in cs4.
Yes, I have been trying to answer this one, and passed it along to the Silicon Valley Flex User Group, and still no prevail. Adobe ought to find a solution. It seems too banal to be overlook by Adobe.
So if I want to create something tyo react to a sound played live, what do I use? Stream sound? How delayed will th result be? What is the delay depending on? Sorry I'm not used to use sound with flash...
Anything new on all of this? I want badly to at least decode dial tones from the microphone input.
...and you know what is equally as irritating, the fact that products like Zinc don't add this into their API. Perhaps it's something that's more complicated than it seems. A .net friend said he could write me .dll that I could connect with using Zinc...it's just a shame that Adobe don't have the foresight to build something like this into their product. Let's face it. Adobe have to make Flash amazing or it will die with both upgrades to DHTML and Silverlight competition.
after months of testings, I have been able to do this realtime, using a hack and the adobe Stratus(tm) service : http://testings.resistcorp.org/flash_mic/testP2P.html -- doesn't work behind a proxy, though.
Your stuff is very useful.
Can u share the source code for your example or at least give us some explanation on how you managed to do this thing.
Vote on the feature request to get computeSpectrum to work with the microphone here: https://bugs.adobe.com/jira/browse/FP-4592
somebody found a workaround! Basically, one ascribes manually a buffertime to NetStream and then computespectrum works with a live stream. Check: http://www.pubbs.net/200911/osflash/55861-red5-soundmixercomputespectrum-rtmp-livestream.html

My name is Mike Johnson, though many know me as exorcyze. I have been in love with programming
for over 25 years and use Adobe Flash for most of my personal experiments. I enjoy sharing
knowledge and study almost anything. Most of my professional work is in Actionscript, C#.Net and PHP.
