/manifestation

Rudimentary Sample Sequencer in p5.js

openprocessing sample sequencer
sample sequencer

I did a course on Coursera recently called Creative Programming for Digital Media and Mobile Apps provided by the University of London & Goldsmiths. They were using the Processing environment for the programming assignments and teaching. Quite an interesting course it was. As the final week project we had to either make a game or a music application; as I wasn’t too keen on games I decided to try and create a rudimentary sample sequencer. Since I was also learning p5js at the same time I thought why not implement this in p5js. [This sketch is now available on openprocessing.] [Also look at the first entry on the sound page of this site]

I sampled my own sounds for this project with equipment easily found on my desktop. I also sampled seven notes on my bamboo flute. I find Audacity to be indispensable for sampling purposes. The top subsection of the screen is meant as a generative art display accompaniment to the music sequencer.

On the left side there is pattern memory, you can save and retrieve patterns from this menu. The pattern name is editable (which might not seem obvious as there appears to be no text field). Just start typing and you will see the pattern name changing. It is fixed to strictly eight characters and it is cyclic. I rolled my own text input widget specifically for this. Its “clunkiness” gives a vintage vibe. I find I am more creative when I start from scratch; creation flows easily when there is nothing already existing.

The log panel on the bottom too is custom built. There are no HTML widgets used (except for a single hidden form input button which allows uploading pattern files in JSON format). Lines are built from points, rectangles are built from lines. This is probably why the code got so big in size. Export and import of patterns is allowed. The entire list of patterns mentioned in the memory section gets written to a JSON file and gets downloaded. Import, similarly, requires you to upload a JSON file which was previously exported. The patterns are persisted using simple XOXOX 16 character strings.

This is rudimentary since it does not allow sequencing parameters such as volume, cutoff frequency, resonance. It also does not allow you to import your own samples (for now). Also 16 steps are quite limiting if one is trying to make a sizeable melody/groove. I plan to add a pattern sequencer interface each of which can be composed of multiple such 16 step patterns, similar to the Hydrogen drum machine. Recently I have taken a liking to the Beads library. I will post my exploration with sound art using beads in future posts.