I’m a little bit confused with FMOD’s spectrum because I have an application that draws out the spectrum values of a sound wave. Now the image I get looks right but it is completely different from other spectrum plot I get on software called Audacity.
I even took a sound example from a book. The spectrum image on the book matches with the Audacity one but not similar with FMOD’s one?
How come? Why is it different?
- TheMadMe asked 8 years ago
I found another strange problem
I have two different sounds and put there spectrum values into a txt file. When I looked at both of the txt files I was shocked to find both of them have the same values ?!?!? though the sounds are different waveforms ?!?!
Does anyone know why this has happened?
FMOD getSpectrum returns a spectrum analysis of the currently playing sound. This analysis only uses the last X samples of sound, where X is the [i:1klxh5j7]numvalues[/i:1klxh5j7] parameter. It is intended to return frequency data of currently playing sounds in real time.
Is it possible you’re comparing a spectrum of the entire song (Audacity) to the spectrum of a part of the song (FMOD)?
Hope this helps.
Thanks that really help
Well that does sound possible. I thought that the get Spectrum function would just return the whole but it makes sense it would return what is currently being played.
So if called get Spectrum when its not playing or when paused right at the beginning I am only to get the first 1024 or x num value floats of spectrum data.
So If I was to get whole spectrum data I would need to play the whole song first and save all this data into a list.
The question is now what would be the best hop size?
Why do you expect it to look the same? Do you understand the basics behind FFT? There are several reasons it will not look the same
1. The window size is different
2. The windowing technique is different (hamming etc)
3. the Y axis is most likely different. What are you looking at – decibels? linear values? You might have to stretch the data doing inverse logarithms etc to make it look better graphically.
4. The first 1024 samples? What samples are you comparing it to of fmod’s output? FMOD analyzes the data in realtime, so you are getting a ‘snapshot’. Its possible you took the snapshot at the wrong time.
Thanks, so ok, so the spectrum function gets the sepctrum during the play time of sound.
I’m just wanting to gain an average of the whole spectrum of the sound.
So would i just enter 44100 into the numvalues? right after its playing of before it plays?
Sorry if it seem like I am repeating myself.
Thanks for the reply
[quote:pgx3xjej]So would i just enter 44100 into the numvalues? right after its playing of before it plays? [/quote:pgx3xjej]
Like it says in the docs entering 44100 into numvalues when it is playing at 44.1 kHz will analyse 1 second of sound.
[quote:pgx3xjej]I’m just wanting to gain an average of the whole spectrum of the sound. [/quote:pgx3xjej]
This is not what the getSpectrum feature is designed for. Like Brett said it’s purpose is to provide the frequency spectrum for a snapshot of sound.
You could try calling it frequently while the sound plays and then average out the values, but you will get overlap and/or gaps in the data being analysed and it won’t be accurate.
It would probably be more efficient to analyse the sounds outside your program and then import the sounds and the pre-calculated spectrum data. If you program is a media player which will load any user file at run time then you might need to create your function to get the spectrum data for the whole sound.
Please login first to submit.