Skip to content

berciktymule/gosequencer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drum Machine

The Objective

The goal is to create a simple drum machine sequencer that allows you to "play" your own version of the famous four-on-the-floor pattern, as shown below:

https://raw.githubusercontent.com/mattetti/sm-808/master/Four_to_the_floor_Roland_TR-707.jpg

Installation

This solution uses portaudio for playback. more specifically gordonklaus golang port

Please follow their installation steps if necessary.

The Linux 64bit library is already part of this repo as I have used Ubuntu.

Prerequisites for OSX

brew install mpg123
brew install portaudio
go get -v github.com/gordonklaus/portaudio/...

Prerequisites for Linux

sudo apt install libmpg123-dev portaudio19-dev
go get -v github.com/gordonklaus/portaudio/...

Usage

Before running please make sure that the project is in Go path: export GOPATH=$(pwd)

Running

go run main.go -song examples/four_on_floor.trk should render Four on Floor playback

Parameters

-song Path to the song to be played. Required

-tempo Playback speed (BPM). Defaults to 500BPM

-loop Number of times to loop through the song pattern. Defaults to 3

Song of the year

Make sure to run go run main.go -song examples/blue_monday.trk -loop 1

Samples

Current samples contain:

  1. Kick drum
  2. Snare drum
  3. Hi-Hat

Adding samples

Currently the code supports only one specific format for playback.

If you wish to add additional samples please run:

go run src/github.com/gordonklaus/portaudio/examples/record.go samples/new_sample_name

Song Format

I've chosen to create my own simple format to easily edit the track. It seems easy to understand and has the ability to visually align all the tracks.

HiHat   --+---+---+---+-    samples/hihat.aiff
Snare   ----+-------+---    samples/snare.aiff
Kick    +---+---+---+---    samples/kick.aiff

First column is the track label used for display during playback (keep it short;) Following is the pattern for the current track.

+ means sound, - means no sound.

The last column has the path to the samples to use (relative to pwd).

The columns are separated by any number of white spaces so that it is easy to align the track patterns for tracks with labels of different lengths.

About

Simple command line sequencer written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published