sample randomization

R
Rajiv Deo posted Oct 29, 11:08:

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.

A
AlexM posted Oct 30, 03:15:

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:

https://github.com/dhilowitz/SamplerBox

I have also implemented it into my development:

https://github.com/alexmacrae/SamplerBox
Docs: http://samplerbox.readthedocs.io/en/latest/

R
Rajiv Deo posted Oct 31, 08:49:

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?

A
AlexM posted Oct 31, 09:13:

This is a version of the latter above, so it is not up to date - but %seq is included.

http://www.samplerboxshop.com/2017-05-17_samplerbox.img.zip

R
Rajiv Deo posted Oct 31, 11:01:

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," ")
print(filename)

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.

R
Rajiv Deo posted Oct 31, 11:37:

Samples get loaded if definition.txt contains
%midinote_vel%velocity.wav

Empty samples if definition.txt is changed to
%midinote_*vel%velocity_%seq.wav to demonstrate randomization

Please help ASAP.

Many thanks in advance

A
AlexM posted Oct 31, 11:47:

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.

re print(filename) error, this would be due to the filename variable not being available within the callback function scope.

R
Rajiv Deo posted Nov 1, 05:31:

"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?

A
AlexM posted Nov 1, 05:53:

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
R
Rajiv Deo posted Nov 1, 06:31:

I am getting following error -
Exception AttributeError: "'NoneType' object has no attribute 'fname'" in 'rtmidi_python.midi_in_callback' ignored

A
AlexM posted Nov 1, 08:22:

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?

...

  (not published)
  I want to post as guest
 

Post