Getting sound wave spectrum

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)

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.

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

  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 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().

Thanks Richard!

Very helpful.

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

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.

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.

That’s right. You can also use NOSOUND_NRP to playback without playing the audio sound, but it does have its limitations. I would recommend using a third party solution for this situation.