HOW TO: Rock your samples with a Windows box

So you like to solder, play with electronics, and tinker with things, but for some reason you're not running Linux? Sad because you can't get your choice beat cuts onto your counterfeit Chinese card? Worry not, brave partier, I'm here to help you transport your sick samples into your WTPA2 so you can rock the party at will.

: Bring your gat
  • and the Windows command line program, cmd.exe, which you've got already.

I'm assuming that you've already got your aiff file edited down, at 8 bits and of a reasonable size (under512k). Need help with that too?

The Script: Pack it up, pack it in!

Make sure when you installed python that you added it to the path. Start cmd.exe to get a terminal window, type “python” (without quotes) and hit enter. If you get an error message try reinstalling python and selecting “add to path”. If you get “>>>” congrats! Hit ctl+Z and then hit enter to exit. You've got python installed.

Using the command line use cd to get to the directory you've got the packer script in ( You can use the tab key to autocomplete directories. Note that this will all be much simplier if you put all your samples together in a directory without spaces or strange characters in the name.

Run the script! Type

python pack samples.bin c:\Users\Bob\Desktop\rockmybody\orwhereveryoursamplesare

You'll see the script output tell you if everything worked or if you have samples that are too big, etc.

The Card: Voodoo Magic

First of all, know that running the wrong thing with dd can potentially overwrite your entire hard drive, which is a party killer. If you're not sure what you're running then google it or the program until you know what you're doing.

For ease of use put the dd.exe program in the same directory as the packer script. Make sure your card is inserted and Windows asks you to format it. Don't do that. Open up a command line and run

dd --list

which will give you a very esoteric list of all the partitions and storage devices in your machine. If you open the GUI “My computer” interface and see which drive letter your WTPA card is you can easily go back to the list and find it there, with whatever ancient Babylonian name it's been given. Mine is \\?\Device\HarddiskVolume6 right now, but it changes every time. This is what dd has chosen to name it, but you can see the Windows designation above it, the one that starts \\.\Volume{lotsofcrazystuff-that-is-a-paintotype}

Either one works for the next part.

The way you use the program dd is you give it a source file or disk to read from (if) and an output file or disk to write to (of). Type

dd if=c:\Users\Bob\Desktop\rockmybody\samples.bin of=\\?\Device\HarddiskVolume6 --size --progress

Change the directory to wherever you have your samples.bin file and the address of your card. To get files off just reverse the if and of arguments.


  • Thank you! Much needed info for me.
  • You're welcome! I figured there must be a way to do it in Windows. I hope you got it working.
  • ok I am doing everything right but I keep getting this rror

    "" , line 5
    SyntaxError: invalid syntax 

    what's going wrong???????

  • Download the script again. Looks like maybe you saved the github HTML page itself? Gotta click "Raw" first. Here is the script by itself:
  • Making this thread sticky.  Thanks so much @JohnRogers for the writeup!
  • @scragz   yeah I figured that out when I put the html version in a text editor ...duhhhhhhhhhhhhhh
    ....i'm a command line dufus
    anyway I got it to works so now I just have to dd the file to the SD Card 

    thanks for the help 
    glad to see this forum still has some life

    if you want the 63 files I wrote to samples.bin let me know 
  •'s a summary all in windows 10
    Grabbed 63 samples in a variety of formats, wav mp3 
    Converted them all in batch mode  to aif files,  mono (1 channel), 8 bit , 22050 sample rate ....and checked output size to be sure they were all less than 512k..I used the demo version of NCH Switch and got around demo limits by reinstalling it once, put all converted files into a folder labeled  aif

    Downloaded and installed python 2.7 at the root directory C:\python27, put aif folder in there along with  wtpa2,py. After getting the right version of the python script downloaded, yes the RAW file from GITHUB not the HTML view, It ran as smooth as the baby Jesus in velvet pants with samples.bin = 33MB

    Then downloaded dd for windows and installed at root level = C:\dd  , and moved samples.bin to that folder  I used dd-win version 0.5 because it wasn't  labeled as beta. I inserted the wtpa formatted SD card hen ran dd --list to get volume name, and then inserted that name into demo script above. I ran the script and voila, it all worked when I put the card back in the WTPA2. 

    This is  way better than building samples on the fly, I have a huge soundfile/sample  library. (120gig). 

    For my next trick I am going to test out the version of that integrates SOX file conversion in the script. i will report back on that, and put up a few examples of the fun on Soundcloud.  ROCK THE PARTAY!
  • Let me know how that works out for ya. I didn't test any of that on Windows but it should all be the same as long as sox is in your path. It's pretty easy to edit your path to have other directories so you don't have to put everything in the root of the drive:
  • Well I ran it in windows 10 on wav files and it errored out 

    I think this part of the script means it works on AIFF files only , not a show stopper but most windows files are WAV btw

    outfile is the file to be written. infiles is a list of files and 
    directories to process for AIFFs in the proper format.

    So now back to SOX script to convert them - that $17 for a Switch license for batch conversion to 8 bit mono aiff is lookin more and more attractive 

  • Oh.....yeah. That's right, it uses some python AIFF library to check some stuff before even calling sox and pre-rejects anything that isn't an AIFF. I will look into that.

    But still, eff buying some license to bulk convert your wavs. You can totally process all your wav files into aiff files if you can get a cygwin bash shell running with that command I posted in the other thread:

    `find . -name "*.wav" -exec sox {} -b 8 -r 22050 -c 1 {}.aiff \;`

    That will search the current directory and all subdirectories (find .) for wav files (-name "*.wav") and then convert them to the right format (-exec sox {} -b 8 -r 22050 -c 1 {}.aiff \;).
  • well thanks for that will try it all out , btw if you look at the NCH Switch page there is a free version not the demo on the right side, its a few less formats but includes most common input types to 8 bit mono 22050 conversion......but you're right real men use command line!

    and for the dufus in me what is  CYGWIN BASH SHELL ???

    and thanks for all the help too, I just ordered some more SD cards so I can swith libraries instead of repaking the one SD card I have 

  • Cygwin is a bundle of programs and DLLs to get a minimal UNIX/Linux type environment on Windows. One of them is Bash, one of the more popular shells, which is way easier and more powerful to use than CMD.exe. Install Cygwin (use the instructions here and make it install sox). Once it is installed you can open up a shell, the prompt will be a $. The cd command will change directories, so use that to go to the root of where your wavs are (cygwin paths are a little funky, if they are located C:\samples, that is going to be /cygdrive/c/samples). Then paste that whole command and it will run, converting all your wavs.

    $ cd /c/cygdrive/samples/test-convert
    $ find . -name "*.wav" -exec sox {} -b 8 -r 22050 -c 1 {}.aiff \;

    That's it. If you want to learn more commandline, you should really get Cygwin going. Plus all the Bash you learn will directly translate to OSX and Linux.
  • I always thought of Cygwin as the gateway drug to a full Linux install.  That's what it was for me, anyway, lo all those years ago.  +1 for Cygwin.

    Also I will feel a warm fuzzy if a small non-zero number of people in the world fuss with Bash and the command line as a result of this goofy sampler.
  • edited February 2016
    hi everybody,

    i followed all the instructions that scragz wrote -  but now i´m stuck at packing the samples:

    i tried different variations of files but the "windows command line" alway shows the following text:

    C:\Users\user> python pack samples.bin c:\users\user\desktop\samples
    Traceback (most recent call last):
      File "", line 265, in <module>
        wtpa.pack(args.outfile, args.infiles)
      File "", line 29, in pack
        self.header[0:3] = "WTPA"
    TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)

    the test file is mono, 8-bit, 22.050 khz and has a size of 388 kb...
    any ideas what i did wrong?
  • I don't think you did anything wrong.  It looks like the script is barfing when trying to write the "WTPA" header because it thinks it is a string instead of ASCII bytes.
    Odd that this would work sometimes and not always or never.
    Are you using the @scragz version of this script?

  • yes, im using the file he provided at github...
    should i try your files?

  • You could give them a shot just to see.
  • That part is unmodified in my script.

    What does `python --version` say? I've only really tested it with 2.7.6.
  • Yeah, I figured.  Checking the version is a good idea.

  • i'm using python  2.7 scrags update and its loading 128+ samples into sample\s.bin just fine 

  • ps
     thats on windows 10
  • edited February 2016
    ... i tried python version 2.7.
    and it worked perfectly!
    right now i´m having a lot fun with my nice samples ... yessssss

    thanks a lot
  • well post a few tracks here, this forum needs some oxygen!

  • I went ahead and ported it to Python 3 so future generations won't have this problem:
  • @scragz -- Good man.  Thanks so much!
Sign In or Register to comment.