Dom posted Oct 13, 09:25:
Hi @ all!
First off, I'm a RasPI/Linus noob just trying to get startet with this amazing project (thanks to Joseph!!).
Currently I'm trying to get the setup to work (trying out the samplerbox2). But other than most people on here (as it seems) I want to use the SB for eDrums. Which is rather straight forward, but it makes me wonder how the HiHat Controller is supposed to work.
My guess: Use Layering for different HH openings. And instead of mapping the sounds to Velocity, link them to the state of the HH pedal. Does this make sense?
All help is greatly appreciated!
AlexM posted Oct 15, 03:34:
I've been thinking about SB for eDrums lately as an alternative to something like Roland's SPD-SX (since my drummer's one died recently). I plan to sink my teeth into this world some time too!
You could create a hhstate variable that determines which samples get played. A bit of pythoning is required. I did something similar to implement voices (sample sets within presets, all samples loaded at start) which I posted about a couple of weeks ago here. In the definition.txt you might use this new hhstate to determine which samples are used in which state. The ActuallyLoad() function then figures it out.
Dom posted Oct 17, 11:29:
Yeah! That's pretty much what I was thinking. I read your forum thread... very interesting.
So far I'm still trying to get Sound out of the RasPi, but I hope I can give an update soon.
I, too , came to this Forum by trying to find a better way for drum sampling than SPD-SX or Yamaha M12... I'd totally LOVE to use the SB live. Also the possibility to expand it's functionalities is so thrilling. Love the Project!
Dom posted Oct 17, 11:39:
Also another thought: If SB needs Note ON / Note OFF signals... how does this work for drums? Because basically every note needs to play in full length (cymbal choke seems a bit overkill). Since drum sounds are short anyway, I don't think it will mess up the polyphony. But how would I set it up? Replace the sustain function? Or ignore sustain and work around it?
HansEhv posted Oct 17, 23:29:
Well, you may be able to control the length of time before note-off is sent from a drumkit with a "gatetime" parameter (my kit can).
You can also use the "Once" mode in my alternative/extended implementation, which can ignore note-off signals and thus play samples at full length. Or write your own equivalent ofcourse.
You can find it on this forum and at http://homspace.xs4all.nl/homspace/samplerbox
By the way, this implementation has some same improvements as Samplerbox2. It does not have the freeverb implementation or the backtrack/clicktrack feature, but has some other things instead. Erik and I had different usage for our boxes :-)
Dom posted Oct 18, 12:35:
Wow Thanks Hans!
I have honestly not noticed your build so far. But it seems it fits my needs even better (the mode selection and the Hardware Switches seem very interesting).
I'll give it a clean install tonight and see if it works out my other problems, too.
Thanks for sharing!
-> Concerning the Sustain: the "Once" mode seems to be the better solution (over gatetime) since i don't Need to set a certain timer or anything. And essentially it will be the same work load for the CPU, so it seems the better Option. Correct?
AlexM posted Oct 18, 13:48:
Hans, I've been thinking about how to implement your global keywords (such as %%mode, %%velmode, %%release, %%gain, %%transpose) at a sample level. I see this being of use to both Dom and myself here - perhaps there are samples that need to be in "once" mode, and others in "keyb" mode. For instance, playing a rhodes in keyb mode and triggering samples in once mode on my Launchkey's pads. Would following my logic in previously achieving voices be the best way? How would you go about it?
Dom posted Oct 18, 18:53:
@ Hans: Does your Build work with the Pi3?
HansEhv posted Oct 18, 22:14:
Implementing those globals on sample level seems another logic, you move from the "setup at midi trigger time" to "control during playback". Similar: the voices implementation also does not play different voices at the same time, it can switch from one voice set to another.
For using a different set of globals for a padblock next to a keyboard, I would go for some sort of "split keyboard" setup instead and use unusual notes (below or above the normal playable ones) for the pad. Mind that the mode parameter is also used when checking the wav's for loopmarkers.
On the other hand, making a split keyboard will break the modes that simulate a note-of on note+64.
It's an interesting question though, wish I had more fee time to spare...
For Pi-3: My build is not a real build/image, but rather a replacement of some scripts plus some extra libraries over an existing build (I use the original one). It will work on most other builds I guess. If I'm not mistaking, the crucial difference of the Pi-3 build is in startupfiles in the bootdirectory, which are untouched by my modifications. But never tried, have no Pi-3 yet...
Dom posted Oct 18, 22:18:
Allright. So I gave it a try. Changing the /etc/fstab was brilliant, since I'm loading the samples from USB. It made the original Image & samplerbox.py work.
But then I replaced the samplerbox_audio.* and samplerbox.py and I got a whole list of ALSA errors. ("systemctl status samplerbox" yields a green "running" message, but no sound upon keystrokes. no matter if onboard sound or external USB DAC)
I had them before, but this time it worked just fine with the orinial ISO and then stopped after replacing the mentioned files.
I colesly followed you instructions on your website.
A little help would be greatly appreciated.
HansEhv posted Oct 18, 22:46:
Reading your message four things spring to mind as candidates for checking:
The local config is what it is: it defines your local environment. Please check the AUDIO_DEVICE_ID and AUDIO_DEVICE_OUT values. They might be different from your original/working ones.
The fstab is always source of nuisance with usb-sticks. Sometime it's "/dev/sda ", sometimes it's "/dev/sda1 " (depending on presence of an MBR on the stick). But I understand it worked for you.
The script also needs an extra library. It's described on the website: "For volume control I've used python-alsaaudio. Just download the package, upload the contained folder structure in the /root directory (next to pyaudio, rtmidi-python and SampleBox) and run "python setup.py install" in the new pyalsaaudio directory."
The website contains the proper links.
Last but not least: the implementation of the LCD heavily depends on how you wired it. This does not affect sound, but may damage your LCD.
For the first two remarks, the testdev script can help in giving information. Ofcourse you can use the mentioned commands directly from commandline.
Hope this helps...
AlexM posted Oct 19, 02:58:
@Hans Yeah I'd be wary of breaking modes. Would probably be using low notes for pads (eg 1-16) - although I have some ideas around this. I'll see what I can come up with and share.
Dom posted Oct 19, 08:32:
Thank you som uch for your effort! I really appreciate it!
In response to your Points:
1.: I set them to both AUDIO_DEVICE_ID = 2 (USB DAC) and "USB Audio DAC"
and also: AUDIO_DEVICE_ID = 0 (Internal Sound) ans "PCM" to no avail
2.: Yeah. As you mentioned it worked beautifully so no Problems here!
3.: I installed pyalsaaudio. I installed it from USB though... maybe that was a mistake. I'll retry this
4.: LCD is not an issue. With the wiring diagram, it's no Problem to get it working. (Also: very nice that you made the LCD-Pins compatible with the original MIDI-wiring. Eriks SB2 uses some same Pins, which makes it hard for a Linux/python noob to get LCD and MIDI working simultaniously)
Thanks again! I'll try to reinstall the pyalsaaudio from Root insted of USB and hope that this cancels the errors
HansEhv posted Oct 19, 08:55:
I missed something.
Joseph mentions in his Blog that he replaced the PortAudio wrapper from pyaudio to python-sounddevice when making th Pi3 image (he gives links to that). If he removed the old software, there is a compatibility issue.
Perhaps it's just the import statement, I thought sounddevice claims to be a transparant improvement. I will look into that this evening - if you're not ahead of me.
HansEhv posted Oct 19, 22:42:
Talked too fast this morning and mixed up python-sounddevice with another package :-(
It is NOT transparant to change from pyaudio to python-sounddevice.
Joseph made several changes to samplerbox.py file for this, which are difficult to apply on my file as it contains changes in the same areas.
You can find his work at https://github.com/josephernest/SamplerBox/tree/testing
So, if the pyaudio folder is missing in the root (meaning Joseph did remove the old stuff), next options remain:
- reinstall pyaudio in a similar way as you did for pyalsaaudio (copy the folder and do a setup) on this non-working version. I've put the originals here: http://homspace.xs4all.nl/homspace/samplerbox/pyaudio.zip
- go back to the Pi2 image and apply the two files as described by Erik (manual page 5) on http://www.nickyspride.nl/sb2/ to make it run on Pi3 and apply my stuff again.
- wait for me, as using sounddevice is on my wishlist too. But that may take (too) long...
In first two options you won't get the improvements from both tracks, the third won't give a result for a long time. It's up to you, you can have another option I didn't mention :-)
HansEhv posted Oct 19, 22:45:
.. and to be complete: having alsa errors is normal, it spitsa lot of warnings when starting. As long as you get sound in the end, it's ok :-)
Dom posted Oct 20, 12:35:
Wow! Thank you so much Hans! I really don't know if I can do all this by myself... as I said: total n00b
But if I understand correctly: If I use a Pi1 or 2, the old ISO from Joseph and your improvements, it should work, right?
(Since the whole Pi3-ISO removed Pyaudio issues wouldn't be aproblem then)
HansEhv posted Oct 20, 16:59:
Correct, be it that Pi1 is too slow. So Pi2 remains.
Dom posted Oct 20, 20:11:
Allright.... so I tried my best. To no avail. But anyway, here's what I did:
1.: Reinstalled PyAlsaAudio thsi time from Root
2.: Since in my /Root/ there's only one folder (SamplerBox), I reinstalled Pyaudio (from the link you provided) and Python-RTMidi. Neither did anything
3.: Replaced your samplerbox.py with josephs original
So all this didn't work. I'll also try installing the PI2 Iso and modify it with Eriks files (fixup.dat and start.elf, right?)
One thing that makes me wonder: Everything worked fine with the original PI3 Iso and original samplerbox.py (from the NEW ISO RELEASED thread). And as soon as I replaced the python_audio.* files, the was no more sound. So the issue is definitely related to those 3 files.
(Possibly this was a very dumb/obvious statement, but I'm just sharing everything I've found out so far. Sorry for my lack of experience)
Dom posted Oct 21, 12:43:
And one more thing:
Does the PI2 ISO only need Erik's two files to work on PI3? In other words: if i install the PI2 Image on the Pi3 and replace those 2 files, but still use Joseph's original samplerbox.py, it's supposed to work?
(I need small Milestones to narrow down the possible error sources)
HansEhv posted Oct 21, 17:03:
Yes, that's what Erik did. I have no Pi3, so I can't verify.
I plan to get Joseph's new image to run on my Pi2 to see what went wrong with your attempt above to load my mods and see whether that can be fixed. You never know :-)
Thanks for the details of your tests!
Dom posted Oct 22, 16:16:
Allright, so I gave it another try:
1.: Reinstalled the original Pi1/2 ISO. Patched with Eriks Fixup.DAT and sart.ELF
Tried: no sound (no matter what setting I used in the \etc\fstab)
2.: So just to make sure, I installed the PI3 ISO. And it worked. To make sure the samples were loaded from USB and not just from the built-in failsafe SAW sample, I replaced the SAW-Samples with Piano samples on the USB. Worked. Piano through onboard sound as well as USB DAC. But no velocity differences (volume-wise).
3.: So I replaced the three samplerbox_audio. files with the ones from your home page. No sound anymore and also some errors pointing to the samplerboy_ausio. files.
4.: So I replaced the original samplerbox.py with yours (and installed pyalsaaudio). No more samplerbox_audio.* errors but still no sound. And the old alsa errors from earlier tries.
Another thing I have found: the \etc\fstab configuration is subject to change. it's trial and error. But that'S fine by me
HansEhv posted Oct 23, 01:22:
I finally got it working with the new image from Joseph (in order to leave history behind and have Pi3 compatibility). Roughly I did the following:
- Adapted my script to work with sounddevice instead of pyaudio.
- Rebuilt adapted samplerbox_audio files for the accurate velocity control (I think it could have worked with the original files from Erik too, but did not test that anymore)
- Split the audio device id into one to be used by sounddevice plus one for the alsamixer
The last thing was what kept it quiet whilst software being already ok. With previous software this was always the same and now it does not have to be. The nasty part is that sounddevice will accept a wrong number but wil not make sounds then, and the mixer will exit the script if it gets wrong information....
If you issue "python -m sounddevice", you can see the number you have to use for your device. In the info of that device you'll see (hw:x,y), where x is the alsamixer id.
As making my build from the original is somewhat complicated, I'm considering making an iso available next to the actual adaptations plus instructions.
Remaining issue is that the working script also contains quite some new features I'm still working on. These are not all tested completely and surely not documented yet.
Therefor I am reluctant to publish this yet. But I appreciate your efforts and info, so please contact me directly via my site if you want to get in the danger zone of using a beta.
fstab depends on the config of your USB-stick(s). Issue "lsblk" to see if the sda device contains sda1. If it does, you have to use sda1. So I use just one stick for the samples :-)
Dom posted Oct 28, 09:16:
Thank you so much! I'd love to dive into your new build. Unfortunately I don't have the time at the moment, but I'll come back to your offer in a week or so.