Little Raspberry Pi project

Hi guys,


I’ve had a bit of a creativity slump in the last couple of weeks, so I tried to turn it into an “opportunity” to do something I’ve been meaning to start for a while. I mentioned it in one of the threads on the old forum I think… anyway, here’s the idea:

The end goal is to be able to plug in a Raspberry Pi into the Op-1 via USB (like you would with a computer) and to be able to use a program to split a stereo file on album into two mono files on the tape tracks. Ie, a portable and hopefully easy-to-use alternative to faffing around on the computer and doing a bunch of manual steps. I have no idea yet how you would specify which album file you want to split and which tape tracks you’d like them to be dumped to, but I guess I’ll aim for something simple and stupid to start with and let it evolve into something slightly more sophisticated as I go on.

As I’m a Java developer in my day job, I thought I’d just write it in Java, since I’d be able to get up and running quicker and you can run Java on the Raspberry Pi. To start with, I’ve been writing some code that will help me read and write aiff files. You’d think there’d already be a million such libraries in Java, eg, AiffFileReader that comes in Java itself, but it didn’t seem to be able to read the aiff files that the op-1 spits out. However, writing this code has helped me understand lots about the insides of an aiff file (based on Interchange File Format) and could (eventually) provide a base for any application that wants to tinker with the op-1 specifics inside its aiff files. Eg, two other ideas might be:

- Take a drum kit that has been made on the op-1 and split it into separate files based on the loop start and end points. (I think somebody asked whether this was possible recently).

- Take a long list of samples and convert them into Op-1 drum kits (a la Drum Utility) and have the program work out the best way to split them across drum kits efficiently.

Anyways, just thought I’d let people know. I put the code that I’ve written so far into Github. Any Java devs out there, feel free to have a peek and shame me for my rather poor test coverage :wink:

GitHub - operator1/op1: Utilities for working with files from the op-1 synthesizer.

that old thread of yours got me interested in rapsberry in the first place and now again you hit again . needless to say i am following (i dont have a pi yet ) but i need something like this to make it A practical TOOL for me as i am unexpertised in any fille code () but portabillity, additional OP-1 territories and leaving computers off is "music to my ears " .go go go but please keep your process info as simple as possible

Cheers @thor. I hear you… unless the process is simple, it’s not going to be very useful. Perhaps as a very dumb prototype, I can just have a program running on the Pi that detects when you’ve connected the op-1 and entered disk mode, grabs both album files, splits the audio of each album file into mono files, dumps the results across all four tape tracks and emits a beep to suggest completion so that you can go back to tape mode…

For anybody who’s interested, I’ve started documenting what I’ve found out about the Application Chunk of Op-1 Drum Kits:


https://github.com/operator1/op1/wiki/Op-1-Application-Chunk-format

Nice work @yoof I will keep an eye on developments as my coding chops are limited to basic stuff, so I am not able to contribute anything.

Side note - I’d pay a reasonable price for software that backs up/restores the whole OP-1 at a button push, the raspi is easy enough to make super portable, it would be great if the linux does not have to be installed, so that it is almost instant on, backup, done.

Looks like you can use Shell scripting with something like SoX: http://sox.sourceforge.net/sox.html

In the remix section, it describes how to take a stereo file and split it into individual mono recordings. If you can navigate and use the command line in Linux, this wouldn’t be too difficult to code up. Let me know if you need any help, and I can start some script.

Cheers guys.

@darenager, suggestion noted. When I get to integrating my code with the raspi, I’ll have a go at that. It doesn’t sound too tricky. Do I remember somebody having done that before though? I think it might have been called the “op-1 backup thingamejig” or something… I’ll have a search when I’m at a computer.

@GCF - that SoX thing looks super neat. Will definitely play with that. Having an API that understands how to read and write the Op-1 specific parts of the aif files still sounds like a useful thing to have, so I’ll continue down the Java route. (I got to the stage where I’m able to successfully split an album aif into L and R channels). I had a quick peek at your github page and saw a repository with “volca sample” in the description… gonna have a proper look at that later :slight_smile:

Did a bit more coding on this. Still nowhere near hosting anything on a raspberry pi, but I managed to write a fun little program that, given a root directory, searches for wav files that are less then 12 seconds long and then works out the most efficient way of packing the samples into as few drunkits as possible. Tomorrow night, I’ll try to actually generate the drumkits and load them onto my Op-1 :slight_smile:

@yoof - I could never get the thingamejig working, no idea why.

Anyway if you make a standalone backup and drum utility thing for raspi I will definitely buy the software, and probably others would too as it is a pain having to boot a PC just to take a quick backup.

i initially wanted to do somethign similar with my raspi. eventually just got this instead. http://www.microcenter.com/product/439773/TW700_Tablet_-_Black they go as low as 60 sometimes. has a full usb port and runs full windows. other models are more powerfull just make sure you get a model with the full usb port. or you could just use usb otg that would also work on android!

I reached a bit of a milestone on my coding this morning and thought I would share an update.

To recap: I’ve been writing an API in java that understands how to read and write the files on the Op-1. Putting the raspberry pi aside for one moment, I wanted to test that I was successfully able to generate drumkit files, just like the drum utility, but on steroids :slight_smile:

The idea is that you can point a little command line program to a folder on your computer containing samples. It can be a whole tree if you like. Then you run the program and it will generate lots of kits for you containing all the samples (using a best fit algorithm).

This morning, I finally got the meta data right (meaning all the start and end points of the samples). I can load them onto my op-1 and they actually work. Woohoo!!

I probably need a week to tidy my code, but once that’s done, I could host it somewhere for others to try out. It’s a super quick way of just getting some new sample fodder onto your Op-1 :slight_smile:

1 Like

Nice one, looking forward to checking it out.

I would love to get into the raspi but am in my late 30s with no programming experience whatsoever. How easy is it to pick up? And where to start?

I haven’t dabbled too much myself yet. This project was going to be my first attempt :slight_smile:


However, if you’re interested in having a play, I would seriously go for it. The cool thing is that there’s a lot of focus on using the R-pi as an education tool for kids. So that includes us big kids, if you ask me :wink:

Have a quick google for starter kits. Eg, this page discusses a few of them: http://www.pcadvisor.co.uk/buying-advice/desktop-pc/best-raspberry-pi-starter-kits-2015-2016-3621555/

And there are loads of books with fun projects to help you get started.

This is great @yoof, can’t wait to try it out!

Ok guys, I tidied things up a bit and put a command line interface around it. I would be very grateful if anybody who feels brave enough and fancies messing around with it, does so and provides some feedback.


The code has been written with Java 8, so it will require a version 8 JDK or JRE to run. (If you think this is a bit crap and older versions of java should be supported, shout up, and I don’t think it would be too hard to go back to java 6 or something). Anyways, download java and then make sure that the path to the bin directory in your JDK/JRE is on your PATH environment variable.

Then go to this github page and download the op1-drumkit-1.0.0-SNAPSHOT.jar file.

To run the program, open a command prompt and navigate to the directory where you’ve saved the jar file. Then type this and hit enter:

java -jar op1-drumkit-1.0.0-SNAPSHOT.jar

You’ll get a usage message like this:

java -jar op1-drumkit-1.0.0-SNAPSHOT.jar -source -target [options]
-source : the root folder containing samples
-target : the target folder to write drumkits to
-baseName : the base name of the drumkit (numbers will be appended to this name)
-maxLength : the maximum length of a sample to include in a kit

On my windows laptop for example, I have a stash of Roland drum machine samples in a particular directory. So, in order to generate lots of drumkits based on the samples in that folder, I’ve been running this command:

java -jar op1-drumkit-1.0.0-SNAPSHOT.jar -source “C:\home\audio\library\Roland Drum Samples” -target c: emp\roland -maxLength 2 -baseName roland

The -maxLength option will limit the length of samples identified by the program to that many seconds (floating point numbers are fine). The -baseName option allows you to specify a name that the generated kits will start with (numbers are appended to this name).

I’ve been testing this with version #14203 of the Op-1 OS (that’s the latest and greatest as of Nov 8th 2015). I’ve also been using Windows 10. It would be ace to get feedback from Linux / Mac users.

Before loading anything onto your Op-1, please back everything up!! I have successfully loaded lots of kits using this program and they’ve worked fine for me, but the last thing I’d want is to brick somebody’s current project, so please do a backup first.

Hope somebody finds it useful!

Cool, thanks for this @yoof! I’ll try it some time this week on my Linux machine and will report back.

Nice one, @vehka!

@yoof, had a go tonight, and it works great on Linux (Ubuntu 14.04) as well, after I installed the latest Java. It’s really handy, thanks!


The album splitter thing that you envisioned originally would be really nice too! =)

Ah fantastic! Thanks for trying it out @vehka :slight_smile:

I’ll keep chipping away when I get a bit of spare time and put that album splitter together too.

@yoof


What’s up? I’m a professional Java developer (tech lead) at a fortune 500 company, have a Rasberry Pi 3, and I’ve been experimenting with my own scripting for the OP-1 so I’m pretty interested in what you’re doing.

The scripting I’ve done has been limited to backing the my OP-1 up so I can switch between songs and not lose anything. I’ve just been using bash command line scripts to copy the files off the OP-1 so far (didn’t really need Java).

I love that you’re writing the API and learning about the AIF format (I’d love to do this as well) but for the actual utility it seems better to use SoX if it meets the needs of what you are trying to do. There’s just no substitute for using a “tried and true” tool vs baking something custom.

Have you seen this? http://now.teenageengineering.com/post/47348903156/op-1-drum-utility

Also, have you seen this? http://op-rand1.appspot.com/welcome.jsf

Some other feature ideas:
  • It would be awesome if we could have the Pi back things up when plugged directly into the OP-1. The light indicator could just change colors or it could beep when complete. Would be especially cool if the Pi was running on batteries and turned on/off.
  • Create a central patch repository and have commands to download and install them to the pi easily.
  • A command for moving chunks of sound around on tape that are too big to be lifted / dropped
1 Like