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

  • SEARCH
  • Home
  • 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 8402789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:09:47+00:00 2026-06-09T22:09:47+00:00

I need to record audio using AudioRecord class for a specific time. Let’s say

  • 0

I need to record audio using AudioRecord class for a specific time. Let’s say for 1 second. And then process the audio, and when the processing is done, record again for 1 second and keep repeating this until I close the program. What would be the best approach for this?

  • 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-09T22:09:48+00:00Added an answer on June 9, 2026 at 10:09 pm
    public void recordandprocess()
    {        
    
    AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
                44100, AudioFormat.CHANNEL_IN_STEREO,
                AudioFormat.ENCODING_PCM_16BIT, bufferSize);
    
            recorder.startRecording();
    
            //executes run() after 1000 msec
            Handler handler = new Handler(); 
            handler.postDelayed(new Runnable() { 
             public void run() { 
                          recorder.stop();
                          recorder.release(); 
                          // do your processing here
                          recordandprocess(); //recursive call to this function to start recording after processing is done
             } 
        }, 1000); 
            .
            .
            .
          return;
    }
    

    Call this function once in onCreate() and it will continue calling itself recursively until your activity is killed by the system.

    If you want to stop recursion when you press back or home button, then check a boolean inside the function before executing all the code in it. Set the boolean to false in your onPause().

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

Sidebar

Related Questions

I need to record only my application audio I used AudioRecord and MediaRecorder but
I need to record more than one audio at a time. I have two
I need to record audio clips from web browser using flash and store them
I need to record audio stream with iPhone mic. I am using AVAudioRecorder from
I need to play and record at the same time. The problem is that
I want to make a program that would record audio data using PortAudio (I
I need to record audio and video files to the 3gp/mp4 format in the
I am building an application that would record what people say, generate an audio
I am making an audio recorded using NAudio in C# and i need to
I am trying to record audio using an iPhone app and send the audio

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.