Change default sound?

E
Eric posted Apr 4 '17, 23:44:

Hi guys, I recently installed SamplerBox onto a Pi 2 I had lying around, and it works great! Except my MIDI keyboard doesn't have program change buttons (That I can figure out), and I want to load something other than the default Saw. I loaded up a USB stick with the mellotron instrument, and formatted the USB correctly, but I can't figure out how to make the samplerbox not default to the saw sound.

Any advice?
Thanks!

A
AlexM posted Apr 5 '17, 02:43:

Hi Eric,

You can try a solution I provided here: http://www.samplerbox.org/forum/258 where you can use the sustain pedal to advance presets. You could also use 2 keyboard notes to act as program change buttons - perhaps the highest or lowest 2.

[copied from other thread] Open your samplerbox.py in a simple text editor and find this section:

    elif (messagetype == 11) and (note == 64) and (velocity < 64):  # sustain pedal off
        for n in sustainplayingnotes:
            n.fadeout(50)
        sustainplayingnotes = []
        sustain = False

    elif (messagetype == 11) and (note == 64) and (velocity >= 64):  # sustain pedal on
        sustain = True

Replace it all with:

    elif (messagetype == 11) and (note == 64) and (velocity >= 64):  # LPK25 sustain button pushed
        if preset < 10:
            preset += 1
        else:
            preset = 0
        print 'Program change [%d]' % preset
        LoadSamples()

For keyboard notes you would change messagetype == 11 to messagetype == 9, change the note to your desired note, and remove and (velocity >= 64)

E
Eric posted Apr 5 '17, 03:25:

I am unable to open samplerbox.pyas it doesn't show up when I connect my microSD card to my computer. Am I supposed to edit it within the pi?

H
Hugh posted Apr 5 '17, 20:09:

If you're running the samplerbox program on raspbian lite, you can set up SSH into the pi over the network (https://www.raspberrypi.org/documentation/remote-access/ssh/)

Or what I did was attach a keyboard and monitor to the pi and do:
sudo nano /SamplerBox/samplerbox.py

If you're running the samplerbox iso then you'll have to do a
mount -o remount,rw /
before you edit that file. Then ctrl + o to save and ctrl + x to exit.

If anyone else knows a better way to edit the system file from mounting the micro SD, that would be super helpful advice for me too.

E
Eric posted Apr 5 '17, 20:17:

Ahhh, OK-- I will try that. Is there a way to just replace the "0 saw" folder (I can see it through connecting the pi to a monitor and looking thru command line) with just any instrument? I'm looking to eliminate the need to switch samples at all, as I'm trying to use a home made MIDI controller that doesn't have any of these buttons.

If I do the "mount -o remount,rw /", will that give me read/write powers to just copy over a sample folder from my USB and have it replace the default "0 saw"?

H
Hugh posted Apr 5 '17, 21:04:

Yeah well if you want something to load as the default instead just call it "0 your_instrument_name" and maybe either delete "0 saw" or rename it to "1 saw"

The remount thing just allows you to make any changes to the files in SamplerBox when loaded as an ISO - for example if you downloaded the recommended software (http://www.samplerbox.org/makeitsoftware) and it'll tell you that you need to do that when you boot in too.

It won't make the transfer any easier exactly, but if you hook up a usb drive with the "0 your_instrument_name" file on there it will load that from the drive instantly.

If you do hook up a USB drive, it should actually be possible to copy it to the rasp pi using "cp" in terminal which works like this:
cp source destination

Looks like you have to mount the USB drive manually or something to access it... I'm not sure...
https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=48958

I'll let you know if I have any progress here too.

E
Eric posted Apr 5 '17, 21:11:

Ahh, I've been having some issues on that front--

I have a file on my USB called "0 Flute" (the mellotron flute the website links to)

I've tried a few ways to do this--

cp "0 Flute" root@samplerbox~/SamplerBox/ (I THINK that's the correct path??)

gives me an error "omitting directory '0 flute'"

I looked into it, and adding the -r argument is supposed to force a directory move, but it gives me an invalid argument error.

I also don't seem to have sudo?

I tried moving the file using the mv command, but it kept throwing me the error "cannot move to a subdirectory of itself"

H
Hugh posted Apr 5 '17, 22:06:

Oh right I think sudo is not a thing in that version, so by doing the remount you don't have to type sudo at all.

Should be something more like 0\ Flute (with a backslash denoting a space following it)
But that's if you've already navigated to where that folder is in the USB drive.

E
Eric posted Apr 5 '17, 22:12:

I can navigate to the folder in the USB fine-- I just get errors when I try to copy the file to the microSD card (it insists the path to where the 0 saw folder is is invalid), which from what I can tell is "root@samplerbox:~/SamplerBox/", but it always tells me its wrong

E
Eric posted Apr 6 '17, 02:59:

UPDATE: I ended up being able to replace the default saw with the flute, renamed it "0 Flute", and put it in the proper place on the microSD. No sound. Tried renaming it "0 Saw" and same thing, no sound. :(

E
Eric posted Apr 6 '17, 03:31:

I was able to get the original saw sound back by reimaging my SD card, but it looks like you can't "trick" the image to use something else by default, even if you change the name to start with a 0, (or to have the exact name "0 Saw").... as far as I can tell.

My MIDI keyboard has a "prog change" button, but I can't figure out how to use it! If I hold it down, and then press the buttons that correspond to "prog 1" and so on, it just cuts all sound, so it must be changing it to a program that doesn't exist, or something.

H
Hugh posted Apr 6 '17, 13:56:

I think I got as far as you did too. Ultimately I ended up installing Raspbian Lite and running the python script off of there. At least this way I have the ability to connect it to the network, and ssh access to it, as well as ftp'ing my files remotely to the Pi (https://www.raspberrypi.org/documentation/remote-access/ssh/sftp.md)

Yeah it'll go quiet if there's no program that starts with "1 InstrumentName" because it'll try to load it and then tell you it can't be loaded. If you stick a monitor on your pi you should see these errors.

I would say that if you're just trying to load samples then go with the USB stick route. Sorry I'm not a MIDI expert here so hopefully someone answers that question...

E
Eric posted Apr 9 '17, 17:25:

Hmm. I tried just putting in a USB with a "1 Flute" and it just defaulted to the saw no matter what I tried. Is there a USB requirement? I thought it defaulted to saw no matter what, but if you're saying it should default to the 1 instrument, maybe my USB just isn't working. Will try again tonight!

J
John posted Apr 11 '17, 21:15:

"1 Flute" ??? to use as the default use "0 Flute" This works with the 2nd SD card. I'm working to move to the RBPi "Zero W" so I will play with moving to one SD card.

E
Eric posted Apr 12 '17, 01:46:

I've tried both "1 Flute" and "0 Flute" with an external USB drive to try to load samples and both times it just defaults to the saw. I've tried replacing the saw on the microSD with "1 flute", "0 flute", and "0 saw" (but with the flute files) and no matter what I do I can't make it call anything except for the saw

J
John posted Apr 12 '17, 06:01:

@Eric
SSH into your pi,
then look at your media with these commands

root@samplerbox:~# cd /media
root@samplerbox:/media# ls

You should see your folder 0 Flute
if so

root@samplerbox:/media# cd '0 Flute'
root@samplerbox:/media/0 Flute# ls

you should see all the files
is definition.txt in there?
if so

root@samplerbox:/media/0 Flute# cd
root@samplerbox:~# systemctl stop samplerbox
root@samplerbox:~# python SamplerBox/samplerbox.py

The output should look like
Opened audio device #2
Opened MIDI: UMX 490 20:0
Preset loading: 0 (0 Flute)
Preset loaded: 0

Let me know

E
Eric posted Apr 24 '17, 01:14:

Hi there, I am unable to SSH in as the password "root" does not allow me access when SSHing (but it does when i just connect it to a screen). I attempted to do this process with it connected to a screen and a keyboard and it loaded 0 flute, but didnt have any sound no matter what I did.

A
AlexM posted Apr 24 '17, 04:36:

@Eric, did you try what @John suggested? ls /media/0\ Flute - lists all files in the 0 Flute directory. Let's just double check you do have wav files in there.

Does the Saw sample-set still work? You'll need to rename it to 1 Saw since Flute is now 0 for you.

Another thing to try is testing whether your MIDI keyboard is in fact working with SamplerBox. With your monitor and computer keyboard connected, log in and remount as read-write mount -o remount,rw /. Edit your samplerbox.py using the nano editor: nano SamplerBox/samplerbox.py

Find this section:

def MidiCallback(message, time_stamp):
    global playingnotes, sustain, sustainplayingnotes
    global preset
    messagetype = message[0] >> 4
    messagechannel = (message[0] & 15) + 1

Add the new line below:

def MidiCallback(message, time_stamp):
    global playingnotes, sustain, sustainplayingnotes
    global preset
    print message # <<< NEW LINE
    messagetype = message[0] >> 4
    messagechannel = (message[0] & 15) + 1

CTRL-X to exit, Y to save, and reboot to reboot. This line should help us determine whether your MIDI keyboard is working or not. Your 0 Flute sample-set may have been fine all along!

E
Eric posted Apr 25 '17, 06:16:

Yup, I did everything John suggested on a monitor attached to the pi as I was not able to SSH in. It loads the flute patch (which has both definition.txt and wav files in it) but doesn't play any sound. Unfortunately I think it isn't the MIDI keyboard, as the saw sample set works just fine with it, I just can't seem to load anything else (in fact, when a monitor and keyboard are connected, I get no sound at all, but when they aren't I get defaulted to the saw sound)

A
AlexM posted Apr 25 '17, 07:15:

Have you tried any other instruments? eg any of the ones here: http://www.samplerbox.org/instruments

O
opus.quatre posted May 2 '17, 17:19:

Any instrument should boot on a mellotron sound.. even a whistle should..
I know my comment doesn't help much, I know..

...

  (not published)
  I want to post as guest
 

Post