Acid Bassline Sequencer Experiment Using WebMIDI

Anyone have a CVPal with X0XPal firmware, and an X0X Heart module?

I’ve been tinkering with an idea for a dedicated acid bassline sequencer, that may end up as a Eurorack module and/or a Max4Live MIDI effect.

I’m currently developing the code in JavaScript (I know, probably an odd choice, but it’s what I know best), so it needs the Jazz browser plugin to work. With that I installed, it can send MIDI notes to the X0XPal, which is pretty cool!

The plan is eventually to feed the thing with 25 carefully-selected 303 basslines, arranged in a 5x5 grid, which can be blended and transformed in various ways, inspired by MI Grids (and using some chunks of Oliviers code).

Currently, it has a library of 25 randomly-generated patterns. I’ve yet to try it with the X0XPal and X0X Heart, but it’s already sounding cool, just with the Apple DLS Synth.

I’m going to add a couple more features, then upload to Github, and put up a webpage for testing, soooo… I was wondering if anyone might be interested in doing some beta-testing of the basic functionality, in the nearish future.

Drop me a message if you’re interested in testing it.

You don’t necessarily need an X0XPal and X0X Heart. Any subtractive synthesis-style MIDI synth that has mono legato mode, and can map velocity to one or several of the following parameters would also produce cool basslines: filter cutoff frequency/filter env. amount/filter env. decay. A Shruthi-1 or Ambika would probably work great, though obviously won’t have that authentic 303 sound.

Once I’ve verified the concept with my JS model, I’ll think about making it into something more useful.

a|x

With the new Raspberry Pi out, why not make a Pure Data Midi app/sequencer? I have been thinking about writing something similar to my hardware midi plumbing in software, and Pure Data looks to be the best fit. It has been around forever, and can run well on fast or “slow” computers. Not to mention it is made for audio and Midi things. Side note, you can port Pure Data patches to Eurorack.

However, if you make a webpage sequencer with web Midi, I would be very interested to see how that works out! It would be very neat for people to then share their results via social media. Almost like a way to find the “best” Acidtrax collectively.

@audiohoarder good to hear from you!

I’ve got it working now with Webmidi, and was having a Lot of Fun last night making acid lines with my Novation Mininova.

There are some niggles with Webmidi. The need to install a plugin to use it with anything other than Chrome is one, which will hopefully go away eventually, but perhaps the most annoying I’ve discovered so far is that on my Mac, at least, JavaScript execution slows to a crawl if you don’t tweak any controls for more than a few seconds- I presume this is a power-saving measure. That said, it’s a pretty cool way of trying out ideas, and UIs too (not that I’ve spent much time with that, for the current project, thus far).

As far as allowing people to save their creations, that should be eminently possible. I was already considering some kind of presets system, but adding the ability to save presets to a server introduces a whole extra level of complexity that might be a distraction from my primary purpose though- ie to develop firmware for a Eurorack module.

It might be pretty cool to be able to capture a pattern as a downloadable MIDI file. I’m sure that would be possible with Ajax, and a bit of PHP, server-side. I’d be more inclined to work on that, than spend time implementing all the back-end required to create some kind of pattern-sharing community, to be honest (though it’s a lovely idea). I’d be happy to let someone else take my code and build it into something more like this, if anyone wanted to take that on (and host the site).

There are a couple of additional features I’d like to implement before I put a beta version online, but I should be able to do that in the next few days, hopefully, so stay tuned.

a|x

Re. Raspberry Pi, my first thought was that that would be complete overkill, for a project like this, and that a Teensy LC or er even an ATmega328 (arduino style) would probably be the best choice to power a Euro module.

Then I though of the new Pi Zero, and the possibilities of built in SD card, USB, and all the other stuff that comes for the ridiculously low asking-price, and the idea began to seem a lot more appealing.

a|x

Uploading to a server is not what I had in mind. More like a button, Twitter or Facebook enabled, that shares a small line of text that could be copied and pasted into the web GUI. Kind of like how a seeded random generator works. If you are using a library of patterns, you will only need the X and and Y position of the sequencer. However, I am probably over-simplifying the framework. Of course, being able to send this string over audio to Eurorack for presets - like what the Aira stuff does - would be a real reason to add this. Don’t waste time making a server, that is what social networks are for. :slight_smile:

As for the Java script slowing down after a while, make sure to do your garbage collection in the proper places. Yeah, it will do it for you, but that will bog it down over time. Since you say it slows down until you change a parameter, I would guess that is the most likely cause.

Anyway, Java isn’t bad for prototyping, but don’t be afraid to swap the Java out for C or Python embedded in an HTML5 webpage at a later date.

Yes, the new Pi Zero really is an amazing piece of tech for the price.

Ah, good idea re. the URL. There are a few parameters that control the output, but they could easily be appended to a URL. Great idea!

I’m planning to learn Python. I have a JS file that generates lookup tables and random pattern arrays. I currently have to manually copy-paste the output from the browser into my tables JS files, so I’m hoping to be able to write directly into the tables files using a Python script.

a|x

I think if the Euro module was Rpi-powered, I’d just add an extra SD card socket on the front panel, and you could save presets and MIDI files to that.

a|x

I could also break out a USB socket to the front, which would allow for the connection of a MIDI controller, for tweaking extra parameters not accessible from the UI (I want to keep the number of controls relatively small, to save HPs).

a|x

Java is very much not the same as JavaScript. :confused:

Yeah, Javascript was renamed to cash in on the hype of Java.

This thing is written in JavaScript (and HTML + CSS, obviously), just to be clear.

Also the distinction between JavaScript and Java isn’t as obvious as you might think. Both are based on C, both are object-based, and both are interpreted, rather than compiled languages. Or at least, Java applications requires the Java runtime to work, while, JS runs in a browser.

a|x

I am talking out of my hat though, since I have no experience of Java, except for some bad ones with badly-written desktop applications that generally seem to look like sh*t, UI-wise, and be clunky to use.

a|x

Not quite. Javascript is interpreted. Java is compiled interpreted. Java source files compile into Java bytecode, which is a virtual instruction set the JRE converts into native instructions. Sun did think of producing Java CPUs which ran class files natively but it never happened.

With Java you have to compile first then run. This at least fishes out some of the errors before running the code. With Javascript you can run bad code with trivial syntax mistakes in it which won’t affect the problem until that code is called.

Java was meant to end the problem of application portability. But it never quite did.

Nope. Runs equally badly on everything :wink:

a|x

I stand corrected. The text-editor I’ve recently started using runs JSLint on file-save, so it does give some feedback on where you might be going wrong. JavaScript errors also get displayed in the browsers console, and the messages tend to be more useful than PHP error messages, I’ve generally found.

a|x

Well PHP code gets run on the server, Javascript on the client. Client-side debugging is easier. With the console on modern browsers you can put breakpoints in and then type javascript code into the console to evaluate the value of variables etc.

True. I’ve become quite used to the blank page in the browser, that tells me PHP has suffered a fatal error running my code. It’s usually me forgetting to add the ‘;’ at the end of a line or an ‘$’ to the front of a variable name…

a|x

I’m used to writing C code in a normal text editor back in the Amiga days. So you do get used to reading syntax and checking for errors. At work I use an IDE now though :slight_smile:

I know what you mean. I’ve been writing code/scripts for a long time, too, and have never really used debugging tools much.

a|x

Sounds cool, is the map expressed as offsets from a selectable root note? On the RPi, I’d be concerned about the power requirements. The Teensy can also read from an SD Card, for example the Music Thing Radio Music module is based on Teensy and reads audio files from a Micro SD.