This commit is contained in:
5684185+vsariola@users.noreply.github.com
2026-01-01 18:19:48 +02:00
parent c424d2b847
commit 179ebb7cc3
5 changed files with 279 additions and 173 deletions

View File

@ -57,9 +57,9 @@ const (
)
var spectrumSmoothingMap map[SpecSmoothing]float32 = map[SpecSmoothing]float32{
SpecSmoothingSlow: 0.05,
SpecSmoothingSlow: 0.1,
SpecSmoothingMedium: 0.2,
SpecSmoothingFast: 1.0,
SpecSmoothingFast: 0.4,
}
func NewSpecAnalyzer(broker *Broker) *SpecAnalyzer {
@ -154,8 +154,6 @@ func (s *SpecAnalyzer) update(buf sointu.AudioBuffer) *Spectrum {
}
// convert to decibels
for c := range 2 {
vek32.MaximumNumber_Inplace(ret[c], 1e-8)
vek32.MinimumNumber_Inplace(ret[c], 1e8)
vek32.Log10_Inplace(ret[c])
vek32.MulNumber_Inplace(ret[c], 10)
}
@ -164,7 +162,7 @@ func (s *SpecAnalyzer) update(buf sointu.AudioBuffer) *Spectrum {
func (sd *SpecAnalyzer) process(buf sointu.AudioBuffer, channel int) {
for i := range buf { // de-interleave
sd.temp.tmp1[i] = buf[i][channel]
sd.temp.tmp1[i] = removeNaNsAndClamp(buf[i][channel])
}
vek32.Mul_Inplace(sd.temp.tmp1, sd.temp.window) // apply windowing
vek32.Gather_Into(sd.temp.tmp2, sd.temp.tmp1, sd.temp.bitPerm) // bit-reversal permutation