We are about to switch to a new forum software. Until then we have removed the registration on this forum.
This code comes from the processing FFT demonstration on their website.
import processing.sound.*;
FFT fft;
AudioIn in;
int bands = 512;
float[] spectrum = new float[bands];
void setup() {
size(512, 360);
background(255);
// Create an Input stream which is routed into the Amplitude analyzer
fft = new FFT(this, bands);
in = new AudioIn(this, 0);
// start the Audio Input
in.start();
// patch the AudioIn
fft.input(in);
}
void draw() {
background(255);
fft.analyze(spectrum);
for(int i = 0; i < bands; i++){
// The result of the FFT is normalized
// draw the line for frequency band i scaling it up by 5 to get more amplitude.
line( i, height/2, i, height/2 - spectrum[i]*height*5 );
}
}
It runs but doesn't acknowledge the sound being played through Spotify or iTunes. I'm using an iMac.
Do I have to change any settings within my mac? Why is this demonstration not working? Does it work on your computer?
Thanks in advanced.
Answers
audioIn is typically a physical socket on your laptop, not what you can hear.
laptops increasingly don't let you record what you can hear because of copyright issues. (older laptops were better for this).
soundflower: http://www.macworld.com/article/2043722/how-to-capture-your-macs-audio-for-free.html
http://manual.audacityteam.org/man/tutorial_recording_computer_playback_on_mac.html
Koogs, thank you for clearing this up for me.
I was under the impression AudioIn was going to analyze any sounds being played from my computer.