Skip to content

Comments

Analysis fft.fs and sample_rate mismatch#340

Merged
mathieudpnt merged 5 commits intoProject-OSmOSE:mainfrom
Gautzilla:analysis-warning-fs-mismatch
Feb 18, 2026
Merged

Analysis fft.fs and sample_rate mismatch#340
mathieudpnt merged 5 commits intoProject-OSmOSE:mainfrom
Gautzilla:analysis-warning-fs-mismatch

Conversation

@Gautzilla
Copy link
Contributor

🐠 What's new?

This PR adds some error raising when trying to run Analysis where the sample_rate and fft.fs mismatch:

In the constructor

Analysis(AnalysisType.AUDIO, sample_rate=48_000, fft=ShortTimeFFT(hamming(1024),512,fs=32_000))

>>> ValueError: The sample rate of the analysis (48000 Hz) does not match the sampling frequency of the fft (32000 Hz)

In the FFT property

analysis=Analysis(AnalysisType.AUDIO, sample_rate=48_000, fft=ShortTimeFFT(hamming(1024),512,fs=48_000))
analysis.fft=ShortTimeFFT(hamming(1024),512,fs=32_000)

>>> ValueError: The sample rate of the analysis (48000 Hz) does not match the sampling frequency of the fft (32000 Hz)

The sample_rate property modifies the fft.fs value

analysis=Analysis(AnalysisType.AUDIO, sample_rate=48_000, fft=ShortTimeFFT(hamming(1024),512,fs=48_000))
analysis.sample_rate = 32_000
print(analysis.fft.fs)

>>> 32000

🐡 Note

This PR resolves #337

@Gautzilla Gautzilla self-assigned this Feb 11, 2026
@Gautzilla Gautzilla requested review from mathieudpnt and removed request for mathieudpnt February 18, 2026 16:04
@mathieudpnt mathieudpnt merged commit acb6417 into Project-OSmOSE:main Feb 18, 2026
1 check passed
@Gautzilla Gautzilla deleted the analysis-warning-fs-mismatch branch February 20, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No warning when analysis sr and fft sr differ

2 participants