Audio Problem

View: New views
5 Messages — Rating Filter:   Alert me  

Audio Problem

by Svacha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.  I am testing a very simple audio component built in Flex and am running into an issue with the recording stopping too soon.  Sometimes the recorded audio is blank (0 kb) other times it cuts out portions of the audio or stops prematurely.  I am testing on a MacBook, running Red5 v. 0.7  Can anyone provide any insight on what might be causing this?  Here is the Flex code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="215" height="138" creationComplete="init()">
<mx:Script>
        <![CDATA[
                import flash.media.Microphone;
                import flash.events.ActivityEvent;
               
                private var connection:NetConnection;
                private var stream:NetStream;
               
                private function init():void
                {
                        connection = new NetConnection();
                        NetConnection.prototype.onBWDone = function(args) {
                        }

                        connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                        connection.connect("rtmp://localhost/oflaDemo");
                }
       
       private function netStatusHandler(event:NetStatusEvent):void {
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
            recButton.enabled = true;
                break;
            }
        }
               
                private function recordAudio():void
                {
                        var mic:Microphone = Microphone.getMicrophone();
                        mic.setLoopBack(false);
                        mic.rate = 44;
                       
                        stream = new NetStream(connection);
            stream.attachAudio(Microphone.getMicrophone());
            stream.publish("Earshow_" + Math.random(), "record");
                       
                        recButton.enabled = false;

                        stopButton.enabled = true;
                }
               
                private function stopRec():void
                {
                        stream.close();
                       
                        recButton.enabled = true;

                        stopButton.enabled = false;
                }
        ]]>
</mx:Script>
<mx:Button  x="10" y="10" label="Record" id="recButton" click="recordAudio()" enabled="false"/>
<mx:Button  x="84" y="10" label="Stop" id="stopButton" click="stopRec()" enabled="false"/>
</mx:Canvas>

Re: Audio Problem

by Dominick Accattato-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can try the following:

1. speak directly in the mic and wait 30 seconds.  Check the file size and you will notice that it does not show 0kb.
2. start the application but do not make a noise.  Wait 30 seconds.  The file size will be 0kb. 

Flash doesn't send any data until it hears the first bit of audio.  Let me know if you find similar results.


On Mon, Jul 6, 2009 at 6:24 PM, Svacha <sketisculpter@...> wrote:

Hi.  I am testing a very simple audio component built in Flex and am running
into an issue with the recording stopping too soon.  Sometimes the recorded
audio is blank (0 kb) other times it cuts out portions of the audio or stops
prematurely.  I am testing on a MacBook, running Red5 v. 0.7  Can anyone
provide any insight on what might be causing this?  Here is the Flex code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="215"
height="138" creationComplete="init()">
<mx:Script>
       <![CDATA[
               import flash.media.Microphone;
               import flash.events.ActivityEvent;

               private var connection:NetConnection;
               private var stream:NetStream;

               private function init():void
               {
                       connection = new NetConnection();
                       NetConnection.prototype.onBWDone = function(args) {
                       }

                       connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                       connection.connect("rtmp://localhost/oflaDemo");
               }

      private function netStatusHandler(event:NetStatusEvent):void {
           switch (event.info.code) {
               case "NetConnection.Connect.Success":
                                       recButton.enabled = true;
               break;
           }
       }

               private function recordAudio():void
               {
                       var mic:Microphone = Microphone.getMicrophone();
                       mic.setLoopBack(false);
                       mic.rate = 44;

                       stream = new NetStream(connection);
                       stream.attachAudio(Microphone.getMicrophone());
                       stream.publish("Earshow_" + Math.random(), "record");

                       recButton.enabled = false;

                       stopButton.enabled = true;
               }

               private function stopRec():void
               {
                       stream.close();

                       recButton.enabled = true;

                       stopButton.enabled = false;
               }
       ]]>
</mx:Script>
<mx:Button  x="10" y="10" label="Record" id="recButton"
click="recordAudio()" enabled="false"/>
<mx:Button  x="84" y="10" label="Stop" id="stopButton" click="stopRec()"
enabled="false"/>
</mx:Canvas>

--
View this message in context: http://www.nabble.com/Audio-Problem-tp24363897p24363897.html
Sent from the Red5 - English mailing list archive at Nabble.com.


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Audio Problem

by Svacha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The steps I am taking are I launch the app, press record and grant access to the microphone.  I then test by reading a paragraph from a book.  When I am done, I press stop and check the flv.  Sometimes the flv is 0kb, other times the audio seems to cut out pieces -- as if the recording paused and then unpaused after 10 seconds or so.

I am going to check mic sensitivity -- shouldn't be an issue here, as well as if the wrong mic is being selected by the flashplayer -- another issues I doubt is occuring.

Thanks!


You can try the following:

1. speak directly in the mic and wait 30 seconds.  Check the file size and
you will notice that it does not show 0kb.
2. start the application but do not make a noise.  Wait 30 seconds.  The
file size will be 0kb.

Flash doesn't send any data until it hears the first bit of audio.  Let me
know if you find similar results.

Re: Audio Problem

by Dominick Accattato-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah, it sounds like a hardware issue.  I don't believe it's Red5, you could try it with Red5 0.8 as well, but this problem didn't exist in 0.7 either.


On Tue, Jul 7, 2009 at 10:17 AM, Svacha <sketisculpter@...> wrote:

The steps I am taking are I launch the app, press record and grant access to
the microphone.  I then test by reading a paragraph from a book.  When I am
done, I press stop and check the flv.  Sometimes the flv is 0kb, other times
the audio seems to cut out pieces -- as if the recording paused and then
unpaused after 10 seconds or so.

I am going to check mic sensitivity -- shouldn't be an issue here, as well
as if the wrong mic is being selected by the flashplayer -- another issues I
doubt is occuring.

Thanks!


You can try the following:

1. speak directly in the mic and wait 30 seconds.  Check the file size and
you will notice that it does not show 0kb.
2. start the application but do not make a noise.  Wait 30 seconds.  The
file size will be 0kb.

Flash doesn't send any data until it hears the first bit of audio.  Let me
know if you find similar results.

--
View this message in context: http://www.nabble.com/Audio-Problem-tp24363897p24374005.html
Sent from the Red5 - English mailing list archive at Nabble.com.


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Audio Problem

by Svacha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your help.  Turns out it was a sensitivity issue.

Mic is turned up and I am monitoring silence level -- everything is working great.

Thanks again!


Dominick Accattato-2 wrote:
Yeah, it sounds like a hardware issue.  I don't believe it's Red5, you could
try it with Red5 0.8 as well, but this problem didn't exist in 0.7 either.



On Tue, Jul 7, 2009 at 10:17 AM, Svacha <sketisculpter@yahoo.com> wrote:

>
> The steps I am taking are I launch the app, press record and grant access
> to
> the microphone.  I then test by reading a paragraph from a book.  When I am
> done, I press stop and check the flv.  Sometimes the flv is 0kb, other
> times
> the audio seems to cut out pieces -- as if the recording paused and then
> unpaused after 10 seconds or so.
>
> I am going to check mic sensitivity -- shouldn't be an issue here, as well
> as if the wrong mic is being selected by the flashplayer -- another issues
> I
> doubt is occuring.
>
> Thanks!
>
>
> You can try the following:
>
> 1. speak directly in the mic and wait 30 seconds.  Check the file size and
> you will notice that it does not show 0kb.
> 2. start the application but do not make a noise.  Wait 30 seconds.  The
> file size will be 0kb.
>
> Flash doesn't send any data until it hears the first bit of audio.  Let me
> know if you find similar results.
>
> --
> View this message in context:
> http://www.nabble.com/Audio-Problem-tp24363897p24374005.html
> Sent from the Red5 - English mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Red5 mailing list
> Red5@osflash.org
> http://osflash.org/mailman/listinfo/red5_osflash.org
>

_______________________________________________
Red5 mailing list
Red5@osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org