mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-07-30 16:29:15 +02:00
No hard clip
This commit is contained in:
+1
-2
@@ -25,7 +25,6 @@
|
|||||||
static volatile sig_atomic_t to_run = 1;
|
static volatile sig_atomic_t to_run = 1;
|
||||||
static volatile sig_atomic_t to_reload = 0;
|
static volatile sig_atomic_t to_reload = 0;
|
||||||
|
|
||||||
inline float hard_clip(float sample, float threshold) { return fmaxf(-threshold, fminf(threshold, sample)); }
|
|
||||||
static inline float soft_clip(float x) {
|
static inline float soft_clip(float x) {
|
||||||
return tanhf(x);
|
return tanhf(x);
|
||||||
}
|
}
|
||||||
@@ -247,7 +246,7 @@ int run_fm95(const FM95_Config config, FM95_Runtime* runtime) {
|
|||||||
|
|
||||||
mpx = bs412_compress(&runtime->bs412, audio, mpx+mpx_in[i]);
|
mpx = bs412_compress(&runtime->bs412, audio, mpx+mpx_in[i]);
|
||||||
|
|
||||||
output[i] = hard_clip(soft_clip(mpx), 1.0)*config.master_volume; // Ensure peak deviation of 75 khz (or the set deviation), assuming we're calibrated correctly
|
output[i] = soft_clip(mpx)*config.master_volume; // Ensure peak deviation of 75 khz (or the set deviation), assuming we're calibrated correctly
|
||||||
advance_oscillator(&runtime->osc);
|
advance_oscillator(&runtime->osc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user