Fixing volume levels, volume step at startup/editing, panorama.

pull/98/head
Holger Wirtz 3 years ago
parent 7f136b1e72
commit b59931b868
  1. 71
      MicroDexed.ino
  2. 31
      UI.hpp
  3. 2
      addon/SD/drm/convertwav.sh
  4. 5
      config.h
  5. 32
      dexed_sd.cpp
  6. 297
      sampler.h
  7. 9497
      sampleset.h
  8. 1
      third-party/teensy-variable-playback

@ -833,11 +833,11 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
uint8_t slot = drum_get_slot(drum_config[d].drum_class); uint8_t slot = drum_get_slot(drum_config[d].drum_class);
float pan = mapfloat(drum_config[d].pan, -1.0, 1.0, 0.0, 1.0); float pan = mapfloat(drum_config[d].pan, -1.0, 1.0, 0.0, 1.0);
drum_mixer_r.gain(slot, (1.0 - pan) * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); drum_mixer_r.gain(slot, (1.0 - pan) * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_mixer_l.gain(slot, (pan) * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); drum_mixer_l.gain(slot, pan * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
#ifdef USE_FX #ifdef USE_FX
drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * pseudo_log_curve(drum_config[d].reverb_send)); drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * volume_transform(drum_config[d].reverb_send));
drum_reverb_send_mixer_l.gain(slot, pan * pseudo_log_curve(drum_config[d].reverb_send)); drum_reverb_send_mixer_l.gain(slot, pan * volume_transform(drum_config[d].reverb_send));
#endif #endif
if (drum_config[d].drum_data != NULL) if (drum_config[d].drum_data != NULL)
Drum[slot]->play(drum_config[d].drum_data); Drum[slot]->play(drum_config[d].drum_data);
@ -986,8 +986,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("VOLUME CC")); Serial.println(F("VOLUME CC"));
#endif #endif
configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 127, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX);
MicroDexed[instance_id]->setGain(pseudo_log_curve(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX))); MicroDexed[instance_id]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127)));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity))
{ {
LCDML.OTHER_updateFunc(); LCDML.OTHER_updateFunc();
@ -1053,8 +1053,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#if defined(USE_FX) #if defined(USE_FX)
case 91: // CC 91: reverb send case 91: // CC 91: reverb send
configuration.fx.reverb_send[selected_instance_id] = map(inValue, 0, 0x7f, REVERB_SEND_MIN, REVERB_SEND_MAX); configuration.fx.reverb_send[selected_instance_id] = map(inValue, 0, 0x7f, REVERB_SEND_MIN, REVERB_SEND_MAX);
reverb_mixer_r.gain(selected_instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); reverb_mixer_r.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT)));
reverb_mixer_l.gain(selected_instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); reverb_mixer_l.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT)));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_reverb_send)) if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_reverb_send))
{ {
LCDML.OTHER_updateFunc(); LCDML.OTHER_updateFunc();
@ -1063,7 +1063,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break; break;
case 93: // CC 93: chorus level case 93: // CC 93: chorus level
configuration.fx.chorus_level[selected_instance_id] = map(inValue, 0, 0x7f, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX); configuration.fx.chorus_level[selected_instance_id] = map(inValue, 0, 0x7f, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX);
chorus_mixer[selected_instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); chorus_mixer[selected_instance_id]->gain(1, volume_transform(mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_chorus_level)) if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_chorus_level))
{ {
LCDML.OTHER_updateFunc(); LCDML.OTHER_updateFunc();
@ -1099,7 +1099,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break; break;
case 106: // CC 106: delay feedback case 106: // CC 106: delay feedback
configuration.fx.delay_feedback[instance_id] = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX); configuration.fx.delay_feedback[instance_id] = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX);
delay_fb_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // amount of feedback delay_fb_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127))); // amount of feedback
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_feedback)) if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_feedback))
{ {
LCDML.OTHER_updateFunc(); LCDML.OTHER_updateFunc();
@ -1108,7 +1108,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break; break;
case 107: // CC 107: delay volume case 107: // CC 107: delay volume
configuration.fx.delay_level[instance_id] = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX); configuration.fx.delay_level[instance_id] = map(inValue, 0, 0x7f, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX);
delay_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0))); delay_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0, 127)));
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_level)) if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_level))
{ {
LCDML.OTHER_updateFunc(); LCDML.OTHER_updateFunc();
@ -1748,20 +1748,25 @@ void init_MIDI_send_CC(void)
void set_volume(uint8_t v, uint8_t m) void set_volume(uint8_t v, uint8_t m)
{ {
float tmp_v;
configuration.sys.vol = v; configuration.sys.vol = v;
if (configuration.sys.vol > 100) if (configuration.sys.vol > 100)
configuration.sys.vol = 100; configuration.sys.vol = 100;
tmp_v = float(v);
configuration.sys.mono = m; configuration.sys.mono = m;
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Setting volume: VOL=")); Serial.print(F("Setting volume: VOL="));
Serial.println(v, DEC); Serial.println(v, DEC);
Serial.print(F(" V="));
Serial.println(volume_transform(tmp_v / 100.0));
#endif #endif
volume_r.gain(pseudo_log_curve(v / 100.0)); volume_r.gain(volume_transform(tmp_v / 100.0));
volume_l.gain(pseudo_log_curve(v / 100.0)); volume_l.gain(volume_transform(tmp_v / 100.0));
switch (m) switch (m)
{ {
@ -2167,9 +2172,9 @@ void set_fx_params(void)
// DELAY // DELAY
delay_mixer[instance_id]->gain(0, 1.0); delay_mixer[instance_id]->gain(0, 1.0);
delay_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0))); delay_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0, 127)));
delay_fb_mixer[instance_id]->gain(0, 1.0); delay_fb_mixer[instance_id]->gain(0, 1.0);
delay_fb_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); delay_fb_mixer[instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127)));
if (configuration.fx.delay_level[selected_instance_id] <= DELAY_LEVEL_MIN) if (configuration.fx.delay_level[selected_instance_id] <= DELAY_LEVEL_MIN)
delay_fx[instance_id]->disable(0); delay_fx[instance_id]->disable(0);
else if (configuration.fx.delay_sync[instance_id] == 0) else if (configuration.fx.delay_sync[instance_id] == 0)
@ -2180,8 +2185,8 @@ void set_fx_params(void)
delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10)); delay_fx[instance_id]->delay(0, constrain(midi_sync_delay_time, DELAY_TIME_MIN, DELAY_TIME_MAX * 10));
} }
// REVERB SEND // REVERB SEND
reverb_mixer_r.gain(instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); reverb_mixer_r.gain(instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT)));
reverb_mixer_l.gain(instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); reverb_mixer_l.gain(instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT)));
// DEXED FILTER // DEXED FILTER
MicroDexed[instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0)); MicroDexed[instance_id]->setFilterResonance(mapfloat(configuration.fx.filter_resonance[instance_id], FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0));
@ -2208,8 +2213,8 @@ void set_fx_params(void)
#endif #endif
#endif #endif
master_mixer_r.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); master_mixer_r.gain(3, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT)));
master_mixer_l.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); master_mixer_l.gain(3, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT)));
#endif #endif
#ifdef SGTL5000_AUDIO_ENHANCE #ifdef SGTL5000_AUDIO_ENHANCE
@ -2247,7 +2252,7 @@ void set_voiceconfig_params(uint8_t instance_id)
MicroDexed[instance_id]->setMonoMode(configuration.dexed[instance_id].monopoly); MicroDexed[instance_id]->setMonoMode(configuration.dexed[instance_id].monopoly);
// Dexed output level // Dexed output level
MicroDexed[instance_id]->setGain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); MicroDexed[instance_id]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127)));
// PANORAMA // PANORAMA
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
@ -2271,12 +2276,34 @@ void _softRestart(void)
SCB_AIRCR = 0x05FA0004; //write value for restart SCB_AIRCR = 0x05FA0004; //write value for restart
} }
float pseudo_log_curve(float value) /*float pseudo_log_curve(float value)
{ {
//return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0)); //return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0));
//return (1 - sqrt(1 - value * value)); //return (1 - sqrt(1 - value * value));
//return (pow(2, value) - 1); //return (pow(2, value) - 1);
return (pow(value, 2.2)); return (pow(value, 2.2));
}*/
float midi_volume_transform(uint8_t midi_amp)
{
#ifdef DEBUG
Serial.print(F("midi_amp="));
Serial.print(midi_amp, DEC);
Serial.print(F(" transformed_midi_amp="));
Serial.println(powf(midi_amp / 127.0, 4), 3);
#endif
return powf(midi_amp / 127.0, 4);
}
float volume_transform(float amp)
{
#ifdef DEBUG
Serial.print(F("amp="));
Serial.print(amp, DEC);
Serial.print(F(" transformed_amp="));
Serial.println(powf(amp, 4), 3);
#endif
return powf(amp, 4);
} }
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc

@ -63,11 +63,12 @@ extern void eeprom_update_sys(void);
extern void eeprom_update_performance(void); extern void eeprom_update_performance(void);
extern void eeprom_update_fx(void); extern void eeprom_update_fx(void);
extern void eeprom_update_dexed(uint8_t instance_id); extern void eeprom_update_dexed(uint8_t instance_id);
extern float pseudo_log_curve(float value); //extern float pseudo_log_curve(float value);
extern float midi_volume_transform(uint8_t midi_amp);
extern float volume_transform(float amp);
extern uint8_t selected_instance_id; extern uint8_t selected_instance_id;
extern char receive_bank_filename[FILENAME_LEN]; extern char receive_bank_filename[FILENAME_LEN];
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
#include "drums.h" #include "drums.h"
extern drum_config_t drum_config[NUM_DRUMSET_CONFIG]; extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
@ -1243,8 +1244,10 @@ void UI_func_reverb_level(uint8_t param)
lcd_display_bar_int("Reverb Level", configuration.fx.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, true); lcd_display_bar_int("Reverb Level", configuration.fx.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, true);
master_mixer_r.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); //master_mixer_r.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)));
master_mixer_l.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0))); //master_mixer_l.gain(3, pseudo_log_curve(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, 1.0)));
master_mixer_r.gain(3, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT)));
master_mixer_l.gain(3, volume_transform(mapfloat(configuration.fx.reverb_level, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 0.0, VOL_MAX_FLOAT)));
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1599,7 +1602,7 @@ void UI_func_delay_feedback(uint8_t param)
lcd_display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[selected_instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false); lcd_display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[selected_instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false);
delay_fb_mixer[selected_instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_feedback[selected_instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // amount of feedback delay_fb_mixer[selected_instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_feedback[selected_instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0, 127))); // amount of feedback
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1652,11 +1655,7 @@ void UI_func_delay_level(uint8_t param)
lcd_display_bar_int("Delay Lvl.", configuration.fx.delay_level[selected_instance_id], 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false); lcd_display_bar_int("Delay Lvl.", configuration.fx.delay_level[selected_instance_id], 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false);
/*if (configuration.fx.delay_level[selected_instance_id] <= DELAY_LEVEL_MIN) delay_mixer[selected_instance_id]->gain(1, midi_volume_transform(map(configuration.fx.delay_level[selected_instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0, 127)));
delay_fx[selected_instance_id]->disable(0);
else
delay_fx[selected_instance_id]->delay(0, constrain(configuration.fx.delay_time[selected_instance_id], DELAY_TIME_MIN, DELAY_TIME_MAX) * 10); */
delay_mixer[selected_instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_level[selected_instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)));
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -1709,8 +1708,8 @@ void UI_func_reverb_send(uint8_t param)
lcd_display_bar_int("Reverb Send", configuration.fx.reverb_send[selected_instance_id], 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false); lcd_display_bar_int("Reverb Send", configuration.fx.reverb_send[selected_instance_id], 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false);
reverb_mixer_r.gain(selected_instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); reverb_mixer_r.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT)));
reverb_mixer_l.gain(selected_instance_id, pseudo_log_curve(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, 1.0))); reverb_mixer_l.gain(selected_instance_id, volume_transform(mapfloat(configuration.fx.reverb_send[selected_instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX, 0.0, VOL_MAX_FLOAT)));
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2145,7 +2144,7 @@ void UI_func_sound_intensity(uint8_t param)
} }
lcd_display_bar_int("Voice Level", configuration.dexed[selected_instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false); lcd_display_bar_int("Voice Level", configuration.dexed[selected_instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false);
MicroDexed[selected_instance_id]->setGain(pseudo_log_curve(mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX))); MicroDexed[selected_instance_id]->setGain(midi_volume_transform(map(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127)));
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -2204,7 +2203,7 @@ void UI_func_panorama(uint8_t param)
if (configuration.sys.mono == 0) if (configuration.sys.mono == 0)
{ {
lcd_display_meter_float("Panorama", configuration.dexed[selected_instance_id].pan, 0.05, -20.0, PANORAMA_MIN, PANORAMA_MAX, 1, 1, false, true, false); lcd_display_meter_float("Panorama", configuration.dexed[selected_instance_id].pan, 0.05, -20.0, PANORAMA_MIN, PANORAMA_MAX, 1, 1, false, true, false);
mono2stereo[selected_instance_id]->panorama(mapfloat(configuration.dexed[selected_instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, 1.0, -1.0)); mono2stereo[selected_instance_id]->panorama(mapfloat(configuration.dexed[selected_instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
} }
} }
@ -3757,8 +3756,8 @@ void UI_func_drums_main_volume(uint8_t param)
lcd.print(displayname); lcd.print(displayname);
lcd.setCursor(8, 1); lcd.setCursor(8, 1);
lcd.print("/100"); lcd.print("/100");
master_mixer_r.gain (2, mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT)); master_mixer_r.gain (2, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT)));
master_mixer_l.gain (2, mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT)); master_mixer_l.gain (2, volume_transform(mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT)));
drums_volume = mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT); drums_volume = mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT);
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -8,7 +8,7 @@ then
chmod 700 "${WAV2SKETCH}" chmod 700 "${WAV2SKETCH}"
fi fi
"${WAV2SKETCH}" "${WAV2SKETCH}" -16
rm *.h rm *.h
rm -f drumset.h rm -f drumset.h

@ -313,7 +313,7 @@
//************************************************************************************************* //*************************************************************************************************
#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS! #define MAX_DEXED 2 // No! - even don't think about increasing this number! IT _WILL_ PRODUCE MASSIVE PROBLEMS!
#define CONTROL_RATE_MS 50 #define CONTROL_RATE_MS 50
#define VOL_MAX_FLOAT 0.9 #define VOL_MAX_FLOAT 0.95
#define EEPROM_MARKER 0x4242 #define EEPROM_MARKER 0x4242
@ -494,9 +494,8 @@
#define TUNE_DEFAULT 100 #define TUNE_DEFAULT 100
#define SOUND_INTENSITY_MIN 0 #define SOUND_INTENSITY_MIN 0
#define SOUND_INTENSITY_MAX 127 #define SOUND_INTENSITY_MAX 100
#define SOUND_INTENSITY_DEFAULT 100 #define SOUND_INTENSITY_DEFAULT 100
#define SOUND_INTENSITY_AMP_MAX 1.27
#define POLYPHONY_MIN 0 #define POLYPHONY_MIN 0
#define POLYPHONY_MAX MAX_NOTES #define POLYPHONY_MAX MAX_NOTES

@ -61,7 +61,7 @@ extern uint8_t seq_chord_velocity;
extern uint8_t seq_chord_dexed_inst; extern uint8_t seq_chord_dexed_inst;
extern uint8_t seq_inst_dexed[4]; extern uint8_t seq_inst_dexed[4];
extern PeriodicTimer timer1; extern PeriodicTimer timer1;
extern float pseudo_log_curve(float value); extern float midi_volume_transform(uint8_t midi_amp);
typedef struct drum_config_s { typedef struct drum_config_s {
uint8_t drum_class; // Type of drum uint8_t drum_class; // Type of drum
@ -1163,27 +1163,29 @@ bool load_sd_seq_json(uint8_t seq_number)
seq_oct_shift = data_json["seq_oct_shift"]; seq_oct_shift = data_json["seq_oct_shift"];
seq_element_shift = data_json["seq_element_shift"]; seq_element_shift = data_json["seq_element_shift"];
AudioNoInterrupts(); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
for (uint8_t i = 0; i < NUM_DEXED; i++) configuration.performance.bank[instance_id] = data_json["bank"][instance_id];
{ configuration.performance.bank[i] = data_json["bank"][i]; configuration.performance.voice[instance_id] = data_json["voice"][instance_id];
configuration.performance.voice[i] = data_json["voice"][i]; load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id);
load_sd_voice(configuration.performance.bank[i], configuration.performance.voice[i], i); load_sd_voiceconfig_json(seq_number, instance_id, 1);
load_sd_voiceconfig_json(seq_number, i, 1); //check_configuration_dexed(instance_id);
//check_configuration_dexed(i); //set_voiceconfig_params(instance_id);
//set_voiceconfig_params(i); //MicroDexed[instance_id]->ControllersRefresh();
//MicroDexed[i]->ControllersRefresh(); MicroDexed[instance_id]->setGain(midi_volume_transform(map(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0, 127)));
MicroDexed[i]->setGain(pseudo_log_curve(mapfloat(configuration.dexed[i].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX))); MicroDexed[instance_id]->panic();
MicroDexed[i]->panic();
#ifdef DEBUG #ifdef DEBUG
Serial.print(F(" ")); Serial.print(F(" "));
Serial.print(F("Load Voice-Config for sequencer")); Serial.print(F("Load Voice-Config for sequencer"));
Serial.print(i); Serial.print(instance_id);
Serial.print(F(" ")); Serial.print(F(" "));
#endif #endif
} }
AudioInterrupts();
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
set_voiceconfig_params(instance_id);
set_fx_params(); set_fx_params();
if (seq_running) if (seq_running)
timer1.begin(sequencer, seq_tempo_ms / 2); timer1.begin(sequencer, seq_tempo_ms / 2);
else else

@ -0,0 +1,297 @@
/*
MicroDexed
MicroDexed is a port of the Dexed sound engine
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
(c)2018-2021 H. Wirtz <wirtz@parasitstudio.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <Arduino.h>
#include "config.h"
#include "sampleset.h"
#ifndef _SAMPLER_H
#define _SAMPLER_H
typedef struct sampler_config_s {
uint8_t sampler_class; // Type of sample
uint8_t midinote; // Triggered by note
char name[SAMPLER_NAME_LEN];
const unsigned int* sample_data;
char shortname[2]; // 1 char name for sequencer
float32_t pitch; // play pitch
float32_t pan; // panorama (-1.0 - +1.0)
float32_t vol_max; // max. volume (0.0 - 1.0)
float32_t vol_min; // min. volume (0.0 - 1.0, should be <= vol_max)
float32_t reverb_send; // how much signal to send to the reverb (0.0 - 1.0)
} sampler_config_t;
enum {SAMPLER_NONE, SAMPLER_BASS, SAMPLER_SNARE, SAMPLER_HIHAT, SAMPLER_HANDCLAP, SAMPLER_RIDE, SAMPLER_CHRASH, SAMPLER_LOWTOM, SAMPLER_MIDTOM, SAMPLER_HIGHTOM, SAMPLER_PERCUSSION, SAMPLER_MONOPHONE, SAMPLER_POLYPHONE};
// DEFAULT MIDI CHANNEL FOR SAMPLER
uint8_t sampler_midi_channel = 10;
sampler_config_t sampler_config[NUM_SAMPLESET_CONFIG] =
{
{
SAMPLER_BASS,
MIDI_C3,
"bd01",
AudioSampleBd01,
"B",
0.0,
0.0,
0.8,
0.0,
0.0
},
{
SAMPLER_HANDCLAP,
MIDI_CIS3,
"cp02l",
AudioSampleCp02,
"C",
0.0,
-1.0,
0.6,
0.0,
0.1
},
{
SAMPLER_HANDCLAP,
MIDI_DIS3,
"cp02r",
AudioSampleCp02,
"C",
0.0,
1.0,
0.6,
0.0,
0.2
},
{
SAMPLER_SNARE,
MIDI_D3,
"sd15",
AudioSampleSd15,
"S",
0.0,
0.2,
0.6,
0.2,
0.0
},
{
SAMPLER_HIHAT,
MIDI_FIS3,
"hh01",
AudioSampleHh01,
"h",
0.0,
0.8,
0.8,
0.3,
0.0
},
{
SAMPLER_HIHAT,
MIDI_GIS3,
"hh02",
AudioSampleHh02,
"h",
0.0,
0.8,
0.8,
0.3,
0.0
},
{
SAMPLER_HIHAT,
MIDI_AIS3,
"oh02",
AudioSampleOh02,
"H",
0.0,
0.8,
0.8,
0.3,
0.0
},
{
SAMPLER_LOWTOM,
MIDI_G3,
"lt01",
AudioSampleLt01,
"T",
0.0,
-0.7,
0.8,
0.0,
0.0
},
{
SAMPLER_HIGHTOM,
MIDI_A3,
"ht01",
AudioSampleHt01,
"T",
0.0,
-0.5,
0.8,
0.0,
0.0
},
{
SAMPLER_RIDE,
MIDI_CIS4,
"rd01",
AudioSampleRd01,
"R",
0.0,
-0.6,
0.3,
0.0,
0.0
},
{
SAMPLER_RIDE,
MIDI_DIS4,
"rd02",
AudioSampleRd02,
"R",
0.0,
-0.6,
0.3,
0.0,
0.0
},
{
SAMPLER_BASS,
MIDI_B4,
"808Kick",
AudioSample808Kick,
"B",
0.0,
0.0,
0.8,
0.0,
0.0
},
{
SAMPLER_BASS,
MIDI_C5,
"phkick1",
AudioSamplePhkick1,
"B",
0.0,
0.0,
0.9,
0.0,
0.0
},
{
SAMPLER_SNARE,
MIDI_E5,
"LNsnare1",
AudioSampleLnsnare1,
"S",
0.0,
0.0,
0.5,
0.0,
0.0
},
{
SAMPLER_HANDCLAP,
MIDI_DIS5,
"LNclap1",
AudioSampleLnclap,
"C",
0.0,
0.1,
0.5,
0.0,
0.1
},
{
SAMPLER_SNARE,
MIDI_CIS5,
"rims1",
AudioSampleRims1wav,
"R",
0.0,
-0.2,
0.5,
0.0,
0.0
},
{
SAMPLER_HIHAT,
MIDI_FIS5,
"hhcl1",
AudioSampleHhcl1wav,
"H",
0.0,
1.0,
0.6,
0.0,
0.0
},
{
SAMPLER_PERCUSSION,
MIDI_FIS6,
"Tamb",
AudioSampleTamb,
"T",
0.0,
-0.2,
0.6,
0.0,
0.0
},
{
SAMPLER_PERCUSSION,
MIDI_GIS6,
"Cowbell",
AudioSampleCowbell,
"S",
0.0,
0.2,
0.6,
0.0,
0.0
},
{
SAMPLER_NONE,
0,
"EMPTY",
NULL,
"-",
0.0,
0.0,
0.0,
0.0,
0.0
}
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
Subproject commit 4bdf02125cfbe27a3489d0157317270073d152f0
Loading…
Cancel
Save