This commit is contained in:
Louis Dalibard 2025-01-16 22:27:12 +01:00
parent 6516fa3b2f
commit a59428ab19
2 changed files with 5 additions and 1 deletions

View File

@ -101,7 +101,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
binary.Read(audio.SampleRingBuffer, binary.NativeEndian, &AX)
binary.Read(audio.SampleRingBuffer, binary.NativeEndian, &AY)
}
FFTBuffer = window.Apply(FFTBuffer, signalprocessing.HannWindow)
FFTBuffer = window.Apply(FFTBuffer, signalprocessing.CachedWindowFunction)
X := fft.FFTReal(FFTBuffer)
r, θ := cmplx.Polar(X[1])
maxR := r

View File

@ -12,3 +12,7 @@ var HannWindow []float64
func Init() {
HannWindow = window.Hann(int(config.Config.ReadBufferSize / audio.SampleSizeInBytes / 2))
}
func CachedWindowFunction(u int) []float64 {
return HannWindow
}