RP3 + Samplebox + solved velocity bug + added backingtracks options

Erik posted Apr 18 '16, 10:12:

I installed Raspbian via NOOBS on a Raspberry PI 3, installed the manual way, selected the right interface and it works. No tricks at all.
I used the full version, it works both in the graphical environment and in the shell. I configured that the system starts up in shell mode and for development I use the graphical environment, it is al little bit less stable and some clicks occure when I use graphical things (like scrolling). In shell mode it is very stable. I changed the latency to a low buffer size of 32. It is really fast, no noticeable latency.

Velocity bug:
I noticed that it is difficult to play very soft. After some debugging I found that the played velocity is not actually used as velocity, but only to select the correct sample. It play every sample at full speed. So if there are 2 velocity levels, you only get 2 velocities.
I solved it by adding the velocity as a parameter to the Cython part and use it in the sound playing engine. I have a self created piano sample set (taken from my Yamaha CVP609) with 6 layers and it plays beautiful after this modification.
All samples are normalized to full volume and the samples are trimmed in the beginning. The included piano is not normalized and has up to 8 ms silence in the samples that is added to all the latency of the chain (midi-controller, midi, Samplebox software).

Backing tracks:
I modified the audio callback to add a backing track in the same audio device as the Sample is played. Also a click track is added to another audio device. It is working now, just need to find a way to integrate it into a midi-controller. I'm thinking about using channel 16 for this and select the track via a program change. Also add volume control to the sample engine, Backing track and Click track via a CC. I can program this from my midi controller as part of a patch (sample, backingtrack and volumes)

Future: Reverb:
I miss some reverb. Because the RP3 is so fast, i'm going to investigate if a freeverb implementation in the Cython code is possible.
For now I use a trick where I use a piano from my controller with a full wet reverb, this works when the reverb is only very limited.

Future: sample-streaming from media:
The current implementation is to load the samples into RAM, but perhaps it is possible to load only the first section and download the rest when needed. This would same switching time of programs and would alow for much bigger sample-sets.

Future: more samples played at the same time:
As the RPI3 is fast enough, why not allow more than one sample set? Even is this is limited to 4, it would be great!

Once the development is more mature, I'll share my work with you. If you have some request, I'll see if i can find time to implement.

Thanks for Samplebox as a great starting point!!!! The development seems to be stopped?

Erik posted Apr 22 '16, 06:42:

Freeverb is working! Only around 10% load when playing: Nice!
I'm struggling with 2 stereo outputs, anyone with knowledge on getting this to work? Perhaps using a 4 output USB audio interface?
2 USB audio interfaces with pyaudio do not work for me....

Sam posted Apr 22 '16, 14:47:

Hey, you added some nice features !
Could you share your work ?

Sam posted Apr 22 '16, 14:48:

Sorry, I forgot the magical word: please :)

Erik posted Apr 23 '16, 15:47:

I'll share when ready and I'm happy with the result!
I now have a problem with playing 2 stereo wav files to 2 USB audio interfaces, sometimes there is a kind of strange thing, I expect that somewhere one byte misses and this results in swapping upper and lower byte. Restarting the app and resetting the audio devices does not help. A full reboot works. Still inspecting this.
Playing Samples with reverb works great and is very stable. I expect there is an issue with PyAudio or one level deeper.

The next few weeks I do not have that much time. Hope to get everything stable in 3 weeks. Or just release without backingtracks


  (not published)
  I want to post as guest