Dylanrr
Dylanrr

Reputation: 31

Audio input stream in Processing 3

My overarching goal: I'm looking for a way to grab current system sound and run it through a visualizer in Processing 3. Currently I have found a way to do this grabbing the mic input:

 function setup() {
  sound = new p5.AudioIn(); 
  sound.start();
  fft = new p5.FFT(); 
  fft.setInput(sound);
 }

But I have yet to find a way to do this with system sound (ie. A youtube video, Spotify, an MP3 file playing)

As well i'm not even sure if this is possible with some programs like spottily as they have built in security.

All in all I think the solution to this problem is probably similar to how you would go about capturing system audio in a screen recording program.

Note: The captured audio is being pipped into the Minim Library for visual processing.

Upvotes: 0

Views: 486

Answers (1)

Ben Myers
Ben Myers

Reputation: 1395

Capturing system output in Processing is a bit tricky. In fact, even being able to record system output is a demon of its own.

I managed to accomplish this task on my MacBook Pro in Processing by using Soundflower (Mac) as a workaround. This application acts as a MIDI device to route your sound output to your sound input. Once installed, open Audio MIDI Setup and select Soundflower as your sound input.

When you run your Processing script, p5.AudioIn() will take the Soundflower audio input channel and use it get the frequency bands of all sounds coming out of your computer alone.

Best of luck!

Upvotes: 1

Related Questions