Emulation on a PC

Don posted Jun 9 '15, 03:12:


Is there any way to play with your code without building a hardware samplerbox first?

Maybe on a Windows or a Linux PC?


joseph posted Jun 9 '15, 09:11:

Yes, you can test it on a Raspberry Pi without any SamplerBox hardware.
The Samplerbox hardware only adds buttons, 7-segment display, MIDI in via serial, and input/output connectors at the rear of the enclosure.
But you can test the code without this hardware.

And yes, you can also use it on a PC Windows / Linux. It's not documented yet, but you can install https://github.com/josephernest/SamplerBox on a PC.
You just need a little experience with Python in order to install the missing Python modules that are required for SamplerBox.

Have a try and tell me how it works.

remi posted Jun 9 '15, 15:41:

The dependencies are a bit hard to install, so i made a portable version with all the libraries.

Here is the link:


  • Install python 2.7

  • Extract portableSamplerBox anywhere on your computer

  • Launch getaudioid.bat
    It will display your audio id, get the one you want.

  • Modify samplerBox\samplerBox\samplerbox.py
    AUDIO_DEVICE_ID = 3 with your audio ID

  • Launch samplerBox.bat

  • All the samples must be put inside media (you can modify this inside samplerbox.py)
joseph posted Jun 9 '15, 17:32:

Waw Remi, this is very cool!

A few remarks:

  • Your portable version already includes Python, so no need to install install Python before, is it correct?

  • In samplerBox\samplerBox\samplerbox.py, you have set AUDIO_DEVICE_ID = 7, maybe you should set = 0 as a default value when someone opens your package?

  • It could be cool to add a pause as last line of getaudioid.bat so that we can read the devices before the window is closed

Nice idea!

remi posted Jun 12 '15, 15:06:
  • You still need to have python installed as it needs a DLL (Python27.dll)

  • Oups ^^ I forgot about AUDIO_DEVICE_ID

  • I tried to remove most part of python (erasing at random but I realized it broke pip)

I will remake a new version (and add instructions on how to do it on your own) since using samplerBox on windows is really neat !

  • This is an awesome ways to teach music with just midi controller inside a computer room.
  • I love the idea to have a synth at my disposal where you just need to have a usb key, and any computer around to jam!
  • It is easier to make samples since you can save it, change program (to reload the samples) to test them.
  • The fact that all you can do with your computer will works on a embedded device really remind me of old school sampler (that I couldn't afford)
Tim posted Jan 17 '16, 20:26:

Thanks for this - I'm testing some things out before building an actual box. Few questions:

  1. How do you change patches without having buttons? I've been just exiting the software, renaming the one I want to be #0, and restarting. Is there anyway to change?

  2. Any limits on file size or length? I was playing around a put a wav file in that was about 5 megs and 20 seconds long. It just gives the first second or so when I trigger it.

I'm not using a keyboard; I'm using a drum pad since that's the application I'd be using it. I'm a drummer and play an acoustic set with a small electronic pad that has build in sounds. But that pad has both usb and midi outputs so I'm considering a samplerbox to expand the sound options I have.


Mojca posted Aug 30 '17, 11:36:

I tried to run your code on a Mac (I have MacPorts installed and created the missing packages for dependencies), but I experienced one tiny problem.

The part with

sounddevice.OutputStream(device=AUDIO_DEVICE_ID, ...)

doesn't seem to work or at least I don't know how to define AUDIO_DEVICE_ID (If I set it to None, then the part which prints the number complains). If I remove that part, everything starts working. It took me a while to test individual parts to try to diagnose why I wasn't getting any sound.

It might be nice to package samplerbox, so that 'port install samplerbox' would work out of the box, but I'm not sure about the best way to handle the configuration.


  (not published)
  I want to post as guest