Several fixes for new drum configuration.

dev
Holger Wirtz 2 years ago
parent a88fba68f1
commit 1de59e5568
  1. 35
      MicroDexed.ino
  2. 162
      addon/SD/PERFORMANCE/0/drums.json
  3. 240038
      addon/tools/drumset.h
  4. 14
      dexed_sd.cpp
  5. 20
      drumset.h

@ -984,42 +984,45 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) {
if (inNumber == configuration.drums.midinote[d]) {
uint8_t slot = drum_get_slot(drum_config[d].drum_class);
float pan = mapfloat(configuration.drums.pan[d], -127.0, 127.0, 0.0, 1.0);
//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 * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_mixer_r.gain(slot, (1.0 - pan) * mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max));
drum_mixer_l.gain(slot, pan * mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max));
float reverb_send = configuration.drums.reverb_send[d] / 100.0f;
float vol_min = configuration.drums.vol_min[d] / 100.0f;
float vol_max = configuration.drums.vol_max[d] / 100.0f;
//drum_mixer_r.gain(slot, (1.0 - pan) * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min/100.0f, configuration.drums.vol_max[d]/100.0f)));
//drum_mixer_l.gain(slot, pan * volume_transform(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min/100.0f, configuration.drums.vol_max[d]/100.0f)));
drum_mixer_r.gain(slot, (1.0 - pan) * mapfloat(inVelocity, 0, 127, vol_min, vol_max));
drum_mixer_l.gain(slot, pan * mapfloat(inVelocity, 0, 127, vol_min, vol_max));
#ifdef USE_FX
//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 * volume_transform(drum_config[d].reverb_send));
drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * drum_config[d].reverb_send);
drum_reverb_send_mixer_l.gain(slot, pan * drum_config[d].reverb_send);
//drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * volume_transform(reverb_send));
//drum_reverb_send_mixer_l.gain(slot, pan * volume_transform(reverb_send));
drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * reverb_send);
drum_reverb_send_mixer_l.gain(slot, pan * reverb_send);
#endif
if (drum_config[d].drum_data != NULL && drum_config[d].len > 0) {
if (configuration.drums.pitch[d] != 0) {
Drum[slot]->enableInterpolation(true);
Drum[slot]->setPlaybackRate(configuration.drum.pitch[d] / 10.0f);
Drum[slot]->setPlaybackRate(configuration.drums.pitch[d] / 100.0f);
}
Drum[slot]->playRaw((int16_t*)drum_config[d].drum_data, drum_config[d].len, 1);
#ifdef DEBUG
Serial.printf("Playing sample [%s][%c%c] on slot [%d] main volume [%d]: drum_data=%p, len=%d\n", drum_config[d].name, drum_config[d].shortname[0], drum_config[d].shortname[1], slot, configuration.drums.main_vol, drum_config[d].drum_data, drum_config[d].len);
#endif
}
Serial.printf(PSTR("Playing sample [%s][%c%c] on slot [%d] main volume [%d]: drum_data=%p, len=%d\n"), drum_config[d].name, drum_config[d].shortname[0], drum_config[d].shortname[1], slot, configuration.drums.main_vol, drum_config[d].drum_data, drum_config[d].len);
#ifdef DEBUG
Serial.print(F("Drum Slot ["));
Serial.print(slot);
Serial.print(F("]: Velocity="));
Serial.print(mapfloat(inVelocity, 0, 127, configuration.drums.vol_min[d], configuration.drums.vol_max[d]), 2);
Serial.print(mapfloat(inVelocity, 0, 127, vol_min, vol_max), 2);
Serial.print(F(" Pan="));
Serial.print(pan, 2);
Serial.print(F(" ReverbSend="));
Serial.println(drum_config[d].reverb_send, 2);
Serial.println(reverb_send, 2);
Serial.print(F(" Pitch="));
Serial.println(configuration.drums.pitch[d] / 10.0f, 1);
#endif
break;
}
}
}
}
#endif
}

@ -69,14 +69,14 @@
],
"pitch": [
0,
1.2,
12,
0,
0,
0,
1.1,
1.3,
11,
13,
0,
1.4,
14,
0,
0,
0,
@ -91,10 +91,10 @@
0,
0,
0,
1,
10,
0,
1,
0.9,
10,
9,
0,
0,
0,
@ -106,7 +106,7 @@
0,
0,
0,
1.427136,
142,
0,
0,
0,
@ -266,69 +266,69 @@
0
],
"vol_max": [
1,
1,
0.7,
1,
0.7,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0.75,
0.56,
1,
1,
1,
0.79,
0.73,
1,
0.89,
0.74,
0.93,
1,
1,
0.86,
0.74,
0.9,
0.9,
0.8,
0.8,
0.77,
0.8,
0.8,
0.83,
1,
0.78,
0.88,
0.9,
0.94,
0.9,
0.9,
0.9,
0.8,
0.9,
0.9,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0.8,
100,
100,
70,
100,
70,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
75,
56,
100,
100,
100,
79,
73,
100,
89,
74,
93,
100,
100,
86,
74,
90,
90,
80,
80,
77,
80,
80,
83,
100,
78,
88,
90,
94,
90,
90,
90,
80,
90,
90,
100,
100,
100,
100,
100,
100,
100,
100,
100,
80,
0
],
"vol_min": [
@ -418,36 +418,36 @@
0,
0,
0,
0.52,
0.59,
52,
59,
0,
0,
0,
0,
0,
0.34,
34,
0,
0.65,
65,
0,
0,
0,
0,
0,
0,
0.53,
53,
0,
0,
0,
0,
0.2,
20,
0,
0,
0.52,
0.25,
0.66,
52,
25,
66,
0,
0,
0.69,
69,
0,
0,
0,

File diff suppressed because it is too large Load Diff

@ -416,7 +416,7 @@ bool load_sd_drumsettings_json(uint8_t number) {
#ifdef DEBUG
Serial.print(F("Found drums configuration ["));
Serial.print(filename);
Serial.println(F("]... loading..."));
Serial.println(F("]... loading"));
#endif
json = SD.open(filename);
if (json) {
@ -491,12 +491,12 @@ bool save_sd_drumsettings_json(uint8_t number) {
data_json["midi_channel"] = configuration.drums.midi_channel;
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG - 1; i++) {
data_json["note"][i] = drum_config[i].midinote;
data_json["pitch"][i] = drum_config[i].pitch;
data_json["pan"][i] = drum_config[i].pan;
data_json["vol_max"][i] = drum_config[i].vol_max;
data_json["vol_min"][i] = drum_config[i].vol_min;
data_json["reverb_send"][i] = drum_config[i].reverb_send;
data_json["note"][i] = configuration.drums.midinote[i];
data_json["pitch"][i] = configuration.drums.pitch[i];
data_json["pan"][i] = configuration.drums.pan[i];
data_json["vol_max"][i] = configuration.drums.vol_max[i];
data_json["vol_min"][i] = configuration.drums.vol_min[i];
data_json["reverb_send"][i] = configuration.drums.reverb_send[i];
}
#if defined(DEBUG) && defined(DEBUG_SHOW_JSON)

@ -1,6 +1,22 @@
#pragma once
#include "drums.h"
#include <Arduino.h>
typedef struct drum_config_s {
uint8_t drum_class; // Type of drum
uint8_t midinote; // Triggered by note
char name[DRUM_NAME_LEN];
const uint8_t* drum_data;
char shortname[2]; // 1 char name for sequencer
uint32_t len; // number of elements in drum_data
float32_t pitch; // variable pitch per note for sequencer
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)
} drum_config_t;
enum {DRUM_NONE, DRUM_BASS, DRUM_SNARE, DRUM_HIHAT, DRUM_HANDCLAP, DRUM_RIDE, DRUM_CRASH, DRUM_LOWTOM, DRUM_MIDTOM, DRUM_HIGHTOM, DRUM_PERCUSSION, DRUM_POLY};
// Converted from Clap808.wav, length = 7744 bytes
PROGMEM const uint8_t DRUM_Clap808[] = {
@ -239201,7 +239217,7 @@ PROGMEM const uint8_t DRUM_Vl1hbeep[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
PROGMEM const drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
{
{
DRUM_BASS,

Loading…
Cancel
Save