feat(vm): add dbgain unit, where gain is defined in decibels

Closes #78
This commit is contained in:
5684185+vsariola@users.noreply.github.com
2023-10-23 18:16:31 +03:00
parent f698986718
commit 04fbc9f6a7
12 changed files with 146 additions and 25 deletions

View File

@ -346,6 +346,12 @@ func (s *GoSynth) Render(buffer sointu.AudioBuffer, maxtime int) (samples int, t
stack[l-2] /= params[0]
}
stack[l-1] /= params[0]
case opDbgain:
gain := float32(math.Pow(2, float64(params[0]*2-1)*6.643856189774724))
if stereo {
stack[l-2] *= gain
}
stack[l-1] *= gain
case opClip:
if stereo {
stack[l-2] = clip(stack[l-2])