Hanlde potential for a division by zero

This commit is contained in:
Chigozirim Igweamaka 2024-05-27 19:45:37 +01:00
parent 1ef1990035
commit 6c57c2a5d2

View file

@ -88,6 +88,10 @@ type Peak struct {
// ExtractPeaks extracts peaks from a spectrogram based on a specified algorithm
func ExtractPeaks(spectrogram [][]complex128, audioDuration float64) []Peak {
if len(spectrogram) < 1 {
return []Peak{}
}
type maxies struct {
maxMag float64
maxFreq complex128