Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to create a void play(double duration) reference class. This plays t

ID: 3551043 • Letter: I

Question

I am trying to create a void play(double duration)  reference class. This plays the frequency for the number of seconds specified by the duration parameter. Here is what I have put together so far but I have error markings on my code:


public void play(double duration){

final int sliceCount(int)(stdAudio.SAMPLE_RATE * duration);

final double[] slices = new double[sliceCount + 1];

for(int i = 0; i < sliceCount; i++){

slices[i] = Math.sin(2 * Math.PI * i * this.frequency / StdAudio.SAMPLE_RATE);

}



It gives me an error markings on all the lines exept the last one. Could you give me a hint as to what I could be missing?



Thank you




Explanation / Answer

You need to post the main code, but from what you posted, you forgot the = sign in line two.


final int sliceCount=(int)(stdAudio.SAMPLE_RATE * duration);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote