From 3c8ee517a5e5e35783de97036759203d220392f2 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 26 Feb 2019 20:33:59 +0100 Subject: [PATCH] Another volume fix try. --- MicroDexed.ino | 6 +++--- config.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index d9d4c5e..24f0bcc 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -696,14 +696,14 @@ void set_volume(float v, float p) Serial.print(F("/")); Serial.print(float(tmp) / SCHAR_MAX, DEC); Serial.print(F("] ")); - Serial.print(sinf(p * PI / 2), 3); + Serial.print(pow(v * sinf(p * PI / 2), VOLUME_CURVE), 3); Serial.print(F("/")); - Serial.println(cosf(p * PI / 2), 3); + Serial.println(pow(v * cosf(p * PI / 2), VOLUME_CURVE), 3); #endif // http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html #ifdef TEENSY_AUDIO_BOARD - sgtl5000_1.dacVolume(pow(v,VOLUME_CURVE) * sinf(p * PI / 2), pow(v, VOLUME_CURVE) * cosf(p * PI / 2)); + sgtl5000_1.dacVolume(pow(v * sinf(p * PI / 2), VOLUME_CURVE), pow(v * cosf(p * PI / 2), VOLUME_CURVE)); #else volume_master.gain(VOLUME_CURVE); volume_r.gain(sinf(p * PI / 2)); diff --git a/config.h b/config.h index bbb0603..fabaaa6 100644 --- a/config.h +++ b/config.h @@ -69,7 +69,7 @@ //************************************************************************************************* // https://rechneronline.de/funktionsgraphen/ #define VOLUME 0.8 -#define VOLUME_CURVE 0.1 +#define VOLUME_CURVE 0.25 #ifndef TEENSY_AUDIO_BOARD #if AUDIO_BLOCK_SAMPLES == 64 #define AUDIO_MEM 450