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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:57:30+00:00 2026-06-15T23:57:30+00:00

I am developing a musical application that plays several sounds all together, like a

  • 0

I am developing a musical application that plays several sounds all together, like a sort of multitrack program. A timer triggers when it’s the moment for all the sounds to play. Sounds have to be played exactly on the beat and perfectly synchronized and mixed.

The easiest solution i found is to have one MediaPlayer for each sound, initialize all of them at the very beginning, with MediaPlayer.create() inside my app’s OnCreate().
To make it more reliable and quick I made TWO mediaplayers for each sound.
Then I have a timer that calls simple loop, similar to this:

for (int w=0; w<SOUNDS; w++)
    if (must_play(w)) {
        if (mp[w].isPlaying()) {
            if (mp2[w].isPlaying())
                mp[w].seekTo(0);
            else mp2[w].start();
        } else mp[w].start();
    }

I used .seekTo(0) because I found it slightly faster than making .stop() and .start().
But the sounds are not always perfectly synchronized. A 1/10 of second of delay between the .start() of two mediaplayers is very annoying if those two sounds are two drums that are supposed to play perfectly in line.
Is there a way to force all mediaplayers that are instructed to .start() to effectly play all at once?
Please note that the sounds may be very short, like drum sounds: the problem is not to keep the multiple media players synchronized over time, but to make them start exactly all together, without delay.

The question is rather tricky because in my opinion involves two problems:

  • Prioritization, above other processes that may slow down the timer or the app itself.
  • How to create a single command/object/method (or whatever) that runs all the sounds atomically.

Thank you.

  • 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-15T23:57:30+00:00Added an answer on June 15, 2026 at 11:57 pm

    I made it, just used the SoundPool class instead of MediaPlayer. It’s much more responsive, and handles very well multitracks, even cutting the oldest sound played if the streams are not enough. Although the questions weren’t answered, the problem is fixed.

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

Sidebar

Related Questions

Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
iam developing one application.In that i need to get the music files from the
I'm developing a musical game, it's like a singstar but instead of singing, you
Developing an application for Android, i want to record data that will be usefull
I developing a program that draws in elements of the list (QListView). How do
I'm developing an application which extracts information about musical events from Last.fm API. However,
I am developing an iOS application which resembles a musical instrument. I am trying
Im developing a windows forms application using C# 4.0 and that application is going
Im developing a web application in asp.net mvc (c#) that has a form and
I'm developing a virtual musical keyboard that allows you to press keys on your

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.