Skip to content

Instantly share code, notes, and snippets.

@jaegonlee
Last active September 10, 2018 07:08
Show Gist options
  • Select an option

  • Save jaegonlee/364cedf94e08c99b4d1a8ef50603a279 to your computer and use it in GitHub Desktop.

Select an option

Save jaegonlee/364cedf94e08c99b4d1a8ef50603a279 to your computer and use it in GitHub Desktop.

Revisions

  1. jaegonlee revised this gist Sep 10, 2018. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions soundinput.pde
    Original file line number Diff line number Diff line change
    @@ -17,9 +17,6 @@ void setup() {


    void draw() {
    float inputLevel = map(mouseY, 0, height, 1.0, 0.0);
    input.amp(inputLevel);

    float volume = loudness.analyze() * 350;

    background(125, 255, 125);
  2. jaegonlee created this gist Sep 10, 2018.
    29 changes: 29 additions & 0 deletions soundinput.pde
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    import processing.sound.*;

    AudioIn input;
    Amplitude loudness;

    void setup() {
    size(640, 360);
    background(255);

    input = new AudioIn(this, 0);

    input.start();
    loudness = new Amplitude(this);

    loudness.input(input);
    }


    void draw() {
    float inputLevel = map(mouseY, 0, height, 1.0, 0.0);
    input.amp(inputLevel);

    float volume = loudness.analyze() * 350;

    background(125, 255, 125);
    noStroke();
    fill(255, 0, 150);
    ellipse(width/2, height/2, volume, volume);
    }