# Perform Realtime Audio Analysis on Speaker Output

**URL:** https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464
**Category:** Libraries
**Created:** [May 21, 2024, 3:35am UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464 "2024-05-21T03:35:55Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![BrandMChaos](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@BrandMChaos](https://discourse.processing.org/u/BrandMChaos)
#### Post date: [May 21, 2024, 3:35am UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/1 "2024-05-21T03:35:55Z")

</div>

Currently, the FFTSpectrum example from the Sound library achieves the effect I’m looking for, but the sound it’s listening to is not. I want to know how to access the speaker output of my device and apply FFT to it in realtime, rather than the program listen to a provided sound file.

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [May 21, 2024, 4:31am UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/2 "2024-05-21T04:31:22Z")

</div>

Do you mean you need mic example? If yes here is it

> **[FFT / Libraries](https://processing.org/reference/libraries/sound/fft)**
>
> This is a Fast Fourier Transform (FFT) analyzer. It calculates the normalized power spectrum of an audio stream the moment it is queried with the analyze() method.

---

<div class="post-metadata">

### Author: ![BrandMChaos](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@BrandMChaos](https://discourse.processing.org/u/BrandMChaos)
#### Post date: [May 21, 2024, 10:57am UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/3 "2024-05-21T10:57:32Z")

</div>

No, I’m looking to perform FFT on the sounds I play from my device.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [May 21, 2024, 11:26am UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/4 "2024-05-21T11:26:41Z")

</div>

Hello @BrandMChaos,

> [@BrandMChaos](#):
>
> I want to know how to access the speaker output of my device and apply FFT to it in realtime, rather than the program listen to a provided sound file.

You can select devices as per example:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/b/9/b9e67cb022b7741d3cef98219c345486f1d4e302.png)

I added this to [FFT example](https://processing.org/reference/libraries/sound/FFT_input_.html):

`Sound s = new Sound(this, 44100, 3, 7, 1);` \< This will be different for your PC devices.

The Sound JavaDocs have details on the constructor:

> **[Sound (Javadocs: Processing Sound)](https://processing.github.io/processing-sound/processing/sound/Sound.html)**
>
> declaration: package: processing.sound, class: Sound

Sound reference also has details on constructor:

> **[Sound / Libraries](https://processing.org/reference/libraries/sound/sound)**
>
> This class can be used for configuring the Processing Sound library. The Sound class allows for configuring global properties of the sound library's audio synthesis and playback, such as the output de…

`:)`

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [May 21, 2024, 1:37pm UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/5 "2024-05-21T13:37:44Z")

</div>

> [@BrandMChaos](#):
>
> No, I’m looking to perform FFT on the sounds I play from my device.

Same thing you can use mic sketch and at the same time on your PC you can use line in or microphone input to connect your music device with PC

---

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [May 21, 2024, 4:17pm UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/6 "2024-05-21T16:17:17Z")

</div>

I know that playing from the speakers and capturing with the mic is not the best option as you perhaps lose a big part of the low frequency band. However it’s a great way to test it quick and dirty, and I think it’s good that you brought it up. You can also use Voicemeeter on windows to virtually wire the output to the input

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [May 21, 2024, 9:03pm UTC](https://discourse.processing.org/t/perform-realtime-audio-analysis-on-speaker-output/44464/7 "2024-05-21T21:03:49Z")

</div>

A further note…

I use “Stereo Mix” and have it enabled on my system.

> **[How to Enable "Stereo Mix" in Windows and Record Audio from Your PC](https://www.howtogeek.com/39532/how-to-enable-stereo-mix-in-windows-7-to-record-audio/)**
>
> Don't use Stereo Mix for your microphone in voice chat. Your friends will not appreciate it.

> [@Getting live audio input](https://discourse.processing.org/t/getting-live-audio-input/23143):
>
> So I’m brand new to working with audio in any form, and I’m hoping you folks can point me in the right direction. A DJ friend of mine wants my processing sketch to react to his audio. He said he could plug his output into my laptop and that it would show up as an “External sound card driver.” I’m kind of at a loss to where I should go from here. The Sound library IO examples shows how to get live input from the microphone, but can anyone tell me how to get it from the sound card itself? And if…

`:)`
