Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong lsb message before every program change #20

Open
snsllrs opened this issue Jul 14, 2024 · 0 comments
Open

wrong lsb message before every program change #20

snsllrs opened this issue Jul 14, 2024 · 0 comments

Comments

@snsllrs
Copy link

snsllrs commented Jul 14, 2024

here:

print "Sending program change to program %d..." % program_number
# Bank change (fine) to (program_number / 128)
midiout.send_message([
CC_CHANNEL_OFFSET + midi_channel,
0x20,
int(program_number / 128),
])

it's better to add bank_number in command line arguments like this:

  1. recommended changes in midi_helpers.py:

def set_program_number(midiout, midi_channel, program_number, bank_number):
if bank_number is not None:
print "Sending bank change to bank %d..." % bank_number
# Bank change (fine) to bank_number % 128
midiout.send_message([
CC_CHANNEL_OFFSET + midi_channel,
0x20,
bank_number % 128,
])
if program_number is not None:
print "Sending program change to program %d..." % program_number
# Program change to program number % 128
midiout.send_message([
CHANNEL_OFFSET + midi_channel,
0xC0,
program_number % 128,
])

# All notes off, but like, a lot
for _ in xrange(0, 2):
    all_notes_off(midiout, midi_channel)

time.sleep(0.5)
  1. recommended changes in record.py

    sampling_options.add_argument(
    '--program-number', type=int,
    help='switch to a program number before recording')
    sampling_options.add_argument(
    '--bank-number', type=int,
    help='switch to a bank number before recording')

3 recommended changes in record.py

def sample_program(
output_folder='foo',
low_key=21,
high_key=109,
max_attempts=8,
midi_channel=1,
midi_port_name=None,
midi_port_index=None,
audio_interface_name=None,
audio_interface_index=None,
cc_before=None,
program_number=None,
bank_number=None,
cc_after=None,
flac=True,
velocity_levels=VELOCITIES,
key_range=1,
cleanup_aif_files=True,
limit=None,
looping_enabled=False,
print_progress=False,
has_portamento=False,
sample_asc=False,
sample_rate=SAMPLE_RATE,
):

and

set_program_number(midiout, midi_channel, program_number, bank_number)

So you can change bank number as you wish with --bank_number argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant