Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-24-2008, 10:57 PM   #1
Elephantium
Registered User
 
Join Date: Apr 2008
Posts: 11
Default Audio recording in Flex

I'm having trouble recording streaming audio from a Flex 3 app to Flash Media Server. Via other programs, I'm able to record audio successfully, so I ruled out the microphone itself as a culprit.

In my code, once the user clicks on the 'record' button, the following code gets executed (it's in a method in an AudioManager object).

The _audioStream is a custom AudioStream that extends the NetStream class.

Code:
public function recordAudio(filename:String):void {
	
	this._audioStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
	this._audioStream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
	this._audioStream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
	this._audioStream.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
	
	this._isPublishing = true;
	this._isPlaying = true;
	
	//this._audioStream.recordAudio(filename);
	var mic:Microphone = Microphone.getMicrophone();
	trace("Microphone: " + mic);
	mic.rate = 22;
	mic.setSilenceLevel(1);
	mic.gain = 100;
	
	this._audioStream.attachAudio(mic);
	this._audioStream.publish(filename, "record");
}
I'm also setting appropriate event handlers (onNetStatus, etc). According to the NetStatusEvents, I'm successfully getting a stream, but when I speak into the microphone, the stream doesn't get any data.

Console output:

Start recording
NetStream.Publish.Start
NetStream.Record.Start
NetStream.Buffer.Empty
NetStream.Buffer.Empty
NetStream.Buffer.Empty
Stop recording
NetStream.Record.Stop
NetStream.Unpublish.Success

I'm really stuck - I can't think of any logical reason why the NetStream would silently fail to get data from the microphone Can anyone see something I missed?
Elephantium is offline   Reply With Quote
Old 07-20-2009, 12:20 PM   #2
serrega
Registered User
 
Join Date: Jan 2009
Posts: 6
Default

http://actionscript3.blogs2k.com/200...cording%20-AS3
serrega is offline   Reply With Quote
Old 07-20-2009, 03:31 PM   #3
wvxvw
Holosuit User
 
wvxvw's Avatar
 
Join Date: Oct 2006
Location: Tel Aviv
Posts: 4,301
Send a message via ICQ to wvxvw
Default

1. How do you knoe stream doesn't get any data?
2. I'm really not sure about silence level and gain - why won't you leave them with default values, maybe the mic never publishes anything because of that. (I really don't know what exactly each one of them is supposed to do tho).
3. Are you sure, the microphone was found? (you don't show this in the output). Macs in particular tend to mess with the devices installed, they can sometimes show you a bunch of "virtual" web-cams and microphones as if they ware installed there...
__________________
The .NET open source editor for Flash and web developers
*This would be my contribution to the project*
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Recording Feature in Flash salim_designer ActionScript 2.0 4 05-21-2007 06:12 AM
Recording audio from Flash using external app anderson Other Flash General Questions 1 03-03-2006 02:21 AM
audio recording problems... Ozero Other Flash General Questions 0 10-25-2004 01:44 AM
Questions about audio recording and QT video Sarah012 Flash Media Server 0 07-19-2004 01:04 PM
audio stuttering erank Other Flash General Questions 0 03-29-2002 07:28 PM


All times are GMT. The time now is 05:04 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.