Skip to content

Commit

Permalink
day 25 added
Browse files Browse the repository at this point in the history
  • Loading branch information
stc committed Nov 25, 2018
1 parent 5ef9e71 commit 9f37b42
Show file tree
Hide file tree
Showing 68 changed files with 5,594 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Day-24-Noise-Pianist/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import Tone from 'tone';
const sketch = (p) => {
let noiseScale=0.03;
let n=0.00;
let d=0.5;
let d=0.6;

let piano;

let melody = [40 -12, 43 -12, 45 - 12, 47 -12, 49 -12, 52 - 12, 40, 43, 45, 47, 49, 52, 40 + 12, 43 + 12, 45 + 12, 49 + 12, 50 + 12, 52 + 12, 40 + 24, 43 + 24, 45 + 24, 49 + 24, 50 + 24, 52 + 24, 40 + 36, 43 + 36, 45 + 36, 47 + 36, 49 + 36, 52 + 36, 40 + 48, 43 + 48, 45 + 48, 47 + 48, 49 + 48, 52 + 48,40 + 60, 43 + 60, 45 + 60, 47 + 60, 49 + 48, 52 + 60]

p.preload = () => {
piano = new Tone.Sampler({
'A0' : 'A0.[mp3|ogg]',
Expand Down Expand Up @@ -108,9 +110,8 @@ const sketch = (p) => {
let rnd = p.random(2);
if(rnd > 0.5) {
alpha = 255;

piano.triggerAttackRelease(Tone.Midi(p.floor(val1*100) + 10).toFrequency(),"64n");
piano.triggerAttackRelease(Tone.Midi(p.floor(val2*100) + 10).toFrequency(),"32n");
piano.triggerAttackRelease(Tone.Midi(melody[p.ceil(val1*42)] + 6).toFrequency(),"132n");
piano.triggerAttackRelease(Tone.Midi(melody[p.ceil(val2*42)] + 6).toFrequency(),"132n");

}
}
Expand All @@ -121,9 +122,8 @@ const sketch = (p) => {
let rnd = p.random(2);
if(rnd > 0.6) {
alpha = 255;
piano.triggerAttackRelease(Tone.Midi(p.floor(val1*100) + 10).toFrequency(),"8n");
//piano.triggerAttackRelease(Tone.Midi(p.floor(val2*100) + 30).toFrequency(),"128n");

piano.triggerAttackRelease(Tone.Midi(melody[p.ceil(val2*42)] + 6).toFrequency(),"64n");
//piano.triggerAttackRelease(Tone.Midi(p.floor(val2*100) + 30).toFrequency(),"128n");
}
}
ptick2 = tick2;
Expand Down
2 changes: 2 additions & 0 deletions Day-25-Entropy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
9 changes: 9 additions & 0 deletions Day-25-Entropy/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<title>Entropy</title>
</head>
<body>
<script src="dist/main.js"></script>
</body>
</html>
Loading

0 comments on commit 9f37b42

Please sign in to comment.