Several bug fixes:

- drums volume
- ep tune
- drums exclude for HH and HC
- filter Dexed enabled again.
dev
Holger Wirtz 2 years ago
parent 3d1564b205
commit de2a893fb7
  1. 24
      MicroDexed.ino
  2. 5
      UI.hpp
  3. 2
      addon/SD/PERFORMANCE/0/epiano.json
  4. 2
      third-party/Synth_Dexed/src/PluginFx.cpp
  5. 18
      third-party/Synth_Dexed/src/compressor.h
  6. 8
      third-party/Synth_Dexed/src/dexed.cpp
  7. 26
      third-party/Synth_Dexed/tools/gen_includes.sh
  8. 17
      third-party/Synth_Dexed/tools/includes.txt

@ -2287,9 +2287,9 @@ void set_epiano_params(void) {
ep.setStereo(mapfloat(configuration.epiano.stereo, EP_STEREO_MIN, EP_STEREO_MAX, 0.0, 1.0)); ep.setStereo(mapfloat(configuration.epiano.stereo, EP_STEREO_MIN, EP_STEREO_MAX, 0.0, 1.0));
ep.setPolyphony(configuration.epiano.polyphony); ep.setPolyphony(configuration.epiano.polyphony);
ep.setTune(mapfloat(configuration.epiano.tune, EP_TUNE_MIN, EP_TUNE_MAX, 0.0, 1.0)); ep.setTune(mapfloat(configuration.epiano.tune, EP_TUNE_MIN, EP_TUNE_MAX, 0.0, 1.0));
ep.setDetune(mapfloat(configuration.epiano.detune, EP_DETUNE_MIN, EP_DETUNE_MAX, 0, 1.0)); ep.setDetune(mapfloat(configuration.epiano.detune, EP_DETUNE_MIN, EP_DETUNE_MAX, 0.0, 1.0));
ep.setOverdrive(mapfloat(configuration.epiano.overdrive, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 0, 1.0)); ep.setOverdrive(mapfloat(configuration.epiano.overdrive, EP_OVERDRIVE_MIN, EP_OVERDRIVE_MAX, 0.0, 1.0));
ep.setVolume(mapfloat(configuration.epiano.sound_intensity, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 0, 1.0)); ep.setVolume(mapfloat(configuration.epiano.sound_intensity, EP_SOUND_INTENSITY_MIN, EP_SOUND_INTENSITY_MAX, 0.0, 1.0));
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("done.")); Serial.println(F("done."));
#endif #endif
@ -2324,13 +2324,9 @@ void _softRestart(void) {
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
uint8_t drum_get_slot(uint8_t dt) { uint8_t drum_get_slot(uint8_t dt) {
// Cleanup not playing drums
for (uint8_t i = 0; i < NUM_DRUMS; i++) { for (uint8_t i = 0; i < NUM_DRUMS; i++) {
if (!Drum[i]->isPlaying()) { if ((dt == DRUM_HIHAT || dt == DRUM_HANDCLAP) && drum_type[i] == dt) {
drum_type[i] = DRUM_NONE;
Drum[i]->enableInterpolation(false);
Drum[i]->setPlaybackRate(1.0);
} else {
if (dt == DRUM_HIHAT || dt == DRUM_HANDCLAP) {
Drum[i]->stop(); Drum[i]->stop();
drum_type[i] = DRUM_NONE; drum_type[i] = DRUM_NONE;
Drum[i]->enableInterpolation(false); Drum[i]->enableInterpolation(false);
@ -2341,12 +2337,18 @@ uint8_t drum_get_slot(uint8_t dt) {
Serial.print(F(" type ")); Serial.print(F(" type "));
Serial.println(dt); Serial.println(dt);
#endif #endif
drum_counter = i + 1;
return (i);
} else if (!Drum[i]->isPlaying()) {
drum_type[i] = DRUM_NONE;
Drum[i]->enableInterpolation(false);
Drum[i]->setPlaybackRate(1.0);
drum_counter=i+1;
return (i); return (i);
}
} }
} }
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Using next free Drum slot ")); Serial.print(F("Using next drum slot "));
Serial.println(drum_counter % NUM_DRUMS); Serial.println(drum_counter % NUM_DRUMS);
#endif #endif
drum_type[drum_counter % NUM_DRUMS] = dt; drum_type[drum_counter % NUM_DRUMS] = dt;

@ -4135,8 +4135,9 @@ void UI_func_drums_main_volume(uint8_t param) {
configuration.drums.main_vol = constrain(configuration.drums.main_vol - ENCODER[ENC_L].speed(), DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX); configuration.drums.main_vol = constrain(configuration.drums.main_vol - ENCODER[ENC_L].speed(), DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX);
} }
display_bar_int("DRM Main Vol", configuration.drums.main_vol, 1.0, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 3, false, false, false); display_bar_int("DRM Main Vol", configuration.drums.main_vol, 1.0, DRUMS_MAIN_VOL_MIN, DRUMS_MAIN_VOL_MAX, 3, false, false, false);
master_mixer_r.gain(MASTER_MIX_CH_DRUMS, configuration.drums.main_vol); float tmp_vol=configuration.drums.main_vol/100.0;
master_mixer_l.gain(MASTER_MIX_CH_DRUMS, configuration.drums.main_vol); master_mixer_r.gain(MASTER_MIX_CH_DRUMS, tmp_vol);
master_mixer_l.gain(MASTER_MIX_CH_DRUMS, tmp_vol);
} }
} }
#endif #endif

@ -8,7 +8,7 @@
"velocity_sense": 0, "velocity_sense": 0,
"stereo": 50, "stereo": 50,
"polyphony": 16, "polyphony": 16,
"tune": 50, "tune": 100,
"detune": 15, "detune": 15,
"overdrive": 0, "overdrive": 0,
"lowest_note": 21, "lowest_note": 21,

@ -131,7 +131,6 @@ void PluginFx::process(float *work, int sampleSize) {
work[i] *= Gain; work[i] *= Gain;
} }
#ifdef USE_FX
// don't apply the LPF if the cutoff is to maximum // don't apply the LPF if the cutoff is to maximum
if ( Cutoff == 1.0 ) if ( Cutoff == 1.0 )
return; return;
@ -193,7 +192,6 @@ void PluginFx::process(float *work, int sampleSize) {
//half volume comp //half volume comp
work[i] = mc * (1 + R24 * 0.45); work[i] = mc * (1 + R24 * 0.45);
} }
#endif
} }
/* /*

@ -87,8 +87,7 @@ class Compressor
arm_scale_f32(audio_block, pre_gain, audio_block, len); //use ARM DSP for speed! arm_scale_f32(audio_block, pre_gain, audio_block, len); //use ARM DSP for speed!
//calculate the level of the audio (ie, calculate a smoothed version of the signal power) //calculate the level of the audio (ie, calculate a smoothed version of the signal power)
//float32_t* audio_level_dB_block = (float32_t*)malloc(sizeof(float32_t)*len); float32_t* audio_level_dB_block = (float32_t*)malloc(sizeof(float32_t)*len);
float32_t* audio_level_dB_block = new float32_t[len];
if(!audio_level_dB_block) if(!audio_level_dB_block)
{ {
printf("Cannot allocate memory for \"audio_level_dB_block\" - stopping\n"); printf("Cannot allocate memory for \"audio_level_dB_block\" - stopping\n");
@ -101,8 +100,7 @@ class Compressor
calcAudioLevel_dB(audio_block, audio_level_dB_block, len); //returns through audio_level_dB_block calcAudioLevel_dB(audio_block, audio_level_dB_block, len); //returns through audio_level_dB_block
//compute the desired gain based on the observed audio level //compute the desired gain based on the observed audio level
//float32_t* gain_block=(float32_t*)malloc(sizeof(float32_t)*len); float32_t* gain_block=(float32_t*)malloc(sizeof(float32_t)*len);
float32_t* gain_block=new float32_t[len];
if(!gain_block) if(!gain_block)
{ {
printf("Cannot allocate memory for \"gain_block\" - stopping\n"); printf("Cannot allocate memory for \"gain_block\" - stopping\n");
@ -132,8 +130,7 @@ class Compressor
void calcAudioLevel_dB(float32_t *wav_block, float32_t *level_dB_block, uint16_t len) { void calcAudioLevel_dB(float32_t *wav_block, float32_t *level_dB_block, uint16_t len) {
// calculate the instantaneous signal power (square the signal) // calculate the instantaneous signal power (square the signal)
//float32_t* wav_pow_block=(float32_t*)malloc(sizeof(float32_t)*len); float32_t* wav_pow_block=(float32_t*)malloc(sizeof(float32_t)*len);
float32_t* wav_pow_block=new float32_t[len];
if(!wav_pow_block) if(!wav_pow_block)
{ {
printf("Cannot allocate memory for \"wav_pow_block\" - stopping\n"); printf("Cannot allocate memory for \"wav_pow_block\" - stopping\n");
@ -175,8 +172,7 @@ class Compressor
void calcGain(float32_t *audio_level_dB_block, float32_t *gain_block,uint16_t len) { void calcGain(float32_t *audio_level_dB_block, float32_t *gain_block,uint16_t len) {
//first, calculate the instantaneous target gain based on the compression ratio //first, calculate the instantaneous target gain based on the compression ratio
//float32_t* inst_targ_gain_dB_block=(float32_t*)malloc(sizeof(float32_t)*len); float32_t* inst_targ_gain_dB_block=(float32_t*)malloc(sizeof(float32_t)*len);
float32_t* inst_targ_gain_dB_block=new float32_t[len];
if(!inst_targ_gain_dB_block) if(!inst_targ_gain_dB_block)
{ {
printf("Cannot allocate memory for \"inst_targ_gain_dB_block\" - stopping\n"); printf("Cannot allocate memory for \"inst_targ_gain_dB_block\" - stopping\n");
@ -187,8 +183,7 @@ class Compressor
calcInstantaneousTargetGain(audio_level_dB_block, inst_targ_gain_dB_block,len); calcInstantaneousTargetGain(audio_level_dB_block, inst_targ_gain_dB_block,len);
//second, smooth in time (attack and release) by stepping through each sample //second, smooth in time (attack and release) by stepping through each sample
//float32_t *gain_dB_block = (float32_t*)malloc(sizeof(float32_t)*len); float32_t *gain_dB_block = (float32_t*)malloc(sizeof(float32_t)*len);
float32_t *gain_dB_block = new float32_t[len];
if(!gain_dB_block) if(!gain_dB_block)
{ {
printf("Cannot allocate memory for \"gain_dB_block\" - stopping\n"); printf("Cannot allocate memory for \"gain_dB_block\" - stopping\n");
@ -217,8 +212,7 @@ class Compressor
void calcInstantaneousTargetGain(float32_t *audio_level_dB_block, float32_t *inst_targ_gain_dB_block, uint16_t len) { void calcInstantaneousTargetGain(float32_t *audio_level_dB_block, float32_t *inst_targ_gain_dB_block, uint16_t len) {
// how much are we above the compression threshold? // how much are we above the compression threshold?
//float32_t* above_thresh_dB_block=(float32_t*)malloc(sizeof(float32_t)*len); float32_t* above_thresh_dB_block=(float32_t*)malloc(sizeof(float32_t)*len);
float32_t* above_thresh_dB_block=new float32_t[len];
if(!above_thresh_dB_block) if(!above_thresh_dB_block)
{ {
printf("Cannot allocate memory for \"above_thresh_dB_block\" - stopping\n"); printf("Cannot allocate memory for \"above_thresh_dB_block\" - stopping\n");

@ -573,7 +573,7 @@ bool Dexed::decodeVoice(uint8_t* new_data, uint8_t* encoded_data)
panic(); panic();
doRefreshVoice(); doRefreshVoice();
strlcpy(dexed_voice_name, (char *)&encoded_data[118], sizeof(dexed_voice_name) - 1); strncpy(dexed_voice_name, (char *)&encoded_data[118], sizeof(dexed_voice_name) - 1);
dexed_voice_name[10] = '\0'; dexed_voice_name[10] = '\0';
#if defined(MICRODEXED_VERSION) && defined(DEBUG) #if defined(MICRODEXED_VERSION) && defined(DEBUG)
Serial.print(F("Voice [")); Serial.print(F("Voice ["));
@ -663,7 +663,7 @@ void Dexed::loadVoiceParameters(uint8_t* new_data)
memcpy(&data, new_data, 155); memcpy(&data, new_data, 155);
doRefreshVoice(); doRefreshVoice();
#if defined(MICRODEXED_VERSION) && defined(DEBUG) #if defined(MICRODEXED_VERSION) && defined(DEBUG)
strlcpy(dexed_voice_name, (char *)&new_data[145], sizeof(dexed_voice_name) - 1); strncpy(dexed_voice_name, (char *)&new_data[145], sizeof(dexed_voice_name) - 1);
dexed_voice_name[10] = '\0'; dexed_voice_name[10] = '\0';
Serial.print(F("Voice [")); Serial.print(F("Voice ["));
@ -1656,12 +1656,12 @@ uint8_t Dexed::getTranspose(void)
void Dexed::setName(char* name) void Dexed::setName(char* name)
{ {
strlcpy(name, (char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], 10); strncpy(name, (char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], 10);
} }
void Dexed::getName(char* buffer) void Dexed::getName(char* buffer)
{ {
strlcpy((char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], buffer, 10); strncpy((char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], buffer, 10);
buffer[10] = '\0'; buffer[10] = '\0';
} }

@ -0,0 +1,26 @@
#!/bin/bash
echo "#include <Arduino.h>" > synth_dexed.h
echo "#include <Audio.h>" >> synth_dexed.h
echo "#include \"config.h\"" >> synth_dexed.h
for i in `cat includes.txt`
do
echo "/*****************************************************" >> synth_dexed.h
echo " * CODE; ${i}" >> synth_dexed.h
echo " *****************************************************/" >> synth_dexed.h
cat $i >> synth_dexed.h
echo "" >> synth_dexed.h
echo "//=====================================================" >> synth_dexed.h
done
echo "#include \"synth_dexed.h\"" > synth_dexed.cpp
for i in `ls orig_code/*.cpp`
do
echo "/*****************************************************" >> synth_dexed.cpp
echo " * CODE; ${i}" >> synth_dexed.cpp
echo " *****************************************************/" >> synth_dexed.cpp
cat $i >> synth_dexed.cpp
echo "" >> synth_dexed.cpp
echo "//=====================================================" >> synth_dexed.cpp
done

@ -0,0 +1,17 @@
orig_code/synth.h
orig_code/aligned_buf.h
orig_code/sin.h
orig_code/exp2.h
orig_code/fast_log.h
orig_code/freqlut.h
orig_code/lfo.h
orig_code/env.h
orig_code/pitchenv.h
orig_code/controllers.h
orig_code/PluginFx.h
orig_code/fm_op_kernel.h
orig_code/fm_core.h
orig_code/dx7note.h
orig_code/dexed.h
orig_code/porta.h
orig_code/source_microdexed.h
Loading…
Cancel
Save