in Education by
I'm currently working on a project which is a small educational game for children. Right now I am working on the intro screen and I seem to be having some issues with the sound. Initially I thought that perhaps the mp3 files could have been causing the issue because I had read that it's better to use .wav files instead. The two sounds are a buzzing bee sound, and the opening theme when the game opens. Sometimes it works flawlessly and there aren't any problems, other times the sounds both play for a second and then cut out. If someone could point my in the right direction that would be a great deal of help. I've tried to convert the files to .wav files, this doesn't really seem to fix the issue. I've tried to define the mediaplayers as properties, to avoid the garbage collection routine which is clearing the instance of the mediaplayer. This also doesn't seem to fix the issue. public class Intro extends Application{ MediaPlayer mediaPlayer; MediaPlayer mediaPlayer2; @Override public void start(Stage primaryStage) { // TODO Auto-generated method stub //THE BEES String musicFile = "thebees.wav"; String music2 = "opening.wav"; Pane root = new Pane(); Scene scene = new Scene(root, 600, 500); //Bee sound Media sound = new Media(new File(musicFile).toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(sound); mediaPlayer.play(); Media sound2 = new Media(new File(music2).toURI().toString()); MediaPlayer mediaPlayer2 = new MediaPlayer(sound2); mediaPlayer2.play(); What I'm going for is that when the intro screen is opened that both files will play simultaneously. Thank you again to anyone who helps! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You could just combine the files into a single file following the method here. Make sure to combine, not concatenate. If one file is longer than the other you can just zero pad until the lengths are equivalent. It sounds like in the linked post there were equalization or clipping problems. I would normalize (i.e. 1 is maximum .wav value) both files to half of the maximum value (make 0.5 the maximum value) and then simply add each sample together to get a combined audio file guranteed not to clip. Each file has the same volume following this method. If different sampling rates were used between the files use upsampling/downsampling as appropriate.

Related questions

0 votes
    I'm currently working on a project which is a small educational game for children. Right now I am ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    Multiple objects can be de parsed at once using the ______ function. (a) dput() (b) write() (c) ... and Operations of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    Multiple objects can be de parsed at once and read back using function _____ (a) source() (b) read() ( ... Operations of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    How to Catch multiple exceptions at once in C#?...
asked Jan 15, 2021 in Technology by JackTerrance
0 votes
    What is the study of how the language sounds? (a) Speechology (b) Biology (c) Trilogy (d) Phonology Please answer the above question....
asked Oct 22, 2022 in Education by JackTerrance
0 votes
    If a Siren sounds for every 5 seconds, how many times will it sound in ¾ of an hour? A) 541 times B) 540 times C) 450 times D) 275 times...
asked Feb 14, 2021 in Education by JackTerrance
0 votes
    A single ______________ further allows the user to be authenticated once, and multiple applications can then ... in chapter Database Programming Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    In NoSQL databases, the data can be stored ___________. (1)Multiple times (2)Only once...
asked Apr 21, 2021 in Technology by JackTerrance
0 votes
    I have a table with on my SQL server with 16 rows, I am trying to print out the BasePT column ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    I am getting the following error as Java 11 excluded the JavaFX as part of the latest version. Error: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I think it goes without saying that I should be able to use Oracle's own JDK with JavaFX (from ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have a barChart : that looks like this The bars align to the left of the category, for instance ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    Two cards are drawn at random and without replacement from a pack of 52 playing cards. Find the probability that ... cards are black. Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    A die is thrown and a card is selected at random from a deck of 52 playing cards. The probability of getting an even ... 1/8 D. 3/4 Select the correct answer from above options...
asked Nov 20, 2021 in Education by JackTerrance
...