Several fixes.

Newer version of plate reverb.
pull/112/head
Holger Wirtz 3 years ago
parent df26d255d4
commit 021dd2075a
  1. 5
      MicroDexed.ino
  2. 5
      config.h
  3. 2
      dexed_sd.cpp
  4. 2
      effect_mono_stereo.cpp
  5. 21
      effect_platervbstereo.cpp
  6. 8
      effect_platervbstereo.h
  7. 27
      effect_stereo_panorama.cpp
  8. 9
      effect_stereo_panorama.h

@ -587,7 +587,6 @@ void setup()
#if defined(USE_FX)
#if defined(USE_EPIANO)
// EP_CHORUS
//ep_delayline_r = new (std::nothrow) int16_t[MOD_DELAY_SAMPLE_BUFFER];
ep_delayline_r = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t));
if (ep_delayline_r != NULL)
{
@ -608,7 +607,6 @@ void setup()
while (1);
}
//ep_delayline_l = new (std::nothrow) int16_t[MOD_DELAY_SAMPLE_BUFFER];
ep_delayline_l = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t));
if (ep_delayline_l != NULL)
{
@ -644,7 +642,7 @@ void setup()
ep_chorus_mixer_r.gain(1, mapfloat(EP_CHORUS_LEVEL_DEFAULT, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 0.0, 0.5));
ep_chorus_mixer_l.gain(1, mapfloat(EP_CHORUS_LEVEL_DEFAULT, EP_CHORUS_LEVEL_MIN, EP_CHORUS_LEVEL_MAX, 0.0, 0.5));
ep_chorus_inverter.gain(-1.0);
ep_stereo_panorama.panorama(mapfloat(EP_PANORAMA_DEFAULT, EP_PANORAMA_DEFAULT, EP_PANORAMA_DEFAULT, 0.0, 1.0));
ep_stereo_panorama.panorama(mapfloat(EP_PANORAMA_DEFAULT, EP_PANORAMA_MIN, EP_PANORAMA_MAX, -1.0, 1.0));
#endif
#endif
@ -652,7 +650,6 @@ void setup()
#if defined(USE_FX)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
//delayline[instance_id] = new (std::nothrow) int16_t[MOD_DELAY_SAMPLE_BUFFER];
delayline[instance_id] = (int16_t*)malloc(MOD_DELAY_SAMPLE_BUFFER * sizeof(int16_t));
if (delayline[instance_id] != NULL)
{

@ -725,7 +725,7 @@
#define EP_TREBLE_DEFAULT 50
#define EP_PAN_TREMOLO_MIN 0
#define EP_PAN_TREMOLO_MAX 40
#define EP_PAN_TREMOLO_MAX 100
#define EP_PAN_TREMOLO_DEFAULT 20
#define EP_PAN_LFO_MIN 0
@ -930,7 +930,8 @@ enum reverb_mixer_ports {
REVERB_MIX_CH_DRUMS,
REVERB_MIX_CH_EPIANO
};
#if !defined(_MAPFLOAT)
#ifndef _MAPFLOAT
#define _MAPFLOAT
inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)
{

@ -1000,7 +1000,7 @@ bool load_sd_epiano_json(uint8_t number)
configuration.epiano.decay = data_json["decay"];
configuration.epiano.release = data_json["release"];
configuration.epiano.hardness = data_json["hardness"];
configuration.epiano.treble = data_json["trebl"];
configuration.epiano.treble = data_json["treble"];
configuration.epiano.pan_tremolo = data_json["pan_tremolo"];
configuration.epiano.pan_lfo = data_json["pan_lf"];
configuration.epiano.velocity_sense = data_json["velocity"];

@ -57,7 +57,7 @@ static const audio_block_t zeroblock = {
}
};
#if !defined(_MAPFLOAT)
#ifndef _MAPFLOAT
#define _MAPFLOAT
inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)
{

@ -31,15 +31,13 @@
#include <Arduino.h>
#include "effect_platervbstereo.h"
#include "utility/dspinst.h"
#include "synth_waveform.h"
#define INP_ALLP_COEFF (0.65f)
#define LOOP_ALLOP_COEFF (0.65f)
#define INP_ALLP_COEFF (0.65f) // default input allpass coeff
#define LOOP_ALLOP_COEFF (0.65f) // default loop allpass coeff
#define HI_LOSS_FREQ (0.3f)
#define HI_LOSS_FREQ_MAX (0.08f)
#define LO_LOSS_FREQ (0.06f)
#define HI_LOSS_FREQ (0.3f) // scaled center freq for the treble loss filter
// #define HI_LOSS_FREQ_MAX (0.08f)
#define LO_LOSS_FREQ (0.06f) // scaled center freq for the bass loss filter
#define LFO_AMPL_BITS (5) // 2^LFO_AMPL_BITS will be the LFO amplitude
#define LFO_AMPL ((1<<LFO_AMPL_BITS) + 1) // lfo amplitude
@ -224,6 +222,15 @@ void AudioEffectPlateReverb::update()
cleanup_done = true;
}
blockL = receiveReadOnly(0);
blockR = receiveReadOnly(1);
if (!blockL) blockL = &zeroblock;
if (!blockR) blockR = &zeroblock;
transmit((audio_block_t *)blockL,0);
transmit((audio_block_t *)blockR,1);
if (blockL != &zeroblock) release((audio_block_t *)blockL);
if (blockR != &zeroblock) release((audio_block_t *)blockR);
return;
}
cleanup_done = false;

@ -71,7 +71,7 @@ public:
{
n = constrain(n, 0.0f, 1.0f);
n = map (n, 0.0f, 1.0f, 0.2f, rv_time_k_max);
float32_t attn = 0.5f * map(n, 0.0f, rv_time_k_max, 0.5f, 1.0f);
float32_t attn = map(n, 0.0f, rv_time_k_max, 0.5f, 0.25f);
__disable_irq();
rv_time_k = n;
input_attn = attn;
@ -125,7 +125,7 @@ private:
#endif
float32_t input_attn;
float32_t in_allp_k; // input allpass coeff (default 0.6)
float32_t in_allp_k; // input allpass coeff
#ifndef REVERB_USE_DMAMEM
float32_t in_allp1_bufL[224]; // input allpass buffers
float32_t in_allp2_bufL[420];
@ -158,7 +158,7 @@ private:
uint16_t lp_allp2_idx;
uint16_t lp_allp3_idx;
uint16_t lp_allp4_idx;
float32_t loop_allp_k; // loop allpass coeff (default 0.6)
float32_t loop_allp_k; // loop allpass coeff
float32_t lp_allp_out;
#ifndef REVERB_USE_DMAMEM
float32_t lp_dly1_buf[3423];
@ -171,7 +171,7 @@ private:
uint16_t lp_dly3_idx;
uint16_t lp_dly4_idx;
const uint16_t lp_dly1_offset_L = 201;
const uint16_t lp_dly1_offset_L = 201; // delay line tap offets
const uint16_t lp_dly2_offset_L = 145;
const uint16_t lp_dly3_offset_L = 1897;
const uint16_t lp_dly4_offset_L = 280;

@ -58,7 +58,7 @@ static const audio_block_t zeroblock = {
}
};
#if !defined(_MAPFLOAT)
#ifndef _MAPFLOAT
#define _MAPFLOAT
inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)
{
@ -68,8 +68,7 @@ inline float mapfloat(float val, float in_min, float in_max, float out_min, floa
void AudioEffectStereoPanorama::panorama(float p)
{
pan_r = mapfloat(p, 0.0, 1.0, -1.0, 1.0);
pan_l = mapfloat(p, 0.0, 1.0, 1.0, -1.0);
pan = mapfloat(p, 0.0, 1.0, -1.0, 1.0);
}
void AudioEffectStereoPanorama::update(void)
@ -95,14 +94,24 @@ void AudioEffectStereoPanorama::update(void)
for (uint16_t n = 0; n < AUDIO_BLOCK_SAMPLES; n++)
{
if (pan_r > 0.0)
out_f[0][n] = (pan_r / 2.0 * in_f[1][n]) + ((1.0 - pan_r) / 2.0 * in_f[0][n]);
if (pan != 0.0)
{
if (pan > 0.0)
{
out_f[0][n] = (pan / 2.0 * in_f[1][n]) + ((1.0 - pan) / 2.0 * in_f[0][n]);
out_f[1][n] = (1.0 - pan) * in_f[1][n];
}
else
out_f[0][n] = abs(pan_r) * in_f[0][n];
if (pan_l > 0.0)
out_f[1][n] = (pan_l / 2.0 * in_f[0][n]) + ((1.0 - pan_l) / 2.0 * in_f[1][n]);
{
out_f[1][n] = (pan / 2.0 * in_f[0][n]) + ((1.0 - pan) / 2.0 * in_f[1][n]);
out_f[0][n] = (1.0 - pan) * in_f[0][n];
}
}
else
out_f[1][n] = abs(pan_l) * in_f[1][n];
{
out_f[0][n] = in_f[0][n];
out_f[1][n] = in_f[1][n];
}
}
arm_float_to_q15(out_f[0], out[0]->data, AUDIO_BLOCK_SAMPLES);

@ -33,10 +33,9 @@ class AudioEffectStereoPanorama : public AudioStream
{
public:
AudioEffectStereoPanorama(void):
AudioStream(1, inputQueueArray)
AudioStream(2, inputQueueArray)
{
pan_l = 1.0;
pan_r = 1.0;
pan = 0.0;
}
virtual void update(void);
@ -47,9 +46,7 @@ class AudioEffectStereoPanorama : public AudioStream
audio_block_t *out[2];
float in_f[2][AUDIO_BLOCK_SAMPLES];
float out_f[2][AUDIO_BLOCK_SAMPLES];
float pan_l;
float pan_r;
const float _pseudo_log = 1048575 / (float)(1 << 20);
float pan;
};
#endif

Loading…
Cancel
Save