Skip to content

Commit

Permalink
Now reverb works!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
sinshu committed Jan 25, 2023
1 parent a86d077 commit 1b0da2e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions meltysynth/reverb.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const (
offsetRoom = 0.7
initialRoom = 0.5
initialDamp = 0.5
initialWet = 1 / scaleWet
initialWet = 1.0 / scaleWet
initialWidth = 1.0
stereoSpread = 23

Expand Down Expand Up @@ -99,6 +99,10 @@ func newReverb(sampleRate int32) *reverb {
}

result := new(reverb)
result.cfsL = cfsL
result.cfsR = cfsR
result.apfsL = apfsL
result.apfsR = apfsR
result.setWet(initialWet)
result.setRoomSize(initialRoom)
result.setDamp(initialDamp)
Expand Down Expand Up @@ -129,6 +133,15 @@ func scaleTuning(sampleRate int32, tuning int) int {
}

func (r *reverb) process(input []float32, outputLeft []float32, outputRight []float32) {
length := len(input)

for t := 0; t < length; t++ {
outputLeft[t] = 0
}
for t := 0; t < length; t++ {
outputRight[t] = 0
}

for i := 0; i < len(r.cfsL); i++ {
r.cfsL[i].process(input, outputLeft)
}
Expand All @@ -146,7 +159,6 @@ func (r *reverb) process(input []float32, outputLeft []float32, outputRight []fl
}

// With the default settings, we can skip this part.
length := len(input)
if 1.0-r.wet1 > 1.0e-3 || r.wet2 > 1.0e-3 {
for t := 0; t < length; t++ {
left := outputLeft[t]
Expand Down

0 comments on commit 1b0da2e

Please sign in to comment.