clockworkpi

Midi controller / USB / synth / speaker?

Any luck anyone?
Tried installing
http://www.samplerbox.org/home

Plugged the USB with a midi controller and scratching my head…

That should work, or should I say, it should be super easy if there is no driver for it, tu support USB MIDI devices. Linux (the kernel) have that in its set of drivers, so you will jsut need some software to support it (like SunVox or any other trackers, but would need a tracker that can be used using a D pad and some other buttons :D)

Sunvox layout is too big for 320x240, wouldn’t work, it was very messy, have you gotten yours yet? Hope we can figure something cool here :wink:

Bumping this thread up and hope that there are some other new owners interested in making this work!

Also tried my luck and flashed the .img of samplerbox on an SD. The Clockwork runs, but no sound so far/no visuals. Been trying it with an OTG Cable connecting to an Akai MPK Mini 2.

Somebody got an idea what to do?

I see that this is not really active topic, but it’s the only one on this forum that mentions SamplerBox, so I’ll bump it :slight_smile:

It took me by surprise to find SamplerBox preinstalled in the OS and that it’s not mentioned anywhere in the UI. I was using SamplerBox on Raspberry Pi before, so I tried to test it on CPI and it kind of works. After connecting midi controller, I ssh’d to the CPI and tried running python /opt/SamplerBox/samplerbox.py and at first it was working, but after trying it again there was no sound. Turns out that if you cd into the SamplerBox folder and run sudo python setup.py build_ext --inplace each time before running SB the sound will work. But after trying to switch the preset (I added some preset from SB website) the sound disappears again.

I also tried to add it to the menu with .sh file with python /opt/SamplerBox/samplerbox.py in it, but it didn’t really work as after running it I was stuck with “loading” image and no way to cancel it. Is there a way to run something like this from the menu in verbose mode?

1 Like

It’s funny. I was just looking at this yesterday, cleaning up stray config files etc throughout the system.
The only reference made official was here:emphasized text

What if you copy it to the /user/local/bin location, then running an .sh script referencing it from within a directory containing all your presets etc? That should change the effective running folder.

What exactly do you suggest copying to bin? I assume you are not talking about python script?

Yeah, something along these lines:

source

1 Like

I guess I’ll give it a try, but I’m a little concerned that samplerbox consists of 3 python files, wouldn’t it break it if I copy only samplerbox.py to bin?

1 Like

Try this possibly.

source

1 Like

Thanks. I’ll give it a try this weekend

1 Like

After some trial, error and putting files into /usr/local/bin I found quite simple solution. All you need to do is just add a line os.chdir(os.path.dirname(sys.argv[0])) after all the imports into samplerbox.py. This way you can leave the script in opt folder and run it from wherever you wish, and .sh file with python /opt/SamplerBox/samplerbox.py works fine from the menu.

The only thing is it stays on “loading” screen if ran from the menu, and you can’t close it by pushing menu button. I’ve tried adding some code to address the menu button, but it didn’t seem to help, so I’ll need to investigate some more, then I’ll probably will post the solution here. And any ideas on how to hide “loading” screen? It would be nice to see the command line feedback from the script while it’s running

1 Like

Fantastic! Yeah, that is definitely a much easier solution, and much more relevant given you’re working with python! Nice work finding that!

Ugh, the dreaded loading screen. I’ve got a similar problem using scummvm, requiring the use of the F5 key to exit/access the system menu. Not easy to do via the gameshell. One solution I’ve been looking at is “xbindkeys” and making a “rage quit kill key combo”, pushing ABXY+SEL+START at the same time; kinda the same as what you could do to soft reset the original Game Boy, mapping it to the magic alt+sysrq key.
If you find a more eloquent solution however, I would love to hear it.

For reference, here are the outputs according to xbindkey

Key code. name. snes mapping

c:111 Up up
c:116 Down down
c:113 Left left
c:114 Right right

c:45 k a (east)
c:44 j b (south)
c:31 i x (north)
c:30 u y (west)

c:46 l shift+a (east) or R2 (outer LK5)
c:43 h shift+b (south) or L2 (outer LK1)
c:32 o shift+x (north) or R1 (inner LK4)
c:29 y shift+y (west) or L1 (inner LK2)

c:65 space select
c:36 Return start
c:9 Escape menu

c:82 KP_Subtract shift+sel
c:86 KP_Add shift+start
c:22 Backspace shift+menu

c:112 Prior shift+L1 (inner LK2)
c:117 Next shift+R1 (inner LK4)
c:110 Home shift+L2 (outer LK1)
c:115 End shift+R2 (outer LK5)

nul nul shift (centre LK3)

I also just found this

1 Like

Found a way to get rid of loading screen in my case… It’s quite logical to run the script in the terminal, so I changed my .sh file to xterm -e python /opt/SamplerBox/samplerbox.py. Now I can see the output of the script. The only thing left is to find a way to close the xterm using menu button. This rage quit combo might work, but I still hope to find a way to use menu button

If you make a profile that loads up upon executing your script, you could probably have it bind the menu key to whatever key combo you use to exit. Or the magic key.
(And of course kill the process upon execution)

1 Like

I was trying to bind Esc to exit in .sh file, but it didn’t work for some reason. could you please tell what kind of profile are you talking about so I can investigate how it can be done?

I also was thinking about adding handling of Esc in python script, but I think it would be cool to not change the script that much

Not a strict profile per se, but rather just a .xbindkeysrc file mapping the command required. If it’s not something included in the .xinitrc startup, it shouldn’t load with startup, making the menu key still functional.
Just to make things return to normal, include this at the end of the definition, killing xbindkeys:

1. use this command to reset the keyboard shortcuts to default 

xbindkeys --defaults > ~/.xbindkeysrc

2. Then kill the  `xbindkeys`  daemon process with the command:

killall xbindkeys

source

The question is, is there a keystroke to exit, if using a full sized QWERTY keyboard?

1 Like

thanks! I’ll try this as soon as I have some time

1 Like

and I finally got it to work :slight_smile:
my .sh file now looks like this:

#!/bin/bash

xbindkeys -f ~/.bindsamplerbox 
xterm -e python /opt/SamplerBox/samplerbox.py 

and this .bindsamplerbox is like this

"killall xterm"
Escape

I know it’s not the most elegant solution, but it works. I also didn’t bother resetting the binding yet, might just add && killall xbindkeys to the binding itself if I’ll have any issues

2 Likes

Nice work! Seems elegant to me. :slight_smile: This should almost be considered the official way to get samplerbox running on 0.5.
I guess it could be more problematic to kill all xbindkeys if say, you’re using it for anything else. Chances are, if you’re using xterm you run anything else, you’d want a kill switch too.

1 Like