diff --git a/EncodeAudio.pde b/EncodeAudio.pde index c3fac7b..03e6400 100644 --- a/EncodeAudio.pde +++ b/EncodeAudio.pde @@ -12,8 +12,11 @@ void setup() { size(512, 200); - String file = selectInput("Select audio file to encode."); - + selectInput("Select audio file to encode.", "callback"); +} +void callback(File sfile){ + String file = sfile.getAbsolutePath(); + if (file == null) { exit(); return; @@ -25,7 +28,7 @@ void setup() minim = new Minim(this); sample = minim.loadSample(file); - float[] samples = sample.getChannel(BufferedAudio.LEFT); + float[] samples = sample.getChannel(1); //BufferedAudio.LEFT float maxval = 0; for (int i = 0; i < samples.length; i++) { @@ -51,6 +54,7 @@ void setup() } exit(); + } void stop() diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..10d3d72 --- /dev/null +++ b/readme.md @@ -0,0 +1,8 @@ +# EncodeAudio + +*Processing sketch for translating audio files into numeric values. +* + +originally by **[David A. Mellis](https://github.com/damellis)** + +updated for Processing 2 by **[electricmango](https://github.com/electricmango)**