I’m sure that this program has already been written so far (and done better), but right now I’m just writing Nyquist code as an attempt to try to learn how to program in Nyquist. Let’s say I have the following piece of code:
;version 1
;type process
;name "HighLowPass..."
;action "Stereo-fying the channels"
;info "Choose a Channel to be Lowpassed as well as a High-pass and Low-pass
value.nThe left and right channels will be passed accordingly."
;control channel "pick a channel to be lowpassed" choice "Left, Right" 0
;control lowpass "Pick Lowpass Value" int "Hz" 200 100 13000
;control highpass "Pick Highpass Value" int "Hz" 500 0 20000
(if (= channel 0)
(vector
(lp
(aref s 0) lowpass)
(hp
(aref s 1) highpass))
(vector
(hp
(aref s 0) highpass)
(lp (aref s 1) lowpass)))
The code passes one channel high and another channel low. The intent is to create a type of stereo sound on mono tracks. (Where one channel is more bass friendly, and another channel is more treble friendly). The problem is (as you would imagine) the resulting audio looses quite a few decibels. I know that there’s probably a lot of code out there that already does this, but for the sake of learning the language: How might I go about calculating the decibel loss, then modifying the code so that each channel is multiplied by the number of decibels it looses, so that it may loose certain frequencies, but maintains a constant volume?