Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9255431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:42:59+00:00 2026-06-18T11:42:59+00:00

Now I have a code like this: soundData = new ByteArray(); microphone = Microphone.getMicrophone();

  • 0

Now I have a code like this:

soundData = new ByteArray();
microphone = Microphone.getMicrophone();
microphone.codec = SoundCodec.SPEEX;
microphone.rate = 8;
microphone.gain = 100;
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);

function micSampleDataHandler(event:SampleDataEvent):void {
  while (event.data.bytesAvailable) {
    var sample:Number = event.data.readFloat();
    soundData.writeFloat(sample);
  }
}

The raw data is recorded from the microphone. How do I go about casting it to a ByteArray after using SPEEX codec compression? Note that the converted data must play back.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:43:00+00:00Added an answer on June 18, 2026 at 11:43 am

    refer a this code.

    soundData.position=0;
    
    var soundOutput:Sound = new Sound();
    soundOutput.addEventListener(SampleDataEvent.SAMPLE_DATA, playSound);
    soundOutput.play();
    
    function playSound(soundOutput:SampleDataEvent):void {
        if (! soundData.bytesAvailable>0)
        {
            return;
        }
        for (var i:int = 0; i < 8192; i++) 
        {
            var sample:Number=0;
            if (soundData.bytesAvailable>0) 
            {
                sample=soundData.readFloat();
            }
            soundOutput.data.writeFloat(sample);
            soundOutput.data.writeFloat(sample);
        }
    }
    

    using a SoundCodec.SPEEX above code playrate not is 1x you should correct playSound function. maybe you tested. if you remove microphone.codec = SoundCodec.SPEEX; know.

    More information: Adobe Official Capturing sound input

    have a some problem when recorded in speex.

    refer a follow artice.

    http://forums.adobe.com/message/3571251#3571251

    http://forums.adobe.com/message/3584747

    If the SoundFormat indicates Speex, the audio is compressed mono sampled at 16 kHz. In flash, a sound object plays at 44khz. Since you’re sampling at 16khz(Speex), you’re sending data through the SampleDataEvent Event handler 2.75 faster then you are getting that data.
    so, you must changed the playSound for(or while) loop.

    I recommend following site. this article is ‘how to playrate adjust?’ great tutorial.

    http://www.kelvinluck.com/2008/11/first-steps-with-flash-10-audio-programming/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I have my code looking like this: SqlTables.java: // Separate file public
Right now, lets say I have code much like this... $some_var=returnsUserInput(); function funcA($a) {...}
I have code like this: // Create event handler delegate symbolReader.ReadNotify += new EventHandler(symbolReader_ReadNotify);
I have code like this string pattern = <(.|\n)+?>; System.Text.RegularExpressions.Regex regEx = new System.Text.RegularExpressions.Reg(pattern);
I have code like this in a method: ISubject<Message> messages = new ReplaySubject<Message>(messageTimeout); public
Now i have a json code like this: {1: { text:e1, children: { 1:
I have code like this.. $dir['subdir']; It returns value like this /2012/12/14 Now I
I have code like this: return (new File(pathA + File.separator + pathB + File.separator)).mkdir();
I have this code ,now can anyone reply s what happens to the lock
I have a code like this,In this context HandleDisconnectEventCB will trigger when client has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.