forked from processing/processing-library-template-ant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNote.java
More file actions
53 lines (43 loc) · 1.66 KB
/
Note.java
File metadata and controls
53 lines (43 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package codeandchords;
public class Note {
/**
* 06/12/2017
* Emily Meuer
*
* Class to create Notes that will be used to make a Melody.
*/
private int midiNum; // the midi number of the note
private float duration; // the length of the note in milliseconds
private float amplitude; // the amplitude of the note in undefined measure; not yet implemented
private boolean isRest; // true if the note is a rest
/**
* Creates a new Note with the given midiNum, duration, and amplitude and sets isRest to false.
*
* @param midiNum int denoting the midi number of the Note
* @param duration float denoting the length of the Note in milliseconds
* @param amplitude float denoting the amplitude of the Note (in unknown measurement - TODO?)
*/
public Note(int midiNum, float duration, float amplitude)
{
this(midiNum, duration, amplitude, false);
}
/**
* Creates a new Note with the given midiNum, duration, amplitude, and isRest.
*
* @param midiNum int denoting the midi number of the Note
* @param duration float denoting the length of the Note in milliseconds
* @param amplitude float denoting the amplitude of the Note (in unknown measurement - TODO?)
* @param isRest boolean that is true when the Note is a rest and false otherwise
*/
public Note(int midiNum, float duration, float amplitude, boolean isRest)
{
this.midiNum = midiNum;
this.duration = duration;
this.amplitude = amplitude;
this.isRest = isRest;
}
public int getMidiNum() { return this.midiNum; }
public float getDuration() { return this.duration; }
public float getAmplitude() { return this.amplitude; }
public boolean isRest() { return this.isRest; }
}