SYSEX voice upload added (works with Hr. Muellers DX Editor https://dx7.vstforx.de/).

pull/3/head
Holger Wirtz 5 years ago
parent 78690c345a
commit 911ceb6a3f
  1. 20
      MicroDexed.ino
  2. 81
      dexed.cpp
  3. 3
      dexed.h
  4. 6
      dexed_sysex.cpp
  5. 165
      doc/one_sysex_data.txt

@ -662,7 +662,7 @@ void handleSystemExclusive(byte * sysex, uint len)
// 1 Voice bulk upload
#ifdef DEBUG
Serial.println(F("1 Voice bulk upload"));
Serial.println(F("One Voice bulk upload"));
#endif
if (sysex[162] != 0xf7)
@ -709,19 +709,13 @@ void handleSystemExclusive(byte * sysex, uint len)
}
// load sysex-data into voice memory
uint8_t tmp_data[155];
memset(tmp_data, 0, 155 * sizeof(uint8_t));
for (uint8_t i = 0; i < 155 ; i++)
{
tmp_data[i] = sysex[i + 6];
}
strncpy(voice_name, (char *)&tmp_data[145], sizeof(voice_name) - 1);
Serial.print(F("Voice ["));
strncpy(voice_name, (char *)&sysex[151], sizeof(voice_name) - 1);
Serial.print(F("Found Voice ["));
Serial.print(voice_name);
Serial.print(F("] loaded."));
dexed->loadVoiceParameters(tmp_data);
Serial.println(F("]."));
dexed->loadVoiceParameters(&sysex[6]);
//dexed->initGlobalParameters();
}
#ifdef DEBUG
else

@ -425,13 +425,13 @@ uint8_t Dexed::getNumNotesPlaying(void)
return (count_playing_voices);
}
bool Dexed::loadVoiceParameters(uint8_t* data)
bool Dexed::loadPackedVoiceParameters(uint8_t* new_data)
{
uint8_t* p_data = data;
uint8_t op;
uint8_t tmp;
//notesOff();
notesOff();
for (op = 0; op < 6; op++)
{
@ -446,21 +446,21 @@ bool Dexed::loadVoiceParameters(uint8_t* data)
// DEXED_OP_LEV_SCL_BRK_PT, // 8
// DEXED_OP_SCL_LEFT_DEPTH, // 9
// DEXED_OP_SCL_RGHT_DEPTH, // 10
memcpy(&data[op * 21], &data[op * 17], 11);
tmp = data[(op * 17) + 11];
memcpy(&data[op * 21], &new_data[op * 17], 11);
tmp = new_data[(op * 17) + 11];
*(p_data + DEXED_OP_SCL_LEFT_CURVE + (op * 21)) = (tmp & 0x3);
*(p_data + DEXED_OP_SCL_RGHT_CURVE + (op * 21)) = (tmp & 0x0c) >> 2;
tmp = data[(op * 17) + 12];
tmp = new_data[(op * 17) + 12];
*(p_data + DEXED_OP_OSC_DETUNE + (op * 21)) = (tmp & 0x78) >> 3;
*(p_data + DEXED_OP_OSC_RATE_SCALE + (op * 21)) = (tmp & 0x07);
tmp = data[(op * 17) + 13];
tmp = new_data[(op * 17) + 13];
*(p_data + DEXED_OP_KEY_VEL_SENS + (op * 21)) = (tmp & 0x1c) >> 2;
*(p_data + DEXED_OP_AMP_MOD_SENS + (op * 21)) = (tmp & 0x03);
*(p_data + DEXED_OP_OUTPUT_LEV + (op * 21)) = data[(op * 17) + 14];
tmp = data[(op * 17) + 15];
*(p_data + DEXED_OP_OUTPUT_LEV + (op * 21)) = new_data[(op * 17) + 14];
tmp = new_data[(op * 17) + 15];
*(p_data + DEXED_OP_FREQ_COARSE + (op * 21)) = (tmp & 0x3e) >> 1;
*(p_data + DEXED_OP_OSC_MODE + (op * 21)) = (tmp & 0x01);
*(p_data + DEXED_OP_FREQ_FINE + (op * 21)) = data[(op * 17) + 16];
*(p_data + DEXED_OP_FREQ_FINE + (op * 21)) = new_data[(op * 17) + 16];
}
// DEXED_PITCH_EG_R1, // 0
// DEXED_PITCH_EG_R2, // 1
@ -470,30 +470,51 @@ bool Dexed::loadVoiceParameters(uint8_t* data)
// DEXED_PITCH_EG_L2, // 5
// DEXED_PITCH_EG_L3, // 6
// DEXED_PITCH_EG_L4, // 7
memcpy(&data[DEXED_VOICE_OFFSET], &data[102], 8);
tmp = data[110];
memcpy(&data[DEXED_VOICE_OFFSET], &new_data[102], 8);
tmp = new_data[110];
*(p_data + DEXED_VOICE_OFFSET + DEXED_ALGORITHM) = (tmp & 0x1f);
tmp = data[111];
tmp = new_data[111];
*(p_data + DEXED_VOICE_OFFSET + DEXED_OSC_KEY_SYNC) = (tmp & 0x08) >> 3;
*(p_data + DEXED_VOICE_OFFSET + DEXED_FEEDBACK) = (tmp & 0x07);
// DEXED_LFO_SPEED, // 11
// DEXED_LFO_DELAY, // 12
// DEXED_LFO_PITCH_MOD_DEP, // 13
// DEXED_LFO_AMP_MOD_DEP, // 14
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], &data[112], 4);
tmp = data[116];
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_LFO_SPEED], &new_data[112], 4);
tmp = new_data[116];
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_PITCH_MOD_SENS) = (tmp & 0x30) >> 4;
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_WAVE) = (tmp & 0x0e) >> 1;
*(p_data + DEXED_VOICE_OFFSET + DEXED_LFO_SYNC) = (tmp & 0x01);
*(p_data + DEXED_VOICE_OFFSET + DEXED_TRANSPOSE) = data[117];
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_NAME], &data[118], 10);
*(p_data + DEXED_VOICE_OFFSET + DEXED_TRANSPOSE) = new_data[117];
memcpy(&data[DEXED_VOICE_OFFSET + DEXED_NAME], &new_data[118], 10);
//panic();
panic();
doRefreshVoice();
//activate();
strncpy(voice_name, (char *)&data[145], sizeof(voice_name) - 1);
strncpy(voice_name, (char *)&new_data[145], sizeof(voice_name) - 1);
voice_name[10] = '\0';
#ifdef DEBUG
Serial.print(F("Voice ["));
Serial.print(voice_name);
Serial.println(F("] loaded."));
#endif
return (true);
}
bool Dexed::loadVoiceParameters(uint8_t* new_data)
{
notesOff();
memcpy(&data, new_data, 155);
panic();
doRefreshVoice();
//activate();
strncpy(voice_name, (char *)&new_data[145], sizeof(voice_name) - 1);
voice_name[10] = '\0';
#ifdef DEBUG
Serial.print(F("Voice ["));
Serial.print(voice_name);
@ -503,21 +524,21 @@ bool Dexed::loadVoiceParameters(uint8_t* data)
return (true);
}
bool Dexed::loadGlobalParameters(uint8_t* data)
bool Dexed::loadGlobalParameters(uint8_t* new_data)
{
uint8_t* p_data = data;
controllers.values_[kControllerPitchRange] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE];
controllers.values_[kControllerPitchStep] = data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP];
controllers.wheel.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]);
controllers.wheel.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]);
controllers.foot.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]);
controllers.foot.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]);
controllers.breath.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]);
controllers.breath.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]);
controllers.at.setRange(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]);
controllers.at.setTarget(data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]);
controllers.masterTune = (data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] * 0x4000 << 11) * (1.0 / 12);
controllers.values_[kControllerPitchRange] = new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_RANGE];
controllers.values_[kControllerPitchStep] = new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_PITCHBEND_STEP];
controllers.wheel.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_RANGE]);
controllers.wheel.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MODWHEEL_ASSIGN]);
controllers.foot.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_RANGE]);
controllers.foot.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_FOOTCTRL_ASSIGN]);
controllers.breath.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_RANGE]);
controllers.breath.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_BREATHCTRL_ASSIGN]);
controllers.at.setRange(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_RANGE]);
controllers.at.setTarget(new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_AT_ASSIGN]);
controllers.masterTune = (new_data[DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_MASTER_TUNE] * 0x4000 << 11) * (1.0 / 12);
controllers.refresh();
setOPs((*(p_data + DEXED_GLOBAL_PARAMETER_OFFSET + DEXED_OP1_ENABLE) << 5) |

@ -156,6 +156,7 @@ class Dexed
uint8_t getMaxNotes(void);
void doRefreshVoice(void);
void setOPs(uint8_t ops);
bool loadPackedVoiceParameters(uint8_t* data);
bool loadVoiceParameters(uint8_t* data);
bool loadGlobalParameters(uint8_t* data);
bool initGlobalParameters(void);
@ -180,7 +181,7 @@ class Dexed
04, 06, 00, // algorithm, feedback, osc sync
34, 33, 00, 00, 00, 04, // lfo speed, lfo delay, lfo pitch_mod_depth, lfo_amp_mod_depth, lfo_sync, lfo_waveform
03, 24, // pitch_mod_sensitivity, transpose
69, 68, 80, 56, 85 , 76, 84, 00, 00, 00, // 10 * char for name ("DEFAULT ")
69, 68, 80, 56, 85, 76, 84, 00, 00, 00, // 10 * char for name ("DEFAULT ")
01, 00, 99, 00, 99, 00, 99, 00, 99, 00, // pitch_bend_range, pitch_bend_step, mod_wheel_range, mod_wheel_assign, foot_ctrl_range, foot_ctrl_assign, breath_ctrl_range, breath_ctrl_assign, aftertouch_range, aftertouch_assign
00, // master tune
01, 01, 01, 01, 01, 01, // OP1-6 enable

@ -247,16 +247,16 @@ bool load_sysex(uint8_t b, uint8_t v)
if (get_sysex_voice(sysex, v, data))
{
#ifdef DEBUG
char n[11];
//char n[11];
strncpy(n, (char*)&data[118], 10);
//strncpy(n, (char*)&data[118], 10);
Serial.print("Loading sysex ");
Serial.print(sysex_file_name);
Serial.print(F(" ["));
Serial.print(voice_names[v]);
Serial.println(F("]"));
#endif
return (dexed->loadVoiceParameters(data));
return (dexed->loadPackedVoiceParameters(data));
}
#ifdef DEBUG
else

@ -1,165 +0,0 @@
SYSEX-Data[163]
240
67
0
0
1
27
73
75
5
0
99
99
92
0
49
0
0
0
0
7
0
0
84
0
2
0
12
77
54
0
47
98
98
36
0
49
0
0
0
0
2
0
5
99
0
2
0
3
99
74
10
0
98
98
36
0
98
0
0
0
0
5
0
1
84
0
2
0
10
83
15
10
47
99
92
0
0
49
0
0
0
0
0
0
0
99
0
2
0
10
64
38
6
0
99
92
99
0
49
0
0
0
0
7
0
1
87
0
2
1
6
0
33
0
47
0
99
85
0
98
0
0
0
0
0
0
0
50
0
17
37
7
84
95
95
60
50
50
50
50
4
6
0
30
0
11
0
0
0
2
12
83
89
78
84
72
32
69
78
83
50
107
247
Loading…
Cancel
Save