Replaced PlaySDRaw with PalySDWav because WAV playing has a much better buffer handling so dropouts no longer occur.

pull/54/head
Holger Wirtz 3 years ago
parent 4fcd5f28df
commit bf62c37cf7
  1. 41
      MicroDexed.ino
  2. BIN
      addon/SD/drm/808Clap1.wav
  3. BIN
      addon/SD/drm/808HHCL1.wav
  4. BIN
      addon/SD/drm/808RimS1.wav
  5. 38
      addon/SD/drm/CFG_MDDrums.json
  6. BIN
      addon/SD/drm/PHKick1.wav
  7. BIN
      addon/SD/drm/bd01.wav
  8. BIN
      addon/SD/drm/bd02.wav
  9. BIN
      addon/SD/drm/bd03.wav
  10. BIN
      addon/SD/drm/bd04.wav
  11. BIN
      addon/SD/drm/bd05.wav
  12. BIN
      addon/SD/drm/bd06.wav
  13. BIN
      addon/SD/drm/bd07.wav
  14. BIN
      addon/SD/drm/bd08.wav
  15. BIN
      addon/SD/drm/bd09.wav
  16. BIN
      addon/SD/drm/bd10.wav
  17. BIN
      addon/SD/drm/cp01.wav
  18. BIN
      addon/SD/drm/cp02.wav
  19. BIN
      addon/SD/drm/cr01.wav
  20. BIN
      addon/SD/drm/cr02.wav
  21. BIN
      addon/SD/drm/hh01.wav
  22. BIN
      addon/SD/drm/hh02.wav
  23. BIN
      addon/SD/drm/ht01.wav
  24. BIN
      addon/SD/drm/ht02.wav
  25. BIN
      addon/SD/drm/lt01.wav
  26. BIN
      addon/SD/drm/lt02.wav
  27. BIN
      addon/SD/drm/mt01.wav
  28. BIN
      addon/SD/drm/mt02.wav
  29. BIN
      addon/SD/drm/oh01.wav
  30. BIN
      addon/SD/drm/oh02.wav
  31. BIN
      addon/SD/drm/rd01.wav
  32. BIN
      addon/SD/drm/rd02.wav
  33. BIN
      addon/SD/drm/rs01.wav
  34. BIN
      addon/SD/drm/sd01.wav
  35. BIN
      addon/SD/drm/sd02.wav
  36. BIN
      addon/SD/drm/sd03.wav
  37. BIN
      addon/SD/drm/sd04.wav
  38. BIN
      addon/SD/drm/sd05.wav
  39. BIN
      addon/SD/drm/sd06.wav
  40. BIN
      addon/SD/drm/sd07.wav
  41. BIN
      addon/SD/drm/sd08.wav
  42. BIN
      addon/SD/drm/sd09.wav
  43. BIN
      addon/SD/drm/sd10.wav
  44. BIN
      addon/SD/drm/sd11.wav
  45. BIN
      addon/SD/drm/sd12.wav
  46. BIN
      addon/SD/drm/sd13.wav
  47. BIN
      addon/SD/drm/sd14.wav
  48. BIN
      addon/SD/drm/sd15.wav
  49. 11
      doc/convert_wav2raw.txt
  50. 34
      drums.h

@ -89,9 +89,7 @@ AudioMixer4 audio_thru_mixer_l;
// Drumset // Drumset
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
AudioPlaySdRaw* Drum[NUM_DRUMS]; AudioPlaySdWav* Drum[NUM_DRUMS];
AudioAmplifier* drum_volume[NUM_DRUMS];
AudioEffectMonoStereo* drum_mono2stereo[NUM_DRUMS];
#if NUM_DRUMS < 5 #if NUM_DRUMS < 5
AudioMixer4 drum_mixer_r; AudioMixer4 drum_mixer_r;
AudioMixer4 drum_mixer_l; AudioMixer4 drum_mixer_l;
@ -196,11 +194,11 @@ AudioConnection patchCord22(drum_mixer_l, 0, master_mixer_l, 2);
// //
uint8_t nDynamic = 0; uint8_t nDynamic = 0;
#if defined(USE_FX) && MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT #if defined(USE_FX) && MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioConnection* dynamicConnections[NUM_DEXED * 16 + NUM_DRUMS * 6 ]; AudioConnection* dynamicConnections[NUM_DEXED * 16 + NUM_DRUMS * 4 ];
#elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT #elif defined(USE_FX) && MOD_FILTER_OUTPUT == MOD_NO_FILTER_OUTPUT
AudioConnection* dynamicConnections[NUM_DEXED * 15 + NUM_DRUMS * 6]; AudioConnection* dynamicConnections[NUM_DEXED * 15 + NUM_DRUMS * 4];
#else #else
AudioConnection* dynamicConnections[NUM_DEXED * 4 + NUM_DRUMS * 4]; AudioConnection* dynamicConnections[NUM_DEXED * 4 + NUM_DRUMS * 2];
#endif #endif
void create_audio_dexed_chain(uint8_t instance_id) void create_audio_dexed_chain(uint8_t instance_id)
{ {
@ -257,17 +255,13 @@ void create_audio_dexed_chain(uint8_t instance_id)
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
void create_audio_drum_chain(uint8_t instance_id) void create_audio_drum_chain(uint8_t instance_id)
{ {
Drum[instance_id] = new AudioPlaySdRaw(); Drum[instance_id] = new AudioPlaySdWav();
drum_volume[instance_id] = new AudioAmplifier();
drum_mono2stereo[instance_id] = new AudioEffectMonoStereo();
dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, *drum_volume[instance_id], 0); dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*drum_volume[instance_id], 0, *drum_mono2stereo[instance_id], 0); dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 1, drum_mixer_l, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 0, drum_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 1, drum_mixer_l, instance_id);
#ifdef USE_FX #ifdef USE_FX
dynamicConnections[nDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 0, drum_reverb_send_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_reverb_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 1, drum_reverb_send_mixer_l, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 1, drum_reverb_send_mixer_l, instance_id);
#endif #endif
#ifdef DEBUG #ifdef DEBUG
@ -823,13 +817,14 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
if (inNumber == drum_config[d].midinote) if (inNumber == drum_config[d].midinote)
{ {
uint8_t slot = drum_get_slot(drum_config[d].type); uint8_t slot = drum_get_slot(drum_config[d].type);
if (Drum[slot]->isPlaying()) float fsin = mapfloat(arm_sin_f32(drum_config[d].pan * PI / 2.0), -1.0, 1.0, 0.0, 1.0);
Drum[slot]->stop();
drum_volume[slot]->gain(pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); drum_mixer_r.gain(slot, (1.0 - fsin) * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_mono2stereo[slot]->panorama(drum_config[d].pan); drum_mixer_l.gain(slot, fsin * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_reverb_send_mixer_r.gain(slot, pseudo_log_curve(drum_config[d].reverb_send)); drum_reverb_send_mixer_r.gain(slot, (1.0 - fsin) * pseudo_log_curve(drum_config[d].reverb_send));
drum_reverb_send_mixer_l.gain(slot, pseudo_log_curve(drum_config[d].reverb_send)); drum_reverb_send_mixer_l.gain(slot, fsin * pseudo_log_curve(drum_config[d].reverb_send));
Drum[slot]->play(drum_config[d].filename); Drum[slot]->play(drum_config[d].filename);
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Drum ")); Serial.print(F("Drum "));
Serial.print(drum_config[d].shortname); Serial.print(drum_config[d].shortname);
@ -842,7 +837,9 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
Serial.print(F(" P")); Serial.print(F(" P"));
Serial.print(drum_config[d].pan, 2); Serial.print(drum_config[d].pan, 2);
Serial.print(F(" RS")); Serial.print(F(" RS"));
Serial.println(drum_config[d].reverb_send, 2); Serial.print(drum_config[d].reverb_send, 2);
Serial.print(F(" fsin"));
Serial.println(fsin, 2);
#endif #endif
break; break;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,24 +1,22 @@
{ {
[ "bd01": {
type: "DRUM_BASS", "type": "DRUM_BASS",
midinote: "MIDI_C3", "midinote": "MIDI_C3",
filename: "bd01.raw", "shortname": "B",
shortname: "B", "pan": 0.0,
pan: 0.0, "vol_max": 0.8,
vol_max: 0.8, "vol_min": 0.0,
vol_min: 0.0, "reverb_send": 0.0
reverb_send: 0.0 },
], "cp02": {
[ "type": "DRUM_HANDCLAP",
type: "DRUM_HANDCLAP", "midinote": "MIDI_CIS3",
midinote: "MIDI_CIS3", "shortname": "C",
filename: "cp02.raw", "pan": -0.4,
shortname: "C", "vol_max:" 0.6,
pan: -0.4, "vol_min:" 0.0,
vol_max: 0.6, "reverb_send:" 0.4
vol_min: 0.0, },
reverb_send: 0.4
],
[ [
type: "DRUM_SNARE", type: "DRUM_SNARE",
midinote: "MIDI_D3", midinote: "MIDI_D3",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,11 @@
Convert WAV to RAW:
for i in *.wav
do
sox $i -c 1 -b 16 -L `basename $i .wav`.raw
done
Convert RAW to WAV:
for i in *.raw
do
sox -r 44100 -c 1 -b 16 -L -e signed $i `basename $i .raw`.wav
done

@ -49,7 +49,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_BASS, DRUM_BASS,
MIDI_C3, MIDI_C3,
"/drm/bd01.raw", "/drm/bd01.wav",
"B", "B",
0.0, 0.0,
0.8, 0.8,
@ -59,7 +59,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HANDCLAP, DRUM_HANDCLAP,
MIDI_CIS3, MIDI_CIS3,
"/drm/cp02.raw", "/drm/cp02.wav",
"C", "C",
-0.4, -0.4,
0.6, 0.6,
@ -69,7 +69,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_SNARE, DRUM_SNARE,
MIDI_D3, MIDI_D3,
"/drm/sd15.raw", "/drm/sd15.wav",
"S", "S",
0.2, 0.2,
0.6, 0.6,
@ -79,7 +79,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HIHAT, DRUM_HIHAT,
MIDI_FIS3, MIDI_FIS3,
"/drm/hh01.raw", "/drm/hh01.wav",
"h", "h",
0.8, 0.8,
0.2, 0.2,
@ -89,7 +89,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HIHAT, DRUM_HIHAT,
MIDI_GIS3, MIDI_GIS3,
"/drm/hh02.raw", "/drm/hh02.wav",
"h", "h",
0.8, 0.8,
0.2, 0.2,
@ -99,7 +99,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HIHAT, DRUM_HIHAT,
MIDI_AIS3, MIDI_AIS3,
"/drm/oh02.raw", "/drm/oh02.wav",
"H", "H",
0.8, 0.8,
0.2, 0.2,
@ -109,7 +109,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_LOWTOM, DRUM_LOWTOM,
MIDI_G3, MIDI_G3,
"/drm/lt01.raw", "/drm/lt01.wav",
"T", "T",
-0.7, -0.7,
0.8, 0.8,
@ -119,7 +119,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HIGHTOM, DRUM_HIGHTOM,
MIDI_A3, MIDI_A3,
"/drm/ht01.raw", "/drm/ht01.wav",
"T", "T",
-0.5, -0.5,
0.8, 0.8,
@ -129,7 +129,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_RIDE, DRUM_RIDE,
MIDI_CIS4, MIDI_CIS4,
"/drm/rd01.raw", "/drm/rd01.wav",
"R", "R",
-0.6, -0.6,
0.3, 0.3,
@ -139,7 +139,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_RIDE, DRUM_RIDE,
MIDI_DIS4, MIDI_DIS4,
"/drm/rd02.raw", "/drm/rd02.wav",
"R", "R",
-0.6, -0.6,
0.3, 0.3,
@ -149,9 +149,9 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_BASS, DRUM_BASS,
MIDI_C5, MIDI_C5,
"/drm/PHKick1.raw", "/drm/PHKick1.wav",
"B", "B",
0.0, -1.0,
0.9, 0.9,
0.0, 0.0,
0.0 0.0
@ -159,9 +159,9 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HANDCLAP, DRUM_HANDCLAP,
MIDI_DIS5, MIDI_DIS5,
"/drm/808Clap1.raw", "/drm/808Clap1.wav",
"C", "C",
0.0, 1.0,
0.9, 0.9,
0.0, 0.0,
0.4 0.4
@ -169,7 +169,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_SNARE, DRUM_SNARE,
MIDI_CIS5, MIDI_CIS5,
"/drm/808RimS1.raw", "/drm/808RimS1.wav",
"R", "R",
-0.3, -0.3,
0.5, 0.5,
@ -179,9 +179,9 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_HIHAT, DRUM_HIHAT,
MIDI_FIS5, MIDI_FIS5,
"/drm/808HHCL1.raw", "/drm/808HHCL1.wav",
"H", "H",
0.4, 1.0,
0.6, 0.6,
0.0, 0.0,
0.0 0.0

Loading…
Cancel
Save