Skip to content

A browser-based DAW for Leipzig and Overtone. Built with re-frame, component and sente for websockets.

License

Notifications You must be signed in to change notification settings

pjagielski/disclojure-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Disclojure UI?

A re-frame application to visualize and edit compositions created with Leipzig for Overtone.

What is Overtone?

Overtone is a suberb Clojure sound library created by Sam Aaron. It lets you design own synths, play samples, interact with MIDI devices through SuperCollider platform. Overtone is realy good for sound design and playing individual notes but not that good at modeling complex compositions. That's why some abstraction layer libraries over it like Leipzig and mud were created.

What is Leipzig?

Leipzig is a composition library for Overtone created by Chris Ford. The main idea behind Leipzig is that you can model (most of) melodies by sequence of notes with durations:

{:time 0 :pitch 67 :duration 1/4 :part :bass}

Leipzig provides a DSL which allows you to model these melodies with convenient transformations of Clojure collections.

Consider classic Da Funk track by Daft Punk:

(->> (phrase (concat [2]
                     (take 12 (cycle [1/2 1/2 1/2 2.5]))
                     [1 1])
             [7 6 7 9 4 3 4 6 2 1 2 4 0 1 2])
     (where :pitch (comp scale/G scale/minor))
     (all :part :supersaw)
     (all :amp 1))

The phrase function takes 2 collections - with note durations and pitches - which are zipped to create base melody items with :time, :pitch and :duration entries. You can use standard Clojure collection functions like cycle, take and concat there. The pitches are steps of a given scale, which is provided with scale namespace, when you can compose scale root, type (minor, major, pentatonic and many more), you can go octave down with low and octave up with high. Then you just specify what instrument (part) should play this melody and other properties of the notes, like :amp, :cutoff and other. So, the resulting Leipzig structure looks like this:

[{:pitch 67, :time 0, :duration 2, :part :da-funk, :amp 1}
 {:pitch 65, :time 2, :duration 1/2, :part :da-funk, :amp 1}
 {:pitch 67, :time 5/2, :duration 1/2, :part :da-funk, :amp 1}
 ...]

How can Disclojure-UI help working with Leipzig melodies?

As a non-musician it was hard for me to understand the context of the notes without actually seeing them on the screen. So I built Disclojure-UI as a browser-based DAW with a piano-roll like view that visualizes melodies created with Leipzig. The data is synced in both directions - when you change the Leipzig structure in the REPL (via websocket) and when you just edit the notes by clicking in the web GUI (via REST api):

Apart from editing melodies, Disclojure-UI helps you edit beats in a separate beat view:

How it works?

Frontend is built with re-frame and sente for websockets. Backend manages state with component and uses system and compojure-api to expose REST API, also visible as Swagger spec:

Running

Compile Clojurescript:

lein cljsbuild once dev

Run:

lein repl
(require 'repl)
(reloaded.repl/reset)

Browse to http://localhost:3005.

Interact (better with some IDE like Cursive, vim-clojure, Emacs):

(require '[leipzig.melody :refer :all])
(require '[leipzig.scale :as scale])
(require '[leipzig.live :as live])
(require '[disclojure.live :as l])
(->> (phrase (concat [2]
                     (take 12 (cycle [1/2 1/2 1/2 2.5]))
                     [1 1])
             [7 6 7 9 4 3 4 6 2 1 2 4 0 1 2])
     (where :pitch (comp scale/G scale/minor))
     (all :part :supersaw)
     (all :amp 1)
     (l/assoc-track :supersaw))
(live/jam (l/track))
...
(live/stop)

More info about live coding in disclojure docs.

You can see example session in this live-coding demo: disclojure ui demo

License

Copyright © 2016 Piotr Jagielski

The project name refers to Disclosure band.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

A browser-based DAW for Leipzig and Overtone. Built with re-frame, component and sente for websockets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published