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. 43
      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
#if NUM_DRUMS > 0
AudioPlaySdRaw* Drum[NUM_DRUMS];
AudioAmplifier* drum_volume[NUM_DRUMS];
AudioEffectMonoStereo* drum_mono2stereo[NUM_DRUMS];
AudioPlaySdWav* Drum[NUM_DRUMS];
#if NUM_DRUMS < 5
AudioMixer4 drum_mixer_r;
AudioMixer4 drum_mixer_l;
@ -196,11 +194,11 @@ AudioConnection patchCord22(drum_mixer_l, 0, master_mixer_l, 2);
//
uint8_t nDynamic = 0;
#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
AudioConnection* dynamicConnections[NUM_DEXED * 15 + NUM_DRUMS * 6];
AudioConnection* dynamicConnections[NUM_DEXED * 15 + NUM_DRUMS * 4];
#else
AudioConnection* dynamicConnections[NUM_DEXED * 4 + NUM_DRUMS * 4];
AudioConnection* dynamicConnections[NUM_DEXED * 4 + NUM_DRUMS * 2];
#endif
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
void create_audio_drum_chain(uint8_t instance_id)
{
Drum[instance_id] = new AudioPlaySdRaw();
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_volume[instance_id], 0, *drum_mono2stereo[instance_id], 0);
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);
Drum[instance_id] = new AudioPlaySdWav();
dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 1, drum_mixer_l, instance_id);
#ifdef USE_FX
dynamicConnections[nDynamic++] = new AudioConnection(*drum_mono2stereo[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], 0, drum_reverb_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 1, drum_reverb_send_mixer_l, instance_id);
#endif
#ifdef DEBUG
@ -823,13 +817,14 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
if (inNumber == drum_config[d].midinote)
{
uint8_t slot = drum_get_slot(drum_config[d].type);
if (Drum[slot]->isPlaying())
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_mono2stereo[slot]->panorama(drum_config[d].pan);
drum_reverb_send_mixer_r.gain(slot, pseudo_log_curve(drum_config[d].reverb_send));
drum_reverb_send_mixer_l.gain(slot, pseudo_log_curve(drum_config[d].reverb_send));
float fsin = mapfloat(arm_sin_f32(drum_config[d].pan * PI / 2.0), -1.0, 1.0, 0.0, 1.0);
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_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, (1.0 - fsin) * 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);
#ifdef DEBUG
Serial.print(F("Drum "));
Serial.print(drum_config[d].shortname);
@ -842,7 +837,9 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
Serial.print(F(" P"));
Serial.print(drum_config[d].pan, 2);
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
break;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Loading…
Cancel
Save