{"id":13776270,"url":"https://github.com/josephwilk/mud","last_synced_at":"2025-06-18T22:33:15.723Z","repository":{"id":17227098,"uuid":"19996021","full_name":"josephwilk/mud","owner":"josephwilk","description":"MUD is a layer over Overtone to make live composition more powerful and immediate.","archived":false,"fork":false,"pushed_at":"2016-10-16T08:52:00.000Z","size":64,"stargazers_count":60,"open_issues_count":0,"forks_count":2,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-02-14T19:31:24.090Z","etag":null,"topics":["live-coding","music","performance"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"astuetz/PagerSlidingTabStrip","license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josephwilk.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":"2014-05-20T20:18:42.000Z","updated_at":"2023-09-08T16:47:45.000Z","dependencies_parsed_at":"2022-07-21T19:48:29.398Z","dependency_job_id":null,"html_url":"https://github.com/josephwilk/mud","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephwilk%2Fmud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephwilk%2Fmud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephwilk%2Fmud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephwilk%2Fmud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josephwilk","download_url":"https://codeload.github.com/josephwilk/mud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253551499,"owners_count":21926304,"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":["live-coding","music","performance"],"created_at":"2024-08-03T18:00:21.430Z","updated_at":"2025-05-11T10:30:53.972Z","avatar_url":"https://github.com/josephwilk.png","language":"Clojure","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# Musical Universes of Discourse\n\n\u003cimg src=\"http://s30.postimg.org/6gdpkl2g1/piglet_color.png\" alt=\"MUD painting\" title=\"MUD\" align=\"right\" /\u003e\n\nMUD is a layer over Overtone which focuses on immediacy of expression and creation.\n\nOvertone is extremely powerful at the cost of verbosity. Live coding requires quite a lot of code.\nSnippet expansion can help alleviate but it does hinder the range of expression and clutters the visual\nexperience for the audience reading along with the code.\n\n## Install\n\nAdd in your project.clj file:\n\n```clojure\n[mud \"0.1.2-SNAPSHOT\"]\n```\n\n## Usage\n\n## Timing\n\nEverything you need to drive synths at beats\n\n```clojure\n(use '[mud.core])\n(require '[mud.timing :as time])\n\n;;set the rate\n(ctl time/root-s :rate 8.)\n\n;;Set timing controls on a Synth\n\n(defsynth seqer\n\"Plays a single channel audio buffer.\"\n[buf 0 rate 1 out-bus 0 beat-num 0 pattern 0  num-steps 8 \n beat-bus (:count time/main-beat)     ;; Our beat count\n beat-trg-bus (:beat time/main-beat)  ;; Our beat trigger\n amp 0.7\n rate-start 0.1\n rate-limit 0.9]\n(let [cnt      (in:kr beat-bus)\n      rander (mod cnt 1)\n      beat-trg (in:kr beat-trg-bus)\n      bar-trg  (and (buf-rd:kr 1 pattern cnt)\n                    (= beat-num (mod cnt num-steps))\n                    beat-trg)\n      vol      (set-reset-ff bar-trg)]\n  (out out-bus (* vol amp (scaled-play-buf :num-channels 1 :buf-num buf :rate (t-rand:kr rate-start rate-limit rander) :trigger bar-trg)))))\n\n\n(defonce kick-seq (buffer 256))\n(doall (map #(seqer :beat-num %1 :pattern kick-seq :num-steps 8 :buf (freesound-sample 194114)) (range 0 8)))\n\n(pattern! kick-seq [1 0 0 1 0 0 0]\n                   [1 0 0 1 0 0 0]\n                   [1 0 0 1 0 1 0])\n```\n\n## Callback on beats\n\nWe can define callbacks in Clojure land firing on various beat events.\n\n```clojure\n(defonce pulse-s (freesound-sample 194114))\n\n;;Every 256 beat trigger sample\n(on-beat-trigger 256 #(mono-player pulse-s))\n\n;;Dividing beats into 32 parts play sample at 31st beat\n(sample-trigger 31 32 #(mono-player pulse-s))\n\n;;Or express as a list pattern with 1 =\u003e hit.\n(sample-trigger [1 0 0 0 1 0 0 0] #(mono-player pulse-s))\n\n;;Fire once on beat 0 dividing beats into 128 parts and then remove callback.\n(one-time-beat-trigger 0 128 #(mono-player pulse-s))\n\n;;Callbacks can take the current beat as an argument, useful for varying a sample:\n(one-time-beat-trigger 0 128 (fn [beat] (mono-player pulse-s :rate (if (= 0 (mod beat 256)) 1.0 1.1))))\n\n;;Remove all registered triggers\n(remove-all-sample-triggers)\n(remove-all-beat-triggers)\n ```\n\n### Chords\n\nUse a single synth/inst def to play chords.\n\n```clojure\n(use '[mud.core])\n(use '[mud.chords])\n\n(def singing-chord-g\n  (chord-synth general-purpose-assembly 3 :amp 0.0 :noise-level 0.05 :beat-trg-bus (:beat time/beat-1th) :beat-bus (:count time/beat-1th) :attack 0.1 :release 0.1))\n\n(:bufs   singing-chord-g) ;; Access all the bufs of a chord.\n(:synths singing-chord-g) ;; Access all the running synths of a chord.\n\n(chord-pattern! singing-chord-g [[:C3 :E3 :F3]])\n\n(ctl (:synths singing-chord-group-g) :amp 0.2)\n```\n\n### Fast composition of Chords and degrees\n\nMake it easier to write a score, when switching of scales/chords\n\n```clojure\n(degrees-seq [:f3 1614 :F2 11 :C3 11]) ;;Lowercase -\u003e minor\n                                       ;;Uppercase -\u003e major\n\n;;a first inversion, b second inversion, etc.\n;; :sus4*2 is a shortcut for [:sus4 :sus4]\n(chords-seq [:F3 1 :6b :1c 4 :sus4 :sus4*2])\n\n;;Repeat a group of chords n times. Group is surronded by `[]`\n;; Also pass a string rather than an array.\n(chords-seq \"F3 [1 6b 1c 4 sus4]*8 sus4*2\")\n```\n\n### Patterns\n\nWriting patterns to buffers.\n\n```clojure\n(use '[mud.core])\n\n(defonce notes-buf (buffer 128))\n\n;;Write a pattern immediately\n(pattern! notes-buf (degrees [5 3 7] :minor :F3)) ;; Degrees\n(pattern! notes-buf [:A5 :A3 :A7])                ;; Notes\n\n;;Write a pattern on a beat one time (based on main-beat by default)\n(one-time-beat-trigger 0 128 #(pattern! notes-buf (degrees [5 3 7] :minor :F3)))\n\n;;Keep writing a pattern every nth beat.\n(pattern-repeat! 8 notes-buf #(degrees (shuffle [5 3 7]) :minor :F3))\n```\n\nEuclidean distribution for beats (From 'The Euclidean Algorithm Generates Traditional Musical Rhythms' (Toussaint 2005)).\n\n```clojure\n;;Spread 1 hit over 4\n(spread 1 4)   ;;=\u003e [1.0 0.0 0.0 0.0]\n\n;; Spread 3 hit over 8\n(spread 3, 8)  ;;=\u003e [1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0]\n\n;;Spread 7 hit over 11\n(spread 7, 11) ;;=\u003e [1.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 1.0] \n\n;;Rotations to the next strong beat\n\n;;Without rotation a spacing of 332\n(spread 3 8)   ;;=\u003e [1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0) \n;;With rotation a single rotation spacing of 323\n(spread 3 8 1) ;;=\u003e [1.0 0.0 0.0 1.0 0.0 1.0 0.0 0.0]\n\n(defonce drum-hits (buffer 128))\n(pattern! drum-hits (spread 1 4))\n```\n\n## Goals\n\n* Its centered around using Supercollider for timing rather than Java.\n* Buffers are the default way to express patterns.\n* Keep it Clojure, support Clojures fns to manipulate patterns.\n\n## Thanks\n\n* Elise Huard for the artwork\n\n## License\n\nCopyright © 2014-present Joseph Wilk\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephwilk%2Fmud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosephwilk%2Fmud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephwilk%2Fmud/lists"}