News for hackers. Stuff that matters.
Re:Fire alarm audio detection, using FFTs and 184 lines of Go by severino on Sunday April 07, 2024 @06:24PM (#39964494)
I took a look at the source, as I was curious about how does one perform a FFT of a signal, but stumbled upon this. Could somebody explain to me what this calculation does? (in is the audio signal, if I'm not wrong)

  window := make([]float64, len(in))
  for i, x := range in {
      window[i] = float64(x) * (0.54 - 0.46*math.Cos(2*math.Pi*float64(i)/float64(len(in)-1)))
 
Thanks
Re:Fire alarm audio detection, using FFTs and 184 lines of Go by geolqued on Sunday April 07, 2024 @06:53PM (#39964667)
It looks like a windowing function. Used to turn continuous data into segments of data for FFT processing. https://en.m.wikipedia.org/wiki/Window_function
Re:Fire alarm audio detection, using FFTs and 184 lines of Go by max-m on Sunday April 07, 2024 @07:58PM (#39965003)
From that article, that's the original Hamming windows with a_0 = 0.54 and a_1 = 0.46.

> Setting a_0 to approximately 0.54, or more precisely 25/46, produces the Hamming window, proposed by Richard W. Hamming. That choice places a zero-crossing at frequency 5π/(N − 1), which cancels the first sidelobe of the Hann window, giving it a height of about one-fifth that of the Hann window. The Hamming window is often called the Hamming blip when used for pulse shaping.

Re:Fire alarm audio detection, using FFTs and 184 lines of Go by vsnf on Sunday April 07, 2024 @08:02PM (#39965019)
This is the kind of discovery that settles all debate in my mind that I could have ever been an electrical engineer, or any kind of mathematician.
Re:Fire alarm audio detection, using FFTs and 184 lines of Go by dylan604 on Sunday April 07, 2024 @08:27PM (#39965147)
This is pretty much how I feel every time delving into FFTs. Like, I get the concept, but something in my brain just shuts off when it comes to actually trying to grok it. I do however very much appreciate those that have created software where I just provide --input and they handle the rest.
Re:Fire alarm audio detection, using FFTs and 184 lines of Go by flyinghamster on Sunday April 07, 2024 @08:40PM (#39965201)
I also have trouble wrapping my head around all of this, and complex numbers, for that matter. Never mind that I'm employing this stuff all the time in GNU Radio.