-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
5,516 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Prime Distribution</title> | ||
</head> | ||
<body> | ||
<script src="dist/main.js"></script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "Focus", | ||
"version": "1.0.0", | ||
"description": "", | ||
"private": true, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "webpack-dev-server --mode development --open", | ||
"build": "webpack --mode production" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"webpack": "^4.20.2", | ||
"webpack-cli": "^3.1.2", | ||
"webpack-dev-server": "^3.1.9" | ||
}, | ||
"dependencies": { | ||
"@tensorflow/tfjs": "^0.13.4", | ||
"p5": "^0.7.2", | ||
"tfjs": "^0.6.0", | ||
"tone": "^0.12.80" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
### Day 23 - Prime Distribution | ||
|
||
Inspiration | ||
- [Poeme Symphonique for 100 Metronomes](https://www.youtube.com/watch?v=-mUv705xj3U) by György Ligeti | ||
|
||
### Install | ||
`npm install --save` | ||
|
||
### Develop | ||
`npm run start` | ||
|
||
### Deploy | ||
`npm run build` |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import p5 from 'p5/lib/p5.min'; | ||
import Tone from 'tone'; | ||
|
||
const sketch = (p) => { | ||
let noiseScale=0.03; | ||
let n=0.00; | ||
let d=0.5; | ||
|
||
let piano; | ||
|
||
p.preload = () => { | ||
piano = new Tone.Sampler({ | ||
'A0' : 'A0.[mp3|ogg]', | ||
'C1' : 'C1.[mp3|ogg]', | ||
'D#1' : 'Ds1.[mp3|ogg]', | ||
'F#1' : 'Fs1.[mp3|ogg]', | ||
'A1' : 'A1.[mp3|ogg]', | ||
'C2' : 'C2.[mp3|ogg]', | ||
'D#2' : 'Ds2.[mp3|ogg]', | ||
'F#2' : 'Fs2.[mp3|ogg]', | ||
'A2' : 'A2.[mp3|ogg]', | ||
'C3' : 'C3.[mp3|ogg]', | ||
'D#3' : 'Ds3.[mp3|ogg]', | ||
'F#3' : 'Fs3.[mp3|ogg]', | ||
'A3' : 'A3.[mp3|ogg]', | ||
'C4' : 'C4.[mp3|ogg]', | ||
'D#4' : 'Ds4.[mp3|ogg]', | ||
'F#4' : 'Fs4.[mp3|ogg]', | ||
'A4' : 'A4.[mp3|ogg]', | ||
'C5' : 'C5.[mp3|ogg]', | ||
'D#5' : 'Ds5.[mp3|ogg]', | ||
'F#5' : 'Fs5.[mp3|ogg]', | ||
'A5' : 'A5.[mp3|ogg]', | ||
'C6' : 'C6.[mp3|ogg]', | ||
'D#6' : 'Ds6.[mp3|ogg]', | ||
'F#6' : 'Fs6.[mp3|ogg]', | ||
'A6' : 'A6.[mp3|ogg]', | ||
'C7' : 'C7.[mp3|ogg]', | ||
'D#7' : 'Ds7.[mp3|ogg]', | ||
'F#7' : 'Fs7.[mp3|ogg]', | ||
'A7' : 'A7.[mp3|ogg]', | ||
'C8' : 'C8.[mp3|ogg]' | ||
}, { | ||
'release' : 1, | ||
'baseUrl' : '../sounds/' | ||
}).toMaster(); | ||
} | ||
|
||
let val1, val2 = 0; | ||
let loaded = false; | ||
let alpha = 0; | ||
p.setup = () => { | ||
let canvas = p.createCanvas(800, 800, p.WEBGL); | ||
|
||
} | ||
let ptick = 0; | ||
let ptick2 = 0; | ||
p.draw = () => { | ||
p.camera(0,0, 800, 0, 0, 0, 0, 1, 0); | ||
p.background(240); | ||
//p.smooth(); | ||
|
||
p.stroke(255); | ||
p.line(0,-3000,0,1000); | ||
|
||
p.translate(-p.width/2, p.height/4,0); | ||
p.rotateX(p.PI); | ||
|
||
n=n+d; | ||
for (let y=0; y<20; y++) { | ||
for(let x=0; x<200; x++) { | ||
let noiseVal = p.noise((n+x)*noiseScale,(-n+y)*noiseScale,y*noiseScale); | ||
p.noStroke(); | ||
p.fill((noiseVal*50)); | ||
if(x==100) { | ||
p.fill(255,0,0); | ||
if(y==0) { | ||
val1 = noiseVal; | ||
} | ||
if(y==19) { | ||
val2 = noiseVal; | ||
} | ||
} | ||
p.push(); | ||
p.translate(x*4,noiseVal*400); | ||
p.sphere(1); | ||
p.pop(); | ||
} | ||
} | ||
alpha-=100; | ||
|
||
p.push(); | ||
|
||
p.translate(100*4,val1*400); | ||
p.fill(255,0,0,alpha); | ||
p.sphere(5); | ||
p.pop(); | ||
|
||
p.push(); | ||
|
||
p.translate(100*4,val2*400); | ||
p.sphere(5); | ||
p.pop(); | ||
|
||
if(loaded) { | ||
let tick = p.floor(p.millis()/300); | ||
if(ptick!=tick) { | ||
let rnd = p.random(2); | ||
if(rnd > 0.3) { | ||
alpha = 255; | ||
|
||
piano.triggerAttackRelease(Tone.Midi(p.floor(val1*100) + 10).toFrequency(),"128n"); | ||
piano.triggerAttackRelease(Tone.Midi(p.floor(val2*100) + 10).toFrequency(),"128n"); | ||
|
||
} | ||
} | ||
ptick = tick; | ||
|
||
let tick2 = p.floor(p.millis()/200); | ||
if(ptick2!=tick2) { | ||
let rnd = p.random(2); | ||
if(rnd > 0.3) { | ||
alpha = 255; | ||
piano.triggerAttackRelease(Tone.Midi(p.floor(val1*100) + 10).toFrequency(),"64n"); | ||
//piano.triggerAttackRelease(Tone.Midi(p.floor(val2*100) + 30).toFrequency(),"128n"); | ||
|
||
} | ||
} | ||
ptick2 = tick2; | ||
|
||
|
||
} | ||
} | ||
|
||
p.keyPressed = () => { | ||
loaded = true; | ||
} | ||
} | ||
export default sketch; | ||
new p5(sketch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
entry: { | ||
app: './src/index.js', | ||
}, | ||
devtool: 'inline-source-map', | ||
devServer: { | ||
contentBase: path.resolve(__dirname, '.'), | ||
publicPath: '/dist/', | ||
openPage: 'index.html', | ||
port: 8001, | ||
}, | ||
output: { | ||
filename: 'main.js', | ||
path: path.resolve(__dirname, 'dist') | ||
}, | ||
resolve: { | ||
modules: [path.resolve(__dirname, "node_modules"), "node_modules"] | ||
} | ||
}; |