{"id":13776268,"url":"https://github.com/pjagielski/disclojure","last_synced_at":"2025-04-09T18:35:14.267Z","repository":{"id":62434240,"uuid":"56968567","full_name":"pjagielski/disclojure","owner":"pjagielski","description":"Live coding environment with Overtone and Leipzig","archived":false,"fork":false,"pushed_at":"2019-02-11T17:39:34.000Z","size":45,"stargazers_count":84,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-13T21:22:35.627Z","etag":null,"topics":["clojure","live-coding","music","overtone"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjagielski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-24T11:43:53.000Z","updated_at":"2024-05-13T21:22:35.628Z","dependencies_parsed_at":"2022-11-01T21:16:10.944Z","dependency_job_id":null,"html_url":"https://github.com/pjagielski/disclojure","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjagielski%2Fdisclojure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjagielski%2Fdisclojure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjagielski%2Fdisclojure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjagielski%2Fdisclojure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjagielski","download_url":"https://codeload.github.com/pjagielski/disclojure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248088401,"owners_count":21045706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","live-coding","music","overtone"],"created_at":"2024-08-03T18:00:21.388Z","updated_at":"2025-04-09T18:35:14.245Z","avatar_url":"https://github.com/pjagielski.png","language":"Clojure","readme":"# Disclojure\n\nA live coding environment for [Overtone](https://github.com/overtone/overtone) and [Leipzig](https://github.com/ctford/leipzig).\n\n```clojure\n[pjagielski/disclojure \"0.1.4\"]\n```\n\n## Usage\n\nCreate a melody using Leipzig:\n```clojure\n(require '[repl :refer :all])\n(require '[leipzig.melody :refer :all])\n(require '[leipzig.scale :as scale])\n(def melody\n  (-\u003e\u003e (phrase [2 1/2 1/2 1/2 2.5 1/2 1/2 1/2 2.5 1/2 1/2 1/2 2.5 1 1]\n               [0 -1 0 2 -3 -4 -3 -1 -5 -6 -5 -3 -7 -6 -5])\n       (where :pitch (comp scale/G scale/minor))\n       (all :part :plucky)\n       (all :amp 1)))\n```\n\nInitialize the track state:\n```clojure\n(require '[disclojure.live :as l])\n(def initial-track\n  {:plucky (times 2 melody)})\n\n(defonce state\n         (l/reset-track initial-track))\n```\n\nLoop your track forever and change on the fly:\n```clojure\n(require '[leipzig.live :as live])\n(live/jam (l/track))\n(l/assoc-track :plucky (times 2 melody))\n(def last-frame (fn [e] (\u003e= (:time e) 12)))\n(def remove-last-frame (partial remove last-frame))\n(l/update-track :plucky remove-last-frame)\n```\n\n## Features\n\n### Drum kits\n\n```clojure\n(require '[disclojure.kit :as kit])\n```\n\nLoad drum kit from directory:\n```clojure\n(kit/load-kit! (io/file \"work/beats/big_room\"))\n```\n\nPlay a drum sound from a kit:\n```clojure\n(leipzig.live/play-note {:part :beat :drum :kick :amp 1})\n```\n\nThis should play `kick.wav` from drum kit. See \"Track helpers\" for details of creating drum patterns.\n\n### Sampler\n```clojure\n(require '[disclojure.sampler :as samples])\n```\n\nLoad samples from directory:\n```clojure\n(samples/load-samples! (io/file \"work/samples\"))\n```\n\nPlay a sample:\n```clojure\n(leipzig.live/play-note {:part :sampler :sample :loop :bpm 130})\n```\n\nThere is a convention of naming samples adopted from Sonic-Pi. Basically, you can include BPM and number of beats in a sample name.\nSo a file named `124_4_worm.wav` would be mapped to following structure:\n```clojure\n{:bpm 124, :beats 4, :name :worm, :sound #\u003cbuffer[live]: ...}\n```\n\nThis makes it easy to match sample rate for current BPM of the track. More in the next chapter.\n\n### Track helpers\n```clojure\n(require '[disclojure.track :refer [tap sampler] :as track)\n```\n\nMaking beat patterns with `tap`:\n```clojure\n(def da-beats\n  (-\u003e\u003e\n    (reduce with\n            [(tap :fat-kick (range 8) 8)\n             (tap :kick (range 8) 8)\n             (tap :snare (range 1 8 2) 8)\n             (tap :close-hat (sort (concat [3.75 7.75] (range 1/2 8 1))) 8)\n             (let [horns [0 1/2 5/4 2]]\n               (tap :horn (concat horns\n                                  (map (partial + 4) horns)) 8)) ])\n    (all :part :beat)))\n```\n\nBasically, `tap` takes a drum name and a collection of beat times to create a drum pattern. `(range 8)` will play every beat (kick),\n`(range 1 8 2)` - every even beat (snare) and so on.\n\nSequencing samples with `sampler`:\n\n```clojure\n(track/sampler [[0 :apache 16 2]\n               [(range 0 16 4) :funky-drummer 4 2]\n               [(range 0 16 4) :hotpants 4 2]])\n```\n\nThe `sampler` function takes a vector of sample pattern with following structure:\n`[times sample_name beats amp \u003cstart_beat\u003e]`\n* `times` could be a beat or collection of beats where the sample should play\n* `sample_name` is a name created by `load-samples!`\n* `beats` is the number of beats to play\n* `amp` is the amplitude of the sample\n* optional `start_beat` allows to play a part of sample from specific point\n\n### Custom instruments\n\nDefine an Overtone synth and map it to Leipzig `live/play-note`:\n\n```clojure\n(require '[overtone.live :refer :all])\n(defsynth da-funk ...)\n(defmethod live/play-note :da-funk [{hertz :pitch seconds :duration amp :amp cutoff :cutoff}]\n  (when hertz\n    (da-funk :freq hertz :dur seconds :amp (or amp 1) :cutoff (or cutoff 1500))))\n```\n\n## License\n\nCopyright © 2016-2019 Piotr Jagielski\n\nThe project name refers to [Disclosure](https://www.youtube.com/watch?v=W_vM8ePGuRM)\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","funding_links":[],"categories":["Libraries and tools","Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjagielski%2Fdisclojure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjagielski%2Fdisclojure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjagielski%2Fdisclojure/lists"}