Is there anyway to add velocity sensitivity without having to do multiple audio layers?
I don't think you can change the velocity sensitivity without modifying the code.
But this could be added fairly easily (but I didn't test it so keep that in mind)
In L311 : https://github.com/josephernest/SamplerBox/blob/master/samplerbox.py#L311
Modify the velocity variable to make it more sensitive.
Velocity is between 0/127 so if you want it to more sensitive you could add
samples[midinote, velocity] = Sound(os.path.join(dirname, fname), midinote, velocity + 32)
Unfortunately if you want to make it less sensitive this could result in negative value with velocity which will probably not be a good idea.
I'll try to see if I can add a settings to handle this.
It depends on what do you want to achieve @John.
Do you want MIDI velocity to modify the volume? to filter (EQ) the sound? Something else?
What is the desired behaviour?
@remi: unfortunately, the code you proposed would not work. We would need to add some more code to actually do something on the sound (modify the individual volume of each note and/or modify its EQ).
I've made a couple of patches that only have one sample layer. I'd like to be able to just change the volume of a sample instead of having to play another sample at a lower level.
Ok @John. Technically, it's not very hard to add this.
I'm just thinking and trying to find a clever way to propose this feature in the definition.txt
sample-set definition format.
Should we add some keyword for that? Something like:
%notename.wav,%velocity_modifies_volume=yes
Need to find a better name for this feature ;) %velocity_modifies_volume
is too long.
Something else: how should it be modified? Which curve to use? i.e. :
velocity 127 => 0 dB of volume modification
velocity 100 => -5 dB (?)
velocity 64 => -10 dB (?)
...
velocity 0 => -inf dB (ie volume = 0)
we could use log, or exp, or something more linear...
Well these are the questions that need to be discussed for this feature.
I would suggest selectable curves between linear, log and exp and make that part of the definition.
%vel-mod=yes
%curve = lin
Again, many thanks for making this project!
I was wondering if there had been any further development on this issue? I also have a situation whereby I am building a drum sample library, and could really do with some way of increasing the overall volume of an individual note - for example: being able to turn up the snare on note 38, while turning down the volume of the hat on note 26, etc.
Otherwise, I absolutely love this project!
Thanks
That feature would be great. I am willing to help with the code. What is the name of the file that searchs for the params in definitions.txt?
That feature would be great. I am willing to help with the code. What is the name of the file that searchs for the params in definitions.txt?
That feature would be great. I am willing to help with the code. What is the name of the file that searchs for the params in definitions.txt?
That feature would be great. I am willing to help with the code. What is the name of the file that searchs for the params in definitions.txt?
@Joseph
Technically, it's not very hard to add this
How can you vary the volume per note.
In other words: how can I propagate the velocity of the note just hit into the volume of the sample to be played?
Thanks in advance, Hans
Hi Joseph,
Something went wrong with the formatting :-)
I wanted to quote your statement and add my question on how to do that.
Sorry for the confusion, Hans
I changed the 'mapping' of the velocity of the midi key to the wave file chosen in the definition.txt file. I start with velocity = 1 then 5, 9, 13, 16 to make it less 'steep'. Now the soft touches sound better!
I have implemented %%velocitysensitivity option for patches to change volume depending on velocity
https://github.com/josephernest/SamplerBox/pull/10
Hi here and thanks Joseph !
Newbee with python , i'm trying to use volume knob on my midi controler (M-Audio Keystation mini 32) to adjust...output volume level :-)
I used MidiOx (great midi tool !!) to find the corect midi code.
In Def MidiCallback section, it's easy to read the volume Knob value (0-127) using :
if (messagetype == 11) and (note == 7):
volume_knob = velocity
print str(volume_knob) # debug
But after som tries, i dont know where apply the value of volume_knob to adjust the level...
It seems to me that the pavel's solution could be the good one for me but i'm not able to understand all
Thanks for help !
Until my changes are merged to mainstream, to use them:
git clone https://github.com/paul-at/SamplerBox/tree/velocity-sensitive
cd SamplerBox; make
Add %%velocitysensitivity=1 to definition.txt in patch directory. If it does not exist alredy, create following:
%midinote.wav
%%velocitysensitivity=1
Reading your message again, if you are looking for a knob to control global volume rather than note volume, you don't have to use my code, just modify globalvolume variable that already exists on a message from knob and thats it.
correction: git clone -b velocity-sensitive https://github.com/paul-at/SamplerBox
Thanks Pavel i'll try this !
Hey Pavel, thanks for the script, it's really appreciated !
I tried implementing it but I couldn't.
First I tried to use git clone (corrected version), but I got back an error saying the samplerbox folder already existed. I then tried again with the Samplerbox folder deleted, and managed to git clone and make. But now samplerbox.py doesn't work anymore.
Cf error log :
root@samplerbox:~# systemctl status samplerbox -l
● samplerbox.service - Starts SamplerBox
Loaded: loaded (/etc/systemd/system/samplerbox.service; enabled)
Active: failed (Result: exit-code) since Thu 1970-01-01 01:00:05 CET; 16min ago
Process: 81 ExecStart=/root/SamplerBox/samplerbox.sh (code=exited, status=203/EXEC)
Main PID: 81 (code=exited, status=203/EXEC)
Jan 01 01:00:05 samplerbox systemd[1]: samplerbox.service: main process exited, code=exited, status=203/EXEC
Jan 01 01:00:05 samplerbox systemd[1]: Unit samplerbox.service entered failed stzte
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Would anybody have any ideas how to fix that issue ? I'd love to have that functionality availiable.
If it is any help, I'm not sure the "make" part of the instruction was a complete success. I don't have the log right now, but I could get it if you need.
i have an issue when trying to launch samplerbox.py
python samplerbox.py
Traceback (most recent call last):
File "samplerbox.py", line 46, in <module>
import samplerbox_audio_neon as samplerbox_audio # ARM NEON instruction set
ImportError: No module named samplerbox_audio_neon
any idea?
cheers
ok, i had forgotten to run the make after the upload
it is working fine now
Hey Pavel,I tried this code on github, but I run it on a arm64 device, I run the make,
aarch64-linux-gnu-gcc:error : unrecognized command line option '-mfloat-abi=har'
aarch64-linux-gnu-gcc:error : unrecognized command line option '-mpfu=neon-vfpv'
makefile:2: recipe for target 'samplerbox_audio.so' failed