Skip to content

Commit 390c2f5

Browse files
committed
release v1
added Pachabel's canon because it's in the example of the readme finalised(?) the readme...
1 parent 4576988 commit 390c2f5

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

readme.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ A time signature is used in White Noise to decide *when* to play notes.
1616

1717
We represent a time signature with a list of evenly-spaced segments of a [bar](https://en.wikipedia.org/wiki/Bar_(music)).
1818
Example:
19-
2019
`_` `_` `_` `_`
2120

2221
In each entry, a non-zero value represents the possibility that a note can be played in that space of time.
2322
Example: ([Swing](https://en.wikipedia.org/wiki/Swing_(jazz_performance_style)#Swing_as_a_rhythmic_style) Feel)
24-
2523
`` `_` `` `` `_` `` `` `_` `` `` `_` ``
2624

2725
Finally each entry has a value indicating the *likelihood* that a note should be played in that space. (Lower values have a higher chance of being played.)
2826
Example:
29-
3027
`1` `_` `3` `1` `_` `3` `1` `_` `3` `1` `_` `3`
3128

3229
### Chords
@@ -46,8 +43,9 @@ These notes are then offset by some number of octaves (multiples of twelve in MI
4643

4744
A single time signature for a piece is fine, but only one chord would be boring. White Noise uses [Chord Progressions](https://en.wikipedia.org/wiki/Chord_progression) to change between chords and therefore available pitches. It plays through one iteration of the **Time Signature** bar, using notes from the first **Chord** in the progression, and then repeats the bar again with the next chord.
4845

49-
So finally we have a **Piece** which is composed of a **Time Signature**, some **Chords** and a **Chord Progression**.
50-
Example: (*Pachebel's Canon in D*)
46+
So finally we have a **Piece** which is composed of a **Time Signature**, some **Chords** and a **Chord Progression**.
47+
48+
### Example: (*Pachebel's Canon in D*)
5149

5250
#### Time Signature
5351

src/Rain.java

+24-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class Rain {
4848
final static int[] fourFour = {1,4,8,4,1,4,8,4,1,4,8,4,1,4,8,4};
4949
final static int[] swing = {1,0,2,1,0,3,1,0,2,1,0,3};
5050
final static int[] swing2 = {1,0,2,1,0,3};
51+
final static int[] canonTime = {1,8,4,8,2,8,4,8};
5152

5253
final static Chord[] frun = {
5354
new Chord(69,new int[] {0,4,7}),
@@ -99,6 +100,18 @@ public class Rain {
99100
new Chord(70,new int[] {0,4,7}),
100101
new Chord(70,new int[] {0,4,7}),
101102
};
103+
104+
final static Chord[] canon = {
105+
new Chord(74,new int[] {0,4,7}), // D Maj
106+
new Chord(69,new int[] {0,4,7}), // A Maj
107+
new Chord(71,new int[] {0,3,7}), // B Min
108+
new Chord(66,new int[] {0,3,7}), // F# min
109+
110+
new Chord(67,new int[] {0,4,7}), // G Maj
111+
new Chord(74,new int[] {0,4,7}), // D Maj
112+
new Chord(67,new int[] {0,4,7}), // G Maj
113+
new Chord(69,new int[] {0,4,7}), // A Maj
114+
};
102115

103116

104117
public static void main(String[] args) {
@@ -350,7 +363,7 @@ private void doDrawing(Graphics g) {
350363
g2d.drawString(txt,0,screenHeight/2);
351364

352365
txt = new String();
353-
txt+="1 and 2 change styles";
366+
txt+="1 - 4 change styles";
354367
g2d.drawString(txt,0,screenHeight/2+g.getFontMetrics().getHeight());
355368

356369
helpAlpha-=(float)1/TARGET_FPS/4;
@@ -390,6 +403,9 @@ public void keyPressed(KeyEvent e) {
390403
case KeyEvent.VK_3:
391404
changeToWay();
392405
break;
406+
case KeyEvent.VK_4:
407+
changeToCanon();
408+
break;
393409
case KeyEvent.VK_R:
394410
drawFPS=!drawFPS;
395411
helpAlpha = 1;
@@ -456,7 +472,14 @@ public void changeToMablas()
456472

457473
public void changeToWay()
458474
{
475+
459476
phatBeats = new Signature(swing2, 80, way, System.nanoTime());
460477
}
478+
479+
public void changeToCanon()
480+
{
481+
phatBeats = new Signature(canonTime, 30, canon, System.nanoTime());
482+
}
483+
461484

462485
}

0 commit comments

Comments
 (0)