-
Notifications
You must be signed in to change notification settings - Fork 0
/
factory.go
39 lines (36 loc) · 830 Bytes
/
factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package spectrogram
import (
"github.com/dim13/colormap"
"github.com/mjibson/go-dsp/window"
"image/color"
)
func GetWindowFunctionByName(name string) func(int) []float64 {
if name == "hann" {
return window.Hann
} else if name == "hamming" {
return window.Hamming
} else if name == "bartlett" {
return window.Bartlett
} else if name == "blackman" {
return window.Blackman
} else if name == "flatTop" {
return window.FlatTop
} else if name == "rectangular" {
return window.Rectangular
} else {
return nil
}
}
func GetColorMapByName(name string) []color.Color {
if name == "inferno" {
return colormap.Inferno
} else if name == "magma" {
return colormap.Magma
} else if name == "plasma" {
return colormap.Plasma
} else if name == "viridis" {
return colormap.Viridis
} else {
return nil
}
}