Question: 6 Lab Task 1 : Create a Random Rhythm Let's add notes with random rhythm intervals to our phrase. We want the snare drum part

6 Lab Task 1: Create a Random Rhythm
Let's add notes with random rhythm intervals to our phrase. We want the snare drum part to play 24 notes of random rhythm.
6.1 Learn about Java Math utility class
The utility class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm,
square root, and trigonometric functions.
Take a look at the Java documentation for Math. Find the method random(). Under the Main class you have created in Section 2,
use the following code to observe random method's behaviour. Run the main method a couple times and see how the printed value
change.
System.out.println(Math.random());
Listing 6: Generate a random value
6.2 Create a note with a random interval
In the first jMusic lab, we used Play.midi() method to play a song of our choice. We know that a Note object constructor takes two
arguments:
6 Lab Task 1 : Create a Random Rhythm Let's add

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!