clipping fix
This commit is contained in:
@@ -92,6 +92,8 @@ void Synth::process(float* out, uint32_t nFrames, uint32_t sampleRate) {
|
||||
for(Voice& v : voices_) {
|
||||
mix += v.process(params, triggered);
|
||||
}
|
||||
mix /= 4.0f; // for number of voices to prevent clipping
|
||||
mix = tanh(mix); // really prevents clipping
|
||||
|
||||
sampleOut = mix;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
std::vector<uint8_t> heldNotes_;
|
||||
|
||||
// voices
|
||||
static constexpr int MAX_VOICES = 12;
|
||||
static constexpr int MAX_VOICES = 32;
|
||||
std::array<Voice, MAX_VOICES> voices_;
|
||||
uint32_t sampleRate_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user