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 6362593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:55:45+00:00 2026-05-24T23:55:45+00:00

My android app is trying to generate white noise to play on an android

  • 0

My android app is trying to generate white noise to play on an android device. Currently, I’m generating an array of random numbers that is AudioTrack.getMinBufferSize(…) shorts long, and looping through in a timer. It looks like this:

    INTERVAL_MILLISECONDS = (int)((double)(bufSize) / (double)(nativeSampleRate * 2) * 1000);

    timer.scheduleAtFixedRate( new TimerTask() {

        public void run() {
            synchronized(this){
                //System.out.println("playing. Sample rate is + " + nativeSampleRate + ", buffer is " + data.length + " shorts long, interval is " + INTERVAL_MILLISECONDS);
                track.write(data, 0, bufSize);
                track.play();
            }
        }

    }, 0, INTERVAL_MILLISECONDS);

But when I listen to it on my android emulator, I get white noise with a very rapid “beating” or “bleating” rhythm that’s hard to describe. I’m not a sound engineer, can someone point me in the right direction about why this is happening?

************** UPDATE ************
I just did a couple of variations, one where I made sure my sample size was a whole number of milliseconds long, and one where I made my sample size a whole second long.

With a sample size of 8820 (five milliseconds long, and still over the 8192 minimum), the beating is unchanged.

However, with a sample size of 44100 (a whole second), the beating went away. Is it possible the timer I’m using just isn’t accurate at the small intervals?

  • 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-05-24T23:55:46+00:00Added an answer on May 24, 2026 at 11:55 pm

    The problem seems to be the way you’re generating white noise. I don’t know the first thing about programming on the android, but if I understand the question correctly you’re creating a single buffer’s worth of random data then cycling through it over and over again.

    The problem, (as your update points out) is that this single buffer is repeating several times a second. This means it’s no longer ‘white’ (i.e. completely random) noise. It’s become periodic.

    Your brain is very good at picking out periodic waveforms, hence why you hear this beating. It’s your brain telling you that there’s something going on other than the white noise. Here you’re introducing a strong component around 5.38Hz, which when modulating the rest of the audio you interpret as a “beating” effect.

    The beating disappears (or decreases below perceptibility) when you increase the buffer length because at 44100 samples your brain no longer has enough to latch on to, and hence fails to recognise that the sequence is periodic. The low frequency information will still be there though.

    Generating perfect white noise isn’t as straightforward as you might think!. In your case I think it’s best to make the noise buffer as long as possible – depending of course on the context of the application you’re building.

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

Sidebar

Related Questions

I'm trying to create an Android app that adds a random quote to images.
I'm trying to debug an android app that call native code to do some
I'm trying to build an android app that would do a local search on
I trying to put together an Android app that will take a picture and
I'm trying to create an app for Android that simply sends a command to
I am trying to generate on my Android app pkcs7 file to communicate between
I'm trying to make and android app with some dynamically drawn views. Currently, the
I'm currently trying to develop an encryption app for Android using ECDH and BouncyCastle.
i've been trying to create a map-related android app, but i realized that the
I'm trying to create an Android client for a client/server app that has previously

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.