Can somebody point to the section of code where I can see which wav file is being triggered and played? I am having some issues with randomization feature using %seq parameter.
Dave Hilowitz came up with this feature, which is not implemented in Joseph's core release (I suspect you are using the one downloadable from this website). You can find Dave's version here:
I have also implemented it into my development:
Thanks Alex. Yes I was using the downloadable version from the website as it is the latest image. Has someone merged different enhancements to the original and created one master (read only) image downloadable under some versioning system?
This is a version of the latter above, so it is not up to date - but %seq is included.
I am trying to print the name of sample file which is being triggered at the current velocity -
I modified the code -
if messagetype == 9: # Note on
print("Note ",midinote," at velocity",velocity," ")
on running the code i get
Preset loaded: 0
('Note ', 36, ' at velocity', 31, ' ')
Exception NameError: "global name 'filename' is not defined" in 'rtmidi_python.midi_in_callback' ignored
Please help me in sorting out this issue. Thanks in advance.
Samples get loaded if definition.txt contains
Empty samples if definition.txt is changed to
%midinote_*vel%velocity_%seq.wav to demonstrate randomization
Please help ASAP.
Many thanks in advance
Are you using the original, or the version posted above?
Preset loaded: 0 indicates to me that you're still testing the original version, which doesn't have sample randomization.
print(filename) error, this would be due to the filename variable not being available within the callback function scope.
"re print(filename) error, this would be due to the filename variable not being available within the callback function scope." - I do understand that.
Can you please provide pointer to where I should put the print statement in the code so that I get the filename of the sample being triggered in real time?
I can't test this right now, but try looking here: https://github.com/josephernest/SamplerBox/blob/master/samplerbox.py#L204-L207
and try changing to:
try: playingnotes.setdefault(midinote, ).append(samples[midinote, velocity].play(midinote)) print samples[midinote, velocity].fname except: pass
I am getting following error -
Exception AttributeError: "'NoneType' object has no attribute 'fname'" in 'rtmidi_python.midi_in_callback' ignored
As per above, can you specify which version you're using? I just tested the code snippet above with Joseph's version (from the website) and no errors here. Have you modified the code in any other way? Are you testing on your RPi or on your PC?