Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

How to Analyze the Amplitude of Multiple Audio Files using Sound

$
0
0

I am trying to analyze the amplitude of multiple audio files using the Sound library, but it seems I am only able to analyze one at a time. For example, assuming all three audio files are different, the following code prints the same value for all three analyze() methods:

  import processing.sound.*;

       SoundFile sis;
       SoundFile boom;
       SoundFile bah;

       Amplitude rms_sis;
       Amplitude rms_boom;
       Amplitude rms_bah;

       public void setup() {
          size(640,480);

          sis = new SoundFile(this, "sis.wav");
          boom = new SoundFile(this, "boom.wav");
          bah = new SoundFile(this, "bah.wav");

          sis.play();
          boom.play();
          bah.play();

          rms_sis = new Amplitude(this);
          rms_sis.input(sis);
          rms_boom = new Amplitude(this);
          rms_boom.input(boom);
          rms_bah = new Amplitude(this);
          rms_bah.input(bah);
      }

      public void draw() {
          println(rms_sis.analyze(), rms_boom.analyze(), rms_bah.analyze());
      }

What should I do differently to get all three amplitude values?


Viewing all articles
Browse latest Browse all 2896

Trending Articles