Skip to content

Commit

Permalink
increase midi velocity with factor 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pierstitus committed Aug 25, 2021
1 parent 0549817 commit ae9ce8b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions synth_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ extern "C" {

#define VOLUME_FACTOR 0.005f;

#define VELO_MIDI_FIX 4

void MidiSend1(uint8_t b0) {
midi_usb_MidiSend1(1, b0);
#ifdef USE_MIDI_SERIAL
Expand Down Expand Up @@ -652,7 +654,7 @@ class Instrument {
buttons[but].state = STATE_ON;
buttons[but].midinote = buttons[but].midinote_base + start_note_offset;
buttons[but].start_note_offset = start_note_offset;
int velo = 0 + buttons[but].vpres * velo_sensitivity * 256;
int velo = 0 + buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX;
if (velo > 127) velo = 127;
else if (velo < 1) velo = 1;
MidiSend3(MIDI_NOTE_ON | midi_channel_offset,
Expand Down Expand Up @@ -755,7 +757,7 @@ class Instrument {

} else { // Note off
buttons[but].state = STATE_OFF;
int velo = 0 - buttons[but].vpres * velo_sensitivity * 256;
int velo = 0 - buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX;
if (velo > 127) velo = 127;
else if (velo < 0) velo = 0;
MidiSend3(MIDI_NOTE_OFF | midi_channel_offset,
Expand Down Expand Up @@ -895,7 +897,7 @@ class Instrument {
buttons[but].state = STATE_OFF;

#ifdef USE_MIDI_OUT
int velo = 0 - buttons[but].vpres * velo_sensitivity * 256;
int velo = 0 - buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX;
if (velo > 127) velo = 127;
else if (velo < 0) velo = 0;
MidiSend3(MIDI_NOTE_OFF | (midi_channel_offset + buttons[but].voice),
Expand Down Expand Up @@ -934,7 +936,7 @@ class Instrument {
last_button = but;

#ifdef USE_MIDI_OUT
int velo = 0 + buttons[but].vpres * velo_sensitivity * 256;
int velo = 0 + buttons[but].vpres * velo_sensitivity * 128 * VELO_MIDI_FIX;
if (velo > 127) velo = 127;
else if (velo < 1) velo = 1;

Expand Down

0 comments on commit ae9ce8b

Please sign in to comment.