Difference between revisions of "Haskore"

From HaskellWiki
Jump to navigation Jump to search
(Matt Munz: CAEC)
m (link is alive)
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[http://www.haskell.org/haskore/ Haskore] is a set of Haskell modules for creating music as [[MIDI]], [[CSound]], [[SuperCollider]], and [[Synthesizer|Audio files]].
+
[http://www.haskell.org/haskore/ Haskore] is a set of Haskell modules for creating, analysing and manipulating music.
  +
Music can be made audible through various back-ends. (See below.)
A more recent, but less stable version, is available as [[Darcs]] repository at http://darcs.haskell.org/haskore/.
+
A more recent, but less stable version, is available as [[Darcs]] repository at http://code.haskell.org/haskore/revised/.
  +
  +
==Features==
  +
  +
===Example===
  +
  +
To get an impression how intuitive music composition with Haskore is, see the following example code (runs with revised Haskore):
  +
<haskell>
  +
chords =
  +
(c 0 qn () =:= e 0 qn () =:= g 0 qn ()) +:+
  +
(c 0 qn () =:= f 0 qn () =:= a 0 qn ()) +:+
  +
(d 0 qn () =:= g 0 qn () =:= b 0 qn ())
  +
  +
song =
  +
MidiMusic.fromMelodyNullAttr MidiMusic.AcousticGrandPiano
  +
(Music.transpose (-48) (Music.changeTempo 3 chords))
  +
</haskell>
  +
  +
The <hask>(=:=)</hask> means parallel composition and
  +
<hask>(+:+)</hask> means serial composition of musical objects.
  +
  +
===Backends===
  +
  +
Ideally you can compose a song once in Haskore, and then play it by several back-ends.
  +
Practically this is more difficult, since all back-ends have different functionality (otherwise there wouldn't be so many).
  +
  +
These back-ends are currently supported:
  +
* [[MIDI]] (both file and realtime)
  +
* [[CSound]]
  +
* [[SuperCollider]]
  +
* [[Synthesizer|Audio files]] rendered by pure Haskell code.
  +
  +
ToDo:
  +
* Notation output (Lilypond, partially done in CAEC, see below).
   
 
==Community==
 
==Community==
Line 10: Line 44:
 
=== Platforms ===
 
=== Platforms ===
   
With a bit of hacking Haskore can run on several platforms.
+
The core Haskore can run on both Linux and Windows.
  +
Only various back-ends and real-time functionality are critical.
In fact most of the hassle is caused by Haskore being not properly split into small packages.
 
  +
So far, real-time playback and use of [[SuperCollider]] is only usable on Linux.
  +
 
In future Haskore should consist of a small core for music composition, analysis and manipulation
 
In future Haskore should consist of a small core for music composition, analysis and manipulation
 
and separate packages for connecting to various back-ends and separated real-time stuff.
 
and separate packages for connecting to various back-ends and separated real-time stuff.
  +
The splitting made some progress, but is still not at its end.
   
  +
<!--
 
==== UNIX/Linux ====
 
==== UNIX/Linux ====
   
Line 25: Line 63:
 
* http://www.haskell.org/pipermail/haskell-cafe/2008-June/043905.html
 
* http://www.haskell.org/pipermail/haskell-cafe/2008-June/043905.html
 
* http://www.haskell.org/pipermail/haskell-cafe/2008-August/045911.html - Some hacks to get Haskore running on Windows quickly. The right thing to do would be to factor out the real-time stuff, since it is in general hard to port.
 
* http://www.haskell.org/pipermail/haskell-cafe/2008-August/045911.html - Some hacks to get Haskore running on Windows quickly. The right thing to do would be to factor out the real-time stuff, since it is in general hard to port.
  +
-->
   
 
=== Installation using cabal ===
 
=== Installation using cabal ===
   
  +
(There are more detailed installation instructions [http://github.com/nfjinjing/haskore-guide/tree/master/doc/install.markdown here], if the following does not work)
Prerequisits: You should be able to fetch a package using darcs and configure/build/install it using cabal.
 
   
 
Prerequisites: You should be able to fetch a package using [[Darcs]] and configure/build/install it using [[Cabal/How_to_install_a_Cabal_package|cabal]].
Step 0. Choose a folder where some haskell packages can be stored.
 
   
  +
Step 0. Since it is the most convenient way of installation, try to install as many as possible packages from [[Hackage]] using cabal-install. Not all packages are available on Hackage because of their experimental state.
Step 1. Get the packages. For each PACKAGE in (non-negative, event-list, record-access, markov-chain, midi, haskore) do
 
   
  +
cabal install midi # this will also install non-negative, event-list
darcs get http://darcs.haskell.org/PACKAGE
 
  +
cabal install data-accessor
  +
cabal install markov-chain
   
  +
Step 1. Install the remaining packages such that at the end the following packages are installed:
Step 2. Patch Haskore's cabal file: [[http://www.haskell.org/haskellwiki/Image:Cabal.patch Cabal.patch]]
 
   
 
non-negative, event-list, data-accessor, markov-chain, midi, haskore
cd haskore
 
darcs apply /path/to/cabal.patch
 
   
  +
If cabal-install worked, there should only <code>haskore</code> be left for installation.
Step 3. Build and install the packages. For each PACKAGE (in the order of above)
 
  +
 
Step 2. Choose a folder where some haskell packages can be stored.
  +
  +
Step 3. Get the packages. That is, for each PACKAGE call
  +
 
darcs get http://code.haskell.org/PACKAGE
  +
or
  +
darcs get http://code.haskell.org/~thielema/PACKAGE
  +
 
Step 4. Build and install the packages that you got by darcs. For each PACKAGE (in the order of above)
   
 
cd PACKAGE
 
cd PACKAGE
Line 48: Line 98:
 
runhaskell Setup.lhs install
 
runhaskell Setup.lhs install
   
  +
Step 5. On Linux you may also wish to use SuperCollider.
Done.
 
  +
If you are uncertain, if it is worth the trouble, then listen to the examples given in the [[#Links|Links]] section.
  +
SuperCollider support requires installation of the packages <code>haskore-realtime</code> and <code>haskore-supercollider</code> in the way that is described above.
  +
  +
Step 6. To get something to listen follow the hints in the [http://code.haskell.org/haskore/revised/Readme Readme] file of the <code>haskore</code> package.
   
 
==Projects==
 
==Projects==
Line 57: Line 111:
   
 
{|
 
{|
| AuDi || Peter Steffen || [http://www.techfak.uni-bielefeld.de/ags/pi/lehre/AuDIWS02/musik/] || Course material for Algorithms and Data Structures I - A formula language for music ("Algorithmen und Datenstrukturen I - Eine Formelsprache fuer Musik")
+
| [http://www.techfak.uni-bielefeld.de/ags/pi/lehre/AuDIWS02/musik/ AuDi] || Peter Steffen || Course material for Algorithms and Data Structures I - A formula language for music ("Algorithmen und Datenstrukturen I - Eine Formelsprache fuer Musik")
 
|-
 
|-
| AutoTrack || Stefan Ratschan || [http://www.mpi-sb.mpg.de/~ratschan/autotrack/] || A tool for creating practizing and demo tracks from chord charts. You feed the program with a chord chart, set the desired style (jazz, bossa, etc.), tempo, key etc. and it produces a simple MIDI file containing an according bass and drum track. Includes a lot of examples.
+
| [http://www.mpi-sb.mpg.de/~ratschan/autotrack/ AutoTrack] || Stefan Ratschan || A tool for creating practizing and demo tracks from chord charts. You feed the program with a chord chart, set the desired style (jazz, bossa, etc.), tempo, key etc. and it produces a simple MIDI file containing an according bass and drum track. Includes a lot of examples.
 
|-
 
|-
| CAEC || Matt Munz || [http://darcs.haskell.org/haskore/related/etude] || Computer-Aided Etude Composition in Haskell
+
| [http://code.haskell.org/haskore/revised/related/etude/ CAEC] || Matt Munz || Computer-Aided Etude Composition in Haskell
 
|-
 
|-
| Design experiments || Henning Thielemann || [http://darcs.haskell.org/haskore/] || Test of several changes of Haskore's design targetting at more flexibility and consistency
+
| [http://code.haskell.org/haskore/revised/ Design experiments] || Henning Thielemann || Test of several changes of Haskore's design targetting at more flexibility and consistency
 
|-
 
|-
| Emile || Adam Bermingham || [http://www.netsoc.tcd.ie/~bermo/4ba3/report.pdf] || Eight-Bar Melody Generation in Haskell. Automatic composition based on two initial bars
+
| [http://www.netsoc.tcd.ie/~bermo/4ba3/report.pdf Emile] || Adam Bermingham || Eight-Bar Melody Generation in Haskell. Automatic composition based on two initial bars
 
|-
 
|-
| Gore || Johannes Waldmann || [http://www.imn.htwk-leipzig.de/~waldmann/] || Convert a melody description in a string into the Haskore Music data structure. Thus simple melodies can be written much more condensed.
+
| [http://www.imn.htwk-leipzig.de/~waldmann/ Gore] || Johannes Waldmann || Convert a melody description in a string into the Haskore Music data structure. Thus simple melodies can be written much more condensed.
 
|-
 
|-
| HasChorus || Martin Schwenke || [http://meltin.net/hacks/haskell/] || A set of Haskell modules written on top of Haskore to make it easier to sequence simple, repetitive music
+
| [http://meltin.net/hacks/haskell/ HasChorus] || Martin Schwenke || A set of Haskell modules written on top of Haskore to make it easier to sequence simple, repetitive music
 
|-
 
|-
| Jazkore || Jean-François Paiement || [http://www.idiap.ch/~paiement/] ? || A model of melodic jazz improvisation in functional programming
+
| [http://www.idiap.ch/~paiement/ Jazkore] || Jean-François Paiement || A model of melodic jazz improvisation in functional programming
 
|-
 
|-
| Lilypond back-end || Jeffrey R. Lewis || || A back-end for Haskore to produce Lilypond notation files.
+
| Lilypond back-end || Jeffrey R. Lewis || A back-end for Haskore to produce Lilypond notation files.
 
|-
 
|-
| Microtonal music || Magnus Jonsson || [http://www.haskell.org/pipermail/haskell-cafe/2006-September/018144.html] || This is not Haskore related, though integration into Haskore would be nice
+
| [http://www.haskell.org/pipermail/haskell-cafe/2006-September/018144.html Microtonal music] || Magnus Jonsson || This is not Haskore related, though integration into Haskore would be nice
 
|-
 
|-
| Polymorphic Temporal Media || Paul Hudak || [http://haskell.cs.yale.edu/yale/papers/polymedia/hudak-RR-1259.pdf] || An Algebraic Theory of Polymorphic Temporal Media - A generalization of Haskore Music and MDL as well as Fran and FAL animation
+
| [http://haskell.cs.yale.edu/yale/papers/polymedia/hudak-RR-1259.pdf Polymorphic Temporal Media] || Paul Hudak || An Algebraic Theory of Polymorphic Temporal Media - A generalization of Haskore Music and MDL as well as Fran and FAL animation
 
|-
 
|-
| T-shirt || Fritz Ruehr || [http://www.cafepress.com/haskore.13482964] || Haskore T-Shirt featuring the 8 laws of polymorphic temporal media
+
| [http://www.cafepress.com/haskore.13482964 T-shirt] || Fritz Ruehr || Haskore T-Shirt featuring the 8 laws of polymorphic temporal media
 
|}
 
|}
   

Revision as of 18:17, 8 June 2010

Haskore is a set of Haskell modules for creating, analysing and manipulating music. Music can be made audible through various back-ends. (See below.) A more recent, but less stable version, is available as Darcs repository at http://code.haskell.org/haskore/revised/.

Features

Example

To get an impression how intuitive music composition with Haskore is, see the following example code (runs with revised Haskore):

chords =
    (c 0 qn () =:= e 0 qn () =:= g 0 qn ()) +:+
    (c 0 qn () =:= f 0 qn () =:= a 0 qn ()) +:+
    (d 0 qn () =:= g 0 qn () =:= b 0 qn ())

song =
    MidiMusic.fromMelodyNullAttr MidiMusic.AcousticGrandPiano
       (Music.transpose (-48) (Music.changeTempo 3 chords))

The (=:=) means parallel composition and (+:+) means serial composition of musical objects.

Backends

Ideally you can compose a song once in Haskore, and then play it by several back-ends. Practically this is more difficult, since all back-ends have different functionality (otherwise there wouldn't be so many).

These back-ends are currently supported:

ToDo:

  • Notation output (Lilypond, partially done in CAEC, see below).

Community

There is no Haskore related mailing list, but Haskore related discussion is very welcome at the Haskell art mailing list.

Getting started

Platforms

The core Haskore can run on both Linux and Windows. Only various back-ends and real-time functionality are critical. So far, real-time playback and use of SuperCollider is only usable on Linux.

In future Haskore should consist of a small core for music composition, analysis and manipulation and separate packages for connecting to various back-ends and separated real-time stuff. The splitting made some progress, but is still not at its end.


Installation using cabal

(There are more detailed installation instructions here, if the following does not work)

Prerequisites: You should be able to fetch a package using Darcs and configure/build/install it using cabal.

Step 0. Since it is the most convenient way of installation, try to install as many as possible packages from Hackage using cabal-install. Not all packages are available on Hackage because of their experimental state.

 cabal install midi    # this will also install non-negative, event-list
 cabal install data-accessor
 cabal install markov-chain

Step 1. Install the remaining packages such that at the end the following packages are installed:

 non-negative, event-list, data-accessor, markov-chain, midi, haskore

If cabal-install worked, there should only haskore be left for installation.

Step 2. Choose a folder where some haskell packages can be stored.

Step 3. Get the packages. That is, for each PACKAGE call

 darcs get http://code.haskell.org/PACKAGE

or

 darcs get http://code.haskell.org/~thielema/PACKAGE

Step 4. Build and install the packages that you got by darcs. For each PACKAGE (in the order of above)

 cd PACKAGE
 runhaskell Setup.lhs configure (--prefix=/usr/local --user)
 runhaskell Setup.lhs build
 runhaskell Setup.lhs install

Step 5. On Linux you may also wish to use SuperCollider. If you are uncertain, if it is worth the trouble, then listen to the examples given in the Links section. SuperCollider support requires installation of the packages haskore-realtime and haskore-supercollider in the way that is described above.

Step 6. To get something to listen follow the hints in the Readme file of the haskore package.

Projects

A lot of projects were initiated that use the Haskore framework or something in the spirit of Haskore. This page may help to keep an overview of all projects. All maintainers of Haskore related projects are encouraged to add their project here and keep the references up to date.

AuDi Peter Steffen Course material for Algorithms and Data Structures I - A formula language for music ("Algorithmen und Datenstrukturen I - Eine Formelsprache fuer Musik")
AutoTrack Stefan Ratschan A tool for creating practizing and demo tracks from chord charts. You feed the program with a chord chart, set the desired style (jazz, bossa, etc.), tempo, key etc. and it produces a simple MIDI file containing an according bass and drum track. Includes a lot of examples.
CAEC Matt Munz Computer-Aided Etude Composition in Haskell
Design experiments Henning Thielemann Test of several changes of Haskore's design targetting at more flexibility and consistency
Emile Adam Bermingham Eight-Bar Melody Generation in Haskell. Automatic composition based on two initial bars
Gore Johannes Waldmann Convert a melody description in a string into the Haskore Music data structure. Thus simple melodies can be written much more condensed.
HasChorus Martin Schwenke A set of Haskell modules written on top of Haskore to make it easier to sequence simple, repetitive music
Jazkore Jean-François Paiement A model of melodic jazz improvisation in functional programming
Lilypond back-end Jeffrey R. Lewis A back-end for Haskore to produce Lilypond notation files.
Microtonal music Magnus Jonsson This is not Haskore related, though integration into Haskore would be nice
Polymorphic Temporal Media Paul Hudak An Algebraic Theory of Polymorphic Temporal Media - A generalization of Haskore Music and MDL as well as Fran and FAL animation
T-shirt Fritz Ruehr Haskore T-Shirt featuring the 8 laws of polymorphic temporal media

Papers

Links