Skip to content

Commit 1ad2342

Browse files
committed
small updates
1 parent 2d5b876 commit 1ad2342

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tavis
1313
we are working on this project all the time. its a sort of time filler for us at this point. expect lots of additions and changes at random times.
1414

1515
## supported audio backends
16-
- PortAudio (linux/macOS/*windows**)
16+
- PortAudio (linux/macOS/*windblows**)
1717
- PulseAudio (parec/FFmpeg)
1818
- AVFoundation (FFmpeg)
1919
- ALSA (FFmpeg)
@@ -27,7 +27,7 @@ we are working on this project all the time. its a sort of time filler for us at
2727
- github.com/lawl/pulseaudio
2828
- gonum.org/v1/gonum
2929

30-
- c libraries (`CGO_ENABLED=1`)
30+
- c libraries (optional, disable with `CGO_ENABLED=0`)
3131
- fftw (fftw3)
3232
- portaudio (portaudio-2.0)
3333

@@ -52,10 +52,10 @@ CGO_ENABLED=0 go get github.com/noriah/tavis
5252
# get source
5353
git clone https://github.com/noriah/tavis.git
5454

55-
# move to source
55+
# cd to source
5656
cd tavis
5757

58-
# build tavis
58+
# build and install tavis
5959
go install
6060
# without cgo
6161
CGO_ENABLED=0 go install

config.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"errors"
5+
46
"github.com/noriah/tavis/dsp"
57
"github.com/noriah/tavis/graphic"
68
"github.com/noriah/tavis/input"
@@ -62,6 +64,24 @@ func NewZeroConfig() Config {
6264

6365
func sanitizeConfig(cfg *Config) error {
6466

67+
if cfg.SampleRate < float64(cfg.SampleSize) {
68+
return errors.New("sample rate lower than sample size")
69+
}
70+
71+
if cfg.SampleSize < 4 {
72+
return errors.New("sample size too small (4+ required)")
73+
}
74+
75+
switch {
76+
77+
case cfg.ChannelCount > 2:
78+
return errors.New("too many channels (2 max)")
79+
80+
case cfg.ChannelCount < 1:
81+
return errors.New("too few channels (1 min)")
82+
83+
}
84+
6585
switch {
6686
case cfg.WinVar > 1.0:
6787
cfg.WinVar = 1.0

dsp/spectrum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (sp *Spectrum) Process(win window.Function) {
163163
mag = 0.0
164164

165165
case sp.bins[xB].floorFFT < bassCut:
166-
pow *= math.Max(0.75, float64(xF)/fBassCut)
166+
pow *= math.Max(0.5, float64(xF)/fBassCut)
167167
}
168168

169169
mag *= sp.bins[xB].eqVal

0 commit comments

Comments
 (0)