• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    Clojure
  • Created almost 12 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Models of Musical Creativity (in Clojure)

#Computer models of musical creativity

Experiments with models for computers generating music.

##Examples

(require '[musical-creativity.musician :as musician] :reload)
(use '[musical-creativity.instruments] :reload)

;Cosine
(require '[musical-creativity.composers.cosine :as cosine] :reload)
(musician/play (cosine/compose) piano)

;Cellular automata
(require '[musical-creativity.composers.cellular-automata :as ca] :reload)
(musician/play (ca/compose) organ)
(musician/play (ca/compose ca/rule-22) sawish)

;Sonify data
(require '[musical-creativity.composers.sonify-data :as sonify-data] :reload)
(musician/play (sonify-data/compose) piano)

;Sonify text
(require '[musical-creativity.composers.sonify-words :as sonify-words] :reload)
(musician/play (sonify-words/compose "Strange Loop Strange Loop") piano)
(musician/play (sonify-words/compose "potato potato") ping)

;Network (Using adaptive resonance theory)
(require '[musical-creativity.composers.network :as network] :reload)
(musician/play (network/compose) piano)

;Markov chains
(require '[musical-creativity.composers.markov :as markov] :reload)
(musician/play (markov/compose) piano)
(musician/play (markov/compose) ping)

(musician/play (markov/compose data.bach/bach1 [57 60 69] 1 50) piano)

;with phrase mapping
(musician/play (markov/compose data.bach/bach1 [57] 16 (* 5 16)) piano)

;with naive voice extraction and phrase mapping
(require '[musical-creativity.analyzer :as analyzer] :reload)
; first extracted voice only and phrase mapping
(musician/play (markov/compose (first (-> data.bach/bach1
analyzer/group-by-time analyzer/extract-voices-min-distance)) [57] 16
(* 16 5)) piano)
; all voices added to model separately and phrase mapping
(musician/play (markov/compose (flatten (-> data.bach/bach1
analyzer/group-by-time analyzer/extract-voices-min-distance)) [57] 16
(* 16 5)) piano)

;multiple markov models
(let [lead-voice    1
      standard-prep #(-> %
                         analyzer/group-by-time
                         analyzer/extract-voices-min-distance)
      dur-prep      #(->> %
                    analyzer/group-by-time
                    analyzer/extract-durations
                    (map (fn [d] {:duration d}))
                    vector)]
    (markov/compose-multi-model
     data.bach/bach1
     50
     :pitch     (markov/transition-source standard-prep
                                          1 8 1 lead-voice)
     :voices    (markov/transition-source #(-> %
                                               analyzer/group-by-time
                                               vector)
                                          1 4 1 0)
     :harmonics (markov/harmonic-source standard-prep lead-voice [0 2 3])
     :duration  (markov/transition-source dur-prep
                                          1 4 4 :all)
     :velocity  (markov/constant-source 128)))

;Fuzzy
(require '[musical-creativity.composers.fuzzy :as fuzzy] :reload)
(musician/play (fuzzy/compose) piano)

;Improvise
;(very experimental)
(require '[musical-creativity.composers.improvise :as improvise] :reload)
(musician/play (improvise/compose) piano)

(require '[musical-creativity.band :as band] :reload)
(band/play (improvise/compose))

;Recombinance (Based on Bach Choral no. 140)
(require '[musical-creativity.composers.recombinance :as recombinance] :reload)
(require '[data.bach :as bach] :reload)
(recombinance/create-database-from bach/chorale-140-data)
(musician/play (recombinance/compose) organ)
(musician/play (recombinance/compose) piano)
(musician/play (recombinance/compose) slow-piano)

(musician/play (recombinance/compose-original) piano)

;Gradus (with each run Gradus learns how to better compose)
(require '[musical-creativity.composers.gradus :as gradus] :reload)

(musician/play (gradus/compose) piano)

(musician/play (gradus/compose-canon) piano)

(musician/play (gradus/compose-canon data.gradus/cantus-firmus-1) piano)
(musician/play (gradus/compose-canon data.gradus/cantus-firmus-2) piano)
(musician/play (gradus/compose-canon data.gradus/cantus-firmus-7) piano)

(musician/play (gradus/compose-contemporary) piano)

Association Network (Apprentice)

(require '[musical-creativity.composers.apprentice :as apprentice] :reload)
(require '[musical-creativity.composers.apprentice.player :refer :all] :reload)

(apprentice/apprentice play-all)

An example musical conversion:

user> ceg!
user> gbd?
alice> ceg!
user> ceg fac gbd?
alice> fac ceg ceg!
user> ceg fac gbd ceg!
alice> gbd?
user> ceg!
alice> gbd?
user> gbd?
alice> ceg!

Weightings:

Weightings

A non musical dialog example:

user> hello!
Alice> your what your is name?
user> my name is joseph!
Alice> name?
user> your name is computer!
Alice> name?
user> what is my name?
Alice> joseph!
user> what is your name?
Alice> computer!
user> no*
user> what is your name?
Alice> joseph!

Demos

;;b11606b
(musical-creativity.musician/play (map musical-creativity.events/midi-to-event data.bach.chorale-140/b11606b) piano)

(require '[musical-creativity.composers.recombinance :as recombinance] :reload)
(require '[data.bach :as bach] :reload)
(recombinance/create-database-from bach/chorale-140-data)

(musical-creativity.musician/play (map musical-creativity.events/midi-to-event ('b11606b-22 @beats-store)))

##Book

Based on exercises from:

Computer Models of Musical Creativity

Computer Models of Musical Creativity http://mitpress.mit.edu/books/computer-models-musical-creativity

More Repositories

1

amrita

A polite, well mannered and thoroughly upstanding testing framework for Elixir
Elixir
199
star
2

semanticpy

A collection of semantic functions for python - including Latent Semantic Analysis(LSA)
Python
159
star
3

rsemantic

A document vector search with flexible matrix transforms. Currently supports Latent semantic analysis and Term frequency - inverse document frequency
Ruby
146
star
4

image-resizer

Resize/Crop/Rotate/Pad images in Clojure without any native install. Oh and do it Fast.
Clojure
135
star
5

circuit-breaker

Circuit breaker for Clojure
Clojure
129
star
6

tlearn-rb

Recurrent Neural Network library for Ruby
C
96
star
7

pairwise

Ruby based tool for selecting a smaller number of test input combinations (using pairwise generation) rather than exhaustively testing all possible permutations.
Ruby
84
star
8

shaderview

Light show for live coding
GLSL
75
star
9

strangeloop2014

Come with us now on a journey β™ͺ
Clojure
64
star
10

mud

MUD is a layer over Overtone to make live composition more powerful and immediate.
Clojure
60
star
11

hystrix-event-stream-clj

Easy way to output a Hystrix event stream in Clojure.
Clojure
55
star
12

functions-as-patterns

Exploring patterns as a means of understanding and documenting functions.
Clojure
46
star
13

japanese-mosaic-logic-puzzle

Problem for Programming challenge October
Ruby
42
star
14

rspec-rr

Helping Rspec and Rspec-rails play nicely with RR the test double framework
Ruby
27
star
15

stereotype

A fixture library for setting up test data in Clojure
Clojure
26
star
16

pronounce

Find how to pronounce words by breaking them up into their phones.
Ruby
24
star
17

overtone.device.launchpad

Using Launchpad with Overtone and Clojure
Clojure
23
star
18

overtone.orchestra

Orchestra for Overtone
Clojure
21
star
19

overtone.synths

A collection of synths
Clojure
17
star
20

closure-bricks.el

What would scheme bricks look like in emacs...
Emacs Lisp
13
star
21

cucumber_cocktails

A collection of my Cucumber utils
Ruby
10
star
22

finger-smudge

Music for Machines. Exploring the smudges of fingerprinting digital music.
Clojure
10
star
23

iwfms

A Intelligent Workflow Management System using Prolog and PHP that uses artificial intelligence planning methodologies and Event Calculus workflow specifications.
PHP
9
star
24

shader-pi

Interactive Shaders for SonicPi
Ruby
8
star
25

ofxEmacsEditor

Emacs editor for openframeworks
C++
8
star
26

overtone.device.push

Using Ableton push with Overtone and Clojure
8
star
27

creative-machine

Experiments in creative AI
Ruby
8
star
28

synthatron

Generator of synths for use with Supercollider. Evolving synths for evil or good.
Clojure
7
star
29

midje-junit-formatter

Junit Formatter for Midje
Clojure
6
star
30

irobat

The Iphone and Cucumber sitting in a tree K-I-S-S-I-N-G. EXPERIMENTAL!
Ruby
6
star
31

qscintilla

QScintilla version (2.9/2.10) that introduces transparent background but not text.
C++
6
star
32

rr-tmbundle

RR (Double Ruby) test double framework - TextMate bundle
5
star
33

nicos-ip

Corrupted Sonic Pi. Highly dangerous. May infect thought.
Ruby
4
star
34

presentations

Joseph Wilk's Presentations
4
star
35

the-nature-of-sound

β™« Clojure library for exploring the nature of sounds. May contain large traces of C++.
C
4
star
36

josephwilk.github.io

A place for pretty pictures and noises without detailed explanations.
HTML
3
star
37

fake_execution

Fake out execution in Ruby and test what was executed
Ruby
3
star
38

patterns

Collection of patterns from workshops
3
star
39

codemash2014

Making noise, that is definitely sound and might also scrap by as music
Clojure
3
star
40

fluxtone

An experiment looking at an OSC layer for Overtone <-> Fluxus
Clojure
3
star
41

software-craftsmanship-katas

Katas and source code. Experiments with different styles of coding and testing.
Ruby
2
star
42

dotfiles

Joseph Wilk's dotfiles
Shell
2
star
43

aocny

Ruby
1
star
44

vim-cucumber

Vim Runtime files for Cucumber features
Vim Script
1
star
45

midi-mash

Do the midi mash.
Clojure
1
star
46

overtone.device.monome

Clojure Experiments with an infinite plane projected onto a Monome with movement x,y
Clojure
1
star
47

prometheus-clj

Clojure
1
star
48

alice

1
star
49

overtone-midi-bug

Investigating problem with midi devices freezing.
Clojure
1
star
50

code-sounds

Like code smells only louder
Clojure
1
star
51

stereotype-clj

stereotype-clj now lives here: https://github.com/josephwilk/stereotype
1
star
52

raptor_demo

Demo of raptor
Ruby
1
star
53

fujin

Clojure
1
star
54

sample-meta

Mining data on samples using sox/aubio
Clojure
1
star
55

fake-ns

1
star
56

clj-dirt

Bindings over the DIRT sample pack used in Tidal
1
star
57

clojure-horde3d

Experiments with Clojure and Horde3d Games/Graphics engine
Clojure
1
star
58

aoc

Ruby
1
star
59

macro_tools

Macro tools for Elixir
Elixir
1
star
60

poetic-computation

Exploring code as an art material
1
star
61

spa2011

Cucumber examples used in workshop at SPA2011
1
star