2 Replies Latest reply on Aug 25, 2009 4:07 AM by liquid8x

    Inputting audio in realtime

    liquid8x Level 1

      Hi!

       

      I'd like to create an application which takes an input from computer's audio input jack and responds to the volume of the input signal.

      Any ideas or tips / links where to start with this?

        • 2. Re: Inputting audio in realtime
          liquid8x Level 1

          I found information with an example from livedocs.adobe.com. I'm getting this error:
          "1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code."

           

          It's coming from this row:

          "mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);"

           

          I'm trying to use this example directly in WindowedApplication.

          Here's the full code:

           

           

          <?xml version="1.0" encoding="utf-8"


          <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
             
          <mx:Script>
              <![CDATA[
          import flash.media.Microphone;

           

          var mic:Microphone = Microphone.getMicrophone();
          mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);

           

          function onMicStatus(event:StatusEvent):void
          {
              if (event.code == "Microphone.Unmuted")
              {
                  trace("Microphone access was allowed.");
              }
              else if (event.code == "Microphone.Muted")
              {
                   trace("Microphone access was denied.");
              }
          }


              ]]>
          </mx:Script>

             
          </mx:WindowedApplication>

           

          So obviously something is wrong. Should this coe be inside a class or what?