Skip to content

Commit 10b5706

Browse files
committed
update
ffmpeg on mac seems to have an issue right now. it has to do with the read timeout.
1 parent e7e7b3c commit 10b5706

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

CatnipJulia/src/run_catnip.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Colors
2-
using DataStructures: CircularBuffer
2+
using DataStructures
33
using GLMakie
44

55
set_theme!(theme_black())
@@ -15,17 +15,20 @@ GLMakie.activate!(;
1515
)
1616

1717
function run_catnip(; timeout=false)
18+
println("Start")
1819
# 6 seconds at 60 samples per second out of catnip
1920
numSets = 300
2021
# numSets = 120
2122

2223
fig = Figure(fontsize=14; size=(1200, 888))
23-
ax1 = Axis3(fig[1, 1]; aspect=(2, 1, 0.25), elevation=pi / 6, perspectiveness=0.5)
24+
ax1 = Axis3(fig[1, 1]; aspect=(2, 1, 0.25), elevation=2pi / 5, perspectiveness=0.5, azimuth=0)
2425

2526
hidedecorations!(ax1)
2627
hidespines!(ax1)
2728

28-
data = CircularBuffer{Vector{Float64}}(numSets)
29+
println("Allocate")
30+
31+
data = DataStructures.CircularBuffer{Vector{Float64}}(numSets)
2932

3033
push!(data, [0.0, 0.0])
3134
push!(data, [0.0, 0.0])
@@ -77,7 +80,8 @@ function run_catnip(; timeout=false)
7780
# end
7881

7982
for j = 0:bars-1
80-
d[idx+(j*sets)] = 100.0
83+
d[1+(j*sets)] = 100.0
84+
# d[idx+(j*sets)] = 100.0
8185
end
8286

8387
d[idx] = 0.0
@@ -103,14 +107,16 @@ function run_catnip(; timeout=false)
103107
# mymagma = GLMakie.to_colormap(:BuPu_9)
104108
mymagma[1] = RGBA(0.0,0.0,0.0,0.0)
105109

106-
command = `catnip -d spotify -r 122880 -n 2048 -sas 6 -sf 45 -i -nw -nwb 81`
110+
command = `catnip -d 4:VisOut -r 122880 -n 2048 -sas 6 -sf 45 -i -nw -nwb 81`
107111
# command = `catnip -d "Google Chrome" -r 122880 -n 2048 -sas 6 -sf 45 -i -nw -nwb 60`
108112
#command = `go run ./cmd/catnip -d spotify -r 122880 -n 2048 -sas 5 -sf 45 -i -nw -nwb 50`
109113

110114

111115
try
116+
println("Open StdOut")
112117
open(command, "r", stdout) do io
113118
count = 0
119+
println("Loop")
114120
while count < numSets + 2
115121
count += 1
116122

cmd/catnip/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func main() {
5959
} else {
6060
writer := NewWriter()
6161
writer.Init(cfg.sampleRate, cfg.sampleSize)
62-
writer.SetBinCount(cfg.numberWriterBins)
62+
writer.SetBinCount(cfg.numberWriterBins)
6363
writer.SetInvertDraw(cfg.invertDraw)
6464
output = writer
6565
}
@@ -84,7 +84,7 @@ func main() {
8484
SampleRate: cfg.sampleRate,
8585
SampleSize: cfg.sampleSize,
8686
SquashLow: true,
87-
SquashLowOld: false,
87+
SquashLowOld: true,
8888
DontNormalize: cfg.dontNormalize,
8989
BinMethod: dsp.MaxSampleValue(),
9090
}),

dsp/analyzer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ func (az *analyzer) ProcessBin(idx int, src []complex128) float64 {
127127
fftCeil = az.fftSize
128128
}
129129

130-
if fftFloor >= fftCeil {
131-
fftFloor = fftCeil - 1
132-
}
130+
// if fftFloor >= fftCeil {
131+
// fftFloor = fftCeil - 1
132+
// }
133133

134134
src = src[fftFloor:fftCeil]
135135
mag := 0.0
@@ -143,7 +143,7 @@ func (az *analyzer) ProcessBin(idx int, src []complex128) float64 {
143143
// squash the low low end a bit.
144144
if az.cfg.SquashLowOld {
145145
if f := az.freqToIdx(400.0, math.Floor); fftFloor < f {
146-
mag *= 0.55 * (float64(fftFloor+1) / float64(f))
146+
mag *= 0.65 * (float64(fftFloor+1) / float64(f))
147147
}
148148
} else {
149149
if f := az.freqToIdx(1000.0, math.Floor); fftFloor < f {

input/ffmpeg/avfoundation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (p AVFoundation) Devices() ([]input.Device, error) {
6464

6565
// If we're not scanning a device (which starts with a square bracket)
6666
// anymore, then we stop.
67-
if !strings.HasPrefix(text, "[") {
67+
if !strings.HasPrefix(text, "[") || strings.HasPrefix(text, "[in") {
6868
audio = false
6969
continue
7070
}

0 commit comments

Comments
 (0)