diff --git a/index.html b/index.html index 5e9b42c..538ac23 100755 --- a/index.html +++ b/index.html @@ -65,31 +65,6 @@
DSP ENGINEER | MAKER
- - diff --git a/projects.html b/projects.html index 0e698cf..6c37a0a 100644 --- a/projects.html +++ b/projects.html @@ -29,22 +29,32 @@

@hannahilea's projects

- (SITE IS UNDER ACTIVE DEVELOPMENT; ADDITIONAL PROJECTS COMING SOON) - +
diff --git a/projects/__template/index.html b/projects/__template/index.html new file mode 100644 index 0000000..ed9b073 --- /dev/null +++ b/projects/__template/index.html @@ -0,0 +1,43 @@ + + + + + Sketch: {{ PROJECT_NAME }} + + + + + + + + + + +
+

@hannahilea > projects > Sketch: {{ PROJECT_NAME }} +

+
+ +
+ Details +

A creative coding excercise (prompt: TODO), co-created with TODO + while at the Recurse Center

+

Usage: When prompted, grant microphone access, then TODO.

+
+ + + + + + diff --git a/projects/__template/sketch.js b/projects/__template/sketch.js new file mode 100644 index 0000000..4a1fa66 --- /dev/null +++ b/projects/__template/sketch.js @@ -0,0 +1,33 @@ +// TODO: edit this blurb! +// Original p5 sketch {{ co-created with FOO+link}} +// as a creative coding project while at the +// Recurse Center (www.recurse.com/) + +let mic; + +const params = { + micSensitivity: 4.0, +}; + +const gui = new GUI(); +gui.add(params, 'micSensitivity', 0.01, 30, 2); + +function setup() { + createCanvas(windowWidth, windowHeight) + + // Create an Audio input + mic = new p5.AudioIn(); + + // start the Audio Input. + // By default, it does not .connect() (to the computer speakers) + mic.start(); +} + +function windowResized() { + resizeCanvas(windowWidth, windowHeight); +} + +function draw() { + // https://stackoverflow.com/questions/55026293/google-chrome-javascript-issue-in-getting-user-audio-the-audiocontext-was-not + getAudioContext().resume(); +} diff --git a/projects/wonderful-world/earth.jpg b/projects/wonderful-world/earth.jpg new file mode 100644 index 0000000..b1035f5 Binary files /dev/null and b/projects/wonderful-world/earth.jpg differ diff --git a/projects/wonderful-world/index.html b/projects/wonderful-world/index.html new file mode 100644 index 0000000..ec45803 --- /dev/null +++ b/projects/wonderful-world/index.html @@ -0,0 +1,50 @@ + + + + + Sketch: Wonderful world + + + + + + + + + + +
+

@hannahilea > projects > Sketch: Wonderful + world +

+
+ +
+ Details +

Adapated from a creative coding excercise + (prompt: + What a wonderful world) + co-created with David Brooks while at the Recurse Center. + Image via + NASA. UX consult by Alex Ferguson. +

+

Usage: Click anywhere on the Earth to play/pause the audio. Move the mouse around your screen during + playback. May not work on phone.

+
+ + + + + + diff --git a/projects/wonderful-world/sketch.js b/projects/wonderful-world/sketch.js new file mode 100644 index 0000000..0ee0a4b --- /dev/null +++ b/projects/wonderful-world/sketch.js @@ -0,0 +1,70 @@ +// Initial p5 sketch for this project was co-created with David Brooks +// as a creative coding project while at the +// Recurse Center (www.recurse.com/) +// https://editor.p5js.org/hannahilea/sketches/AWA1W-c3H + +let angle = 0; +let earthImg; + +let mySound; +function preload() { + soundFormats('mp3'); + mySound = loadSound('world.mp3'); + earthImg = loadImage('earth.jpg'); +} + +function setup() { + let c = createCanvas(windowWidth, windowHeight, WEBGL); + c.mousePressed(playPauseSong); +} + +function windowResized() { + resizeCanvas(windowWidth, windowHeight); +} + +function playPauseSong() { + if (mySound.isPlaying()) { + mySound.pause(); + } else { + mySound.play(); + } +} + +function draw() { + // Get our values! + rate = map(mouseY, 0, height, 0.5, 2); + let spinAmt; + if (!mySound.isPlaying()) { + spinAmt = 0; + } else if (mouseY < height / 2) { + spinAmt = map(mouseY, 0, height, 0.001, 0.03, true) + } else { + spinAmt = map(mouseY - height / 2, 0, height, 0.02, 0.3); + } + pan = map(mouseX, 0, width, -1., 1.); + + // Draw background gradient + c1 = color(300); + let c2 = color(map(pan, -1, 1, 212, 251), + map(pan, -1, 1, 20, 176), + map(pan, -1, 1, 90, 51)); + for (let y = -windowHeight / 2; y < windowHeight / 2; y++) { + n = map(y, -windowHeight / 2, windowHeight / 2, 0, 1); + let newc = lerpColor(c1, c2, n); + stroke(newc); + line(-windowWidth / 2, y, windowWidth / 2, y); + } + + // Draw stuff + rotateY(angle); + lights(); + fill(200); + noStroke(); + angle += spinAmt; + texture(earthImg); + sphere(windowHeight * .35); + + // Update audio + mySound.rate(rate); + mySound.pan(pan); +} diff --git a/projects/wonderful-world/world.mp3 b/projects/wonderful-world/world.mp3 new file mode 100644 index 0000000..274f291 Binary files /dev/null and b/projects/wonderful-world/world.mp3 differ diff --git a/utilities.jl b/utilities.jl new file mode 100644 index 0000000..76271d3 --- /dev/null +++ b/utilities.jl @@ -0,0 +1,34 @@ +const NEW_PROJ_COMMENT = "" + +# Some quick and brittle Julia utilities for adding new projects +# Doesn't handle nested, only does new js projects +# Will fail if dir already exists +# Future: functions to add different types of projects +# Future: validate git state isn't dirty before starting +function new_js_project() + project_name = lstrip(rstrip(Base.prompt("Enter project name: "))) + dir_name = lstrip(rstrip(Base.prompt("Enter project url name: "))) + dir = joinpath("projects", dir_name) + + @info "Creating new project directory" project_name dir_name + cp(joinpath("projects", "__template"), dir) + for file in readdir(dir; join=true) + @info "Updating $file..." + str = read(file, String) + str = replace(str, "{{ PROJECT_NAME }}" => project_name) + str = replace(str, "{{ DIR_NAME }}" => dir_name) + write(file, str) + end + + @info "Adding new project to project index" + let + projects_file = "projects.html" + new_blob = """\n
  • \n

    $(project_name)

    \n
    \n

    TODO-description

    \n
  • """ + str = read(projects_file, String) + i = findfirst(NEW_PROJ_COMMENT, file) + isnothing(i) && throw(ArgumentError("Oh no, $(NEW_PROJ_COMMENT) not found in projects.html!")) + str = str[1:last(i)] * new_blob * str[last(i)+1:end] + write(projects_file, str) + end + @info "Do ctrl+f TODO to find regions to update for newly added project!" +end