# Getting sound wave spectrum

**URL:** <https://qa.fmod.com/t/getting-sound-wave-spectrum/18341>\
**Category:** FMOD Engine\
**Created:** [February 10, 2022, 8:32am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341 "2022-02-10T08:32:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![intofin](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@intofin](https://qa.fmod.com/u/intofin)\
**Post date:** [February 10, 2022, 8:32am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/1 "2022-02-10T08:32:24Z")

</div>

Hey guys,

I’m new to fmod - specifically, fmod Core for non gaming purposes.

I want to retrieve spectrum on a sound file before it is being played, is there an elegant way to do that?  
Or even simulate super-quick playing/scanning of the file before the actual play to get the spectrum?

Thanks.

(I’m using c#, if it matters)

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [February 16, 2022, 1:49am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/2 "2022-02-16T01:49:53Z")

</div>

The only way to do that within FMOD would be to have the file played silently and to grab and store the spectrum data, but it would require a lot of setup. It might be simpler to use a third party solution to grab the spectrum data without needing to play the audio file.

---

<div class="post-metadata">

**Author:** ![intofin](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@intofin](https://qa.fmod.com/u/intofin)\
**Post date:** [February 16, 2022, 7:53am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/3 "2022-02-16T07:53:51Z")

</div>

Thanks!  
That’s fine.

Two questions:

1. think I don’t fully understand how your DSP logic works - say, once the playing complete, will I be able to get bands from the middle of the file?

2. How can I get a callback that will notify on next window processing? Should I call seek repeatedly?

And yeah, I will probably use some other lib to get the FFT… I saw many questions about this, would be nice I think to allow people achieve it without introducing another lib.

Thanks

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [February 17, 2022, 2:06am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/4 "2022-02-17T02:06:33Z")

</div>

1. You would need to store the spectrum data in order to access it later.

2. You can use a [non-realtime (NRT) output mode](https://fmod.com/resources/documentation-api?version=2.02&page=core-api-system.html#fmod_outputtype) to do all of this silently, but you can look into the Core API’s callbacks to see if anything could fit what you are looking for, but from what I understand there isn’t one for the “next processing window”. I suspect this would just be each `System::update()`.

---

<div class="post-metadata">

**Author:** ![intofin](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@intofin](https://qa.fmod.com/u/intofin)\
**Post date:** [February 17, 2022, 10:17am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/5 "2022-02-17T10:17:01Z")

</div>

Thanks Richard!

Very helpful.

One more thing, reading the actual audio data, can this be done without playing the sound?

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [February 18, 2022, 4:32am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/6 "2022-02-18T04:32:20Z")

</div>

Unfortunately it’s not possible within FMOD to get the spectrum data without playing the file first. FMOD and FMOD Studio specialise in real-time dynamic manipulation of audio so most features require to play the audio in one way or another. As previously mentioned, it might be worth using a third party solution for this.

EDIT: A team member believes you are asking about accessing the decompressed audio rather than the spectrum. You can access that without playing it by using either `Sound::lock` if the Sound is opened as `FMOD_CREATESAMPLE` or `Sound::read` if you open it as a stream.

---

<div class="post-metadata">

**Author:** ![intofin](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@intofin](https://qa.fmod.com/u/intofin)\
**Post date:** [February 18, 2022, 8:33am UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/7 "2022-02-18T08:33:44Z")

</div>

Hi,  
I apologize for the confusion… that I have created here.

Maybe I should start with what I’m trying to achieve - I have a sound file and I want to display waveform of a sound file so it will be possible to select certain points of it and play them.

so, as I see it I have two options:

1. play back the file and get the spectrum - less ideal because I have to play the entire file.
2. read the decompressed data and do my own FFT on it.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [February 24, 2022, 11:58pm UTC](https://qa.fmod.com/t/getting-sound-wave-spectrum/18341/8 "2022-02-24T23:58:00Z")

</div>

That’s right. You can also use [`NOSOUND_NRP`](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-system.html#fmod_outputtype) to playback without playing the audio sound, but it does have its limitations. I would recommend using a third party solution for this situation.
