You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sound editor has a menu command View spectral slice, which calls the Sound_and_Spectrum to do FFT. However, I noticed in the codes of this command, the selection was first applied to a window, and then passed to Sound_and_Spectrum with the fast argument set to true.
constdouble start = ( my startSelection() == my endSelection() ?
my instancePref_spectrogram_windowShape() == kSound_to_Spectrogram_windowShape::GAUSSIAN ? my startSelection() - my instancePref_spectrogram_windowLength() :
my startSelection() - my instancePref_spectrogram_windowLength() / 2 : my startSelection()
);
constdouble finish = ( my startSelection() == my endSelection() ?
my instancePref_spectrogram_windowShape() == kSound_to_Spectrogram_windowShape::GAUSSIAN ? my endSelection() + my instancePref_spectrogram_windowLength() :
my endSelection() + my instancePref_spectrogram_windowLength() / 2 : my endSelection()
const integer numberOfFourierSamples = ( fast ? Melder_iroundUpToPowerOfTwo (my nx) : my nx );
This doesn't matter when the function is used to perform FFT to a whole sound, but in the case of the View spectral slice call, the data passed in has already been added to a window. In this situation, narrowing the numberOfFourierSamples is problematic.
The solution is setting the fast argument in this line to false to avoid narrowing the numberOfFourierSamples.
autoSpectrum result = Sound_to_Spectrum (sound.get(), true);
This will not, in most cases, cause a speed concern, since the command View spectral slice is usually used to analyze a small segment of sounds.
The text was updated successfully, but these errors were encountered:
fncokg
changed the title
[Bug] Change numberOfFourierSamples after a window function is applied in "View spectral slice“
[Bug] The numberOfFourierSamples is changed after a window function is applied in "View spectral slice“
Feb 5, 2024
fncokg
changed the title
[Bug] The numberOfFourierSamples is changed after a window function is applied in "View spectral slice“
[Bug] The numberOfFourierSamples may be changed after a window function is applied in "View spectral slice“
Feb 5, 2024
fncokg
changed the title
[Bug] The numberOfFourierSamples may be changed after a window function is applied in "View spectral slice“
[Bug] The numberOfFourierSamples may be changed after a window function is applied to the sound data in the menu command "View spectral slice“
Feb 5, 2024
The sound editor has a menu command
View spectral slice
, which calls theSound_and_Spectrum
to do FFT. However, I noticed in the codes of this command, the selection was first applied to a window, and then passed toSound_and_Spectrum
with thefast
argument set totrue
.praat/foned/SoundAnalysisArea.cpp
Lines 913 to 935 in c3a783d
However, with
fast
set totrue
, thenumberOfFourierSamples
is likely to be changed:praat/fon/Sound_and_Spectrum.cpp
Line 24 in c3a783d
This doesn't matter when the function is used to perform FFT to a whole sound, but in the case of the
View spectral slice
call, the data passed in has already been added to a window. In this situation, narrowing thenumberOfFourierSamples
is problematic.The solution is setting the
fast
argument in this line tofalse
to avoid narrowing thenumberOfFourierSamples
.praat/foned/SoundAnalysisArea.cpp
Line 932 in c3a783d
This will not, in most cases, cause a speed concern, since the command
View spectral slice
is usually used to analyze a small segment of sounds.The text was updated successfully, but these errors were encountered: