mirror of
https://github.com/cgzirim/seek-tune.git
synced 2025-12-18 09:24:19 +00:00
Hanlde potential for a division by zero
This commit is contained in:
parent
1ef1990035
commit
6c57c2a5d2
1 changed files with 4 additions and 0 deletions
|
|
@ -88,6 +88,10 @@ type Peak struct {
|
||||||
|
|
||||||
// ExtractPeaks extracts peaks from a spectrogram based on a specified algorithm
|
// ExtractPeaks extracts peaks from a spectrogram based on a specified algorithm
|
||||||
func ExtractPeaks(spectrogram [][]complex128, audioDuration float64) []Peak {
|
func ExtractPeaks(spectrogram [][]complex128, audioDuration float64) []Peak {
|
||||||
|
if len(spectrogram) < 1 {
|
||||||
|
return []Peak{}
|
||||||
|
}
|
||||||
|
|
||||||
type maxies struct {
|
type maxies struct {
|
||||||
maxMag float64
|
maxMag float64
|
||||||
maxFreq complex128
|
maxFreq complex128
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue