Coder Social home page Coder Social logo

benirose / lissajous Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kylestetz/lissajous

0.0 1.0 0.0 582 KB

A tool for programmatic audio performance in the browser using Javascript.

Home Page: http://lissajousjs.com

License: Other

CSS 2.37% JavaScript 97.63%

lissajous's Introduction

Lissajous

Lissajous is a tool for real time audio performance using Javascript. It wraps succinct tools for creating oscillators and samplers into a chainable API, allowing performers to build and improvise songs with a minimum of code.

Lissajous exists entirely within the Javascript console & was designed for use with Google Chrome or Firefox.

Requires the latest stable Chrome or Firefox build & a relatively recent OS. If you have your own .wav files you can drop them in the window to load them into the environment!

Watch a few demo videos

Read the Tutorial

The tutorial is a work in progress but already serves as great starting point for new performers!

Get a local copy

In order to run Lissajous locally you have to have a copy of the lissajous environment on your machine. Do this by pulling down this repo: git clone [email protected]:kylestetz/lissajous.git and opening the file /environment/index.html. The environment doesn't contain any samples- add an /environment/samples/ folder (ignored by git) and add samples via /environment/extras.js!

This is what Lissajous looks like

// make a triangle wave that loops the notes 69, 67, then 60 in quarter note intervals
t = new track()
t.tri().beat(4).notes(69,67,60)

// load a sample, set the beat to quarter notes, set the note length to a half measure,
// set the envelope to give it a little attack and release, and loop the notes 69, 67, then 60
s = new track()
s.sample(buffer)
s.beat(4).nl(8).adsr(0.1,0,1,1).notes(69,67,60)

// load an array of three AudioBuffers called 'drums', play them in 8th notes and give them
// the sequence drums[0], drums[2], drums[1], drums[2]
d = new track()
d.sample(drums)
d.beat(2).sseq(0,2,1,2)

// load a piano sample and mess it up real good
p = new track()
p.sample(pianoSample)
p.beat(2).nl(2).speed(0.5).clamp(1/16).clshift(-1/16)

Basic Concepts of Lissajous

A performance in the Chrome console using Lissajous takes place in the global namespace. You'll probably create a lot of variables with names like s or a or b1 or b2 or doodle, and this sort of usage is encouraged. Need to start over? Refresh the page.

The key to making the most of Lissajous is to add scripts (e.g. extras.js) that load all of your samples into the environment on page load. A clever or ambitious performer might write some additional functions to coordinate changes, control transitions, or execute other group-oriented operations with style and grace. Sky's the limit.

Every track has a step sequencer.

Tracks make sound when they are given a beat. Here's the minimum needed to generate some sound:

t = new track()
t.beat(4)

Beat is a step sequencer. Calling t.beat(4) says "play a note every four 16th notes." The Lissajous API supports an arbitrary number of arguments, allowing us to make more complicated patterns:

t.beat(4,3,2,1,4,2)

If we visualized this in a classic step sequencer view, it would look like this:

 1           5           9           13
[x][ ][ ][ ][x][ ][ ][x][ ][x][x][ ][ ][ ][x][ ]

The clock ticks in 32nd notes, and the API is written to support both 16th and 32nd note expressions.

t.beat(1) // play a note every 16th note
t.beat32(1) // play a note every 32nd note

Everything reacts to the step sequencer.

Most of the parameters of a track can be given more than one value (we call this a pattern). For example, with notes:

t = new track()
t.beat(4).notes(69, 67, 60)

Tracks are monophonic. Since we supplied three notes, they will play one at a time, looping back to the beginning when they reach the end. There's no limit to the number of notes you can have in a pattern.

Patterns for each parameter are self-contained and do not rely on each other, allowing us to play with patterns of different lengths:

t = new track()
t.beat(4).nl(4,2).notes(69, 67, 60)

Here we toggle between a note length of 4 and 2 every time a note is hit, but we cycle through three different notes.

Samples can be sliced and diced.

Working with samples is simple in Lissajous. There are helper functions to get your samples loaded onto the page; check out /environment/extras.js for an example.

var t = new track()
t.sample(mySample)
// play a beat every quarter note with a note length of 4/16th
t.beat(4).nl(4)
// clamp to the first 1/16th of the sample & loop that portion
t.clamp(0, 1/16).loop(1)
// shift the clamp points by -1/16th of the sample size every beat
t.clshift(-1/16)

Todos

  • Develop a technique that would make smooth LFOs possible
  • MIDI in/out
  • Audio In
  • sharing JS context across multiple machines

Special Thanks

This project is made possible by a lot of people writing great articles and making great libraries. For the sake of completeness I have added several libraries to this repo.

lissajous's People

Contributors

benirose avatar kylestetz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.