Skip to content

Commit

Permalink
update to 0.0.4, released first gem version
Browse files Browse the repository at this point in the history
  • Loading branch information
sausheong committed Mar 11, 2012
1 parent d7b8457 commit 395db23
Show file tree
Hide file tree
Showing 20 changed files with 405 additions and 110 deletions.
Binary file added KV331_3_RondoAllaTurca-a4.pdf
Binary file not shown.
71 changes: 40 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Muse is a Ruby DSL for making music. Unlike MIDI, which is a specification for m

WARNING: This is pre-alpha software where bugs abound and snap and gnash at every mistake you make. Use at your own risk!

Just to push the point that this is pre-alpha software, I haven't created the Muse gem yet, and I don't have any version number for Muse yet either. I crunched this out amidst other work in bits and pieces in slightly over a week. If you are keen on music and Ruby, and would like to help out, I'm more than glad to accept more developers! Or musicians. Or both.
If you are keen on music and Ruby, and would like to help out, I'm more than glad to accept more developers! Or musicians. Or both.

## The idea

Expand All @@ -16,13 +16,13 @@ Yes, I know the examples in my songs folder are all existing songs.

## Installing

You need to install [bindata](http://bindata.rubyforge.org) first.
To use Muse, install the gem.

gem install bindata
gem install muse

To use Muse, download the files, write your songs in the songs folder with:
Then write your songs, requiring the library in your song.

require '../muse'
require 'muse'

## Using Muse

Expand Down Expand Up @@ -81,6 +81,9 @@ There are 3 options you can use in a note.
* volume - (v) This is how loud the note should be. The default is 10.
* ADSR - (a) This indicates how the note should sound. The default ADSR is a cosine wave (check the code please).

Use this keyboard as a reference when writing music.

[Keyboard reference](keyboard-piano-notes.png)

## Keeping time

Expand Down Expand Up @@ -120,36 +123,42 @@ Which represents the C major, D7 and F minor chords accordingly. Chords, just li

For examples look into the songs folder. This is an example of the first 9 bars of Alla Turca by Mozart.

require '../muse'
Here's the original music score, public domain from the [Mutopia Project](http://www.mutopiaproject.org/cgibin/make-table.cgi?searchingfor=rondo+alla+turca).

[First 9 bars of Alla Turca](turkish_march.png)

require "muse"
include Muse

# Mozart's Piano Sonata No. 11 3rd Movement (All Turca)
# more popularly known as the 'Turkish March' or 'Turkish Rondo'
# first 9 bars only

Song.record 'turkish_march' do
bar(1,b:0.25).notes {b4; a4; gis3; a4;}

bar(2,b:0.25).notes {c4 b:0.5; _ b:0.5; d4; c4; b4; c4;}
bar(2,b:0.5).notes {a3; c3_e3; c3_e3; c3_e3;}

bar(3,b:0.25).notes {e4 b:0.5; _ b:0.5; f4; e4; dis4; e4;}
bar(3,b:0.5).notes {a3; c3_e3; c3_e3; c3_e3;}

bar(4,b:0.25).notes {b5; a5; gis4; a5; b5; a5; gis4; a5;}
bar(4,b:0.5).notes {a3; c3_e3; a3; c3_e3;}
bar(5,b:0.5).notes {c5 b:1; a5; c5;}
bar(5,b:0.5).notes {a3; c3_e3; c3_e3; c3_e3;}
bar(6,b:0.5).notes {b5; fis4_a4; e4_g4; fis4_a4; }
bar(6,b:0.5).notes {a3; b3_e3; b3_e3; b3_e3;}
bar(7,b:0.5).notes {b5; fis4_a4; e4_g4; fis4_a4; }
bar(7,b:0.5).notes {a3; b3_e3; b3_e3; b3_e3;}
bar(8,b:0.5).notes {b5; fis4_a4; e4_g4; dis4_eis4; }
bar(8,b:0.5).notes {a3; b3_e3; b; b4;}
bar(9).notes {e4}
bar(9).notes {e3}
bar(1,b:0.25).notes {b4; a4; gis4; a4;}

bar(2,b:0.25).notes {c5 b:0.5; _ b:0.5; d5; c5; b4; c5;}
bar(2,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;}

bar(3,b:0.25).notes {e5 b:0.5; _ b:0.5; f5; e5; dis5; e5;}
bar(3,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;}

bar(4,b:0.25).notes {b5; a5; gis5; a5; b5; a5; gis5; a5;}
bar(4,b:0.5).notes {a3; c4_e4; a3; c4_e4;}

bar(5,b:0.5).notes {c6 b:1; a5; c6;}
bar(5,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;}

bar(6,b:0.5).notes {b5; fis5_a5; e5_g5; fis5_a5; }
bar(6,b:0.5).notes {a3; b4_e4; b4_e4; b4_e4;}

bar(7,b:0.5).notes {b5; fis5_a5; e5_g5; fis5_a5; }
bar(7,b:0.5).notes {a3; b4_e4; b4_e4; b4_e4;}

bar(8,b:0.5).notes {b5; fis5_a5; e5_g5; dis5_eis5; }
bar(8,b:0.5).notes {a3; b4_e4; b2; b4;}

bar(9).notes {e5}
bar(9).notes {e4}
end

Binary file added keyboard-piano-notes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions lib/muse.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "#{File.dirname(__FILE__)}/muse/wav"
require "#{File.dirname(__FILE__)}/muse/config"
require "muse/wav"
require "muse/config"

module Muse
class Song
Expand All @@ -21,16 +21,16 @@ class Bar

NOTES = %w(_ a ais b c cis d dis e f fis g gis)
FREQUENCIES = {
:a2 => -24, :ais2 => -23, :b2 => -22, :c2 => -21, :cis2 => -20,
:d2 => -19, :dis2 => -18, :e2 => -17, :f2 => -16, :fis2 => -15,
:g2 => -14, :gis2 => -13, :a3 => -12, :ais3 => -11, :b3 => -10,
:c3 => -9, :cis3 => -8, :d3 => -7, :dis3 => -6, :e3 => -5,
:f3 => -4, :fis3 => -3, :g3 => -2, :gis3 => -1, :a4 => 0,
:ais4 => 1, :b4 => 2, :c4 => 3, :cis4 => 4, :d4 => 5,
:dis4 => 6, :e4 => 7, :f4 => 8, :fis4 => 9, :g4 => 10,
:gis4 => 11, :a5 => 12, :ais5 => 13, :b5 => 14, :c5 => 15,
:cis5 => 16, :d5 => 17, :dis5 => 18, :e5 => 19, :f5 => 20,
:fis5 => 21, :g5 => 22, :gis5 => 23
:a2 => -24, :ais2 => -23, :b2 => -22, :c3 => -21, :cis3 => -20,
:d3 => -19, :dis3 => -18, :e3 => -17, :f3 => -16, :fis3 => -15,
:g3 => -14, :gis3 => -13, :a3 => -12, :ais3 => -11, :b3 => -10,
:c4 => -9, :cis4 => -8, :d4 => -7, :dis4 => -6, :e4 => -5,
:f4 => -4, :fis4 => -3, :g4 => -2, :gis4 => -1, :a4 => 0,
:ais4 => 1, :b4 => 2, :c5 => 3, :cis5 => 4, :d5 => 5,
:dis5 => 6, :e5 => 7, :f5 => 8, :fis5 => 9, :g5 => 10,
:gis5 => 11, :a5 => 12, :ais5 => 13, :b5 => 14, :c6 => 15,
:cis6 => 16, :d6 => 17, :dis6 => 18, :e6 => 19, :f6 => 20,
:fis6 => 21, :g6 => 22, :gis6 => 23
}

def initialize(id, options={})
Expand Down
52 changes: 52 additions & 0 deletions lib/muse/config/adsr_rb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

<title>File: adsr.rb [muse-0.0.4 Documentation]</title>

<link type="text/css" media="screen" href="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/rdoc.css" rel="stylesheet" />

<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>

<body class="file file-popup">
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
<dd class="modified-date">2012-03-11 00:32:31 +0800</dd>


<dt class="requires">Requires</dt>
<dd class="requires">
<ul>

</ul>
</dd>



</dl>
</div>

<div id="documentation">

<div class="description">
<h2>Description</h2>

</div>

</div>
</body>
</html>

52 changes: 52 additions & 0 deletions lib/muse/config/chords_rb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

<title>File: chords.rb [muse-0.0.4 Documentation]</title>

<link type="text/css" media="screen" href="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/rdoc.css" rel="stylesheet" />

<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>

<body class="file file-popup">
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
<dd class="modified-date">2012-03-11 00:32:31 +0800</dd>


<dt class="requires">Requires</dt>
<dd class="requires">
<ul>

</ul>
</dd>



</dl>
</div>

<div id="documentation">

<div class="description">
<h2>Description</h2>

</div>

</div>
</body>
</html>

52 changes: 52 additions & 0 deletions lib/muse/config_rb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

<title>File: config.rb [muse-0.0.4 Documentation]</title>

<link type="text/css" media="screen" href="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/rdoc.css" rel="stylesheet" />

<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>

<body class="file file-popup">
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
<dd class="modified-date">2012-03-11 00:32:31 +0800</dd>


<dt class="requires">Requires</dt>
<dd class="requires">
<ul>

</ul>
</dd>



</dl>
</div>

<div id="documentation">

<div class="description">
<h2>Description</h2>

</div>

</div>
</body>
</html>

2 changes: 1 addition & 1 deletion lib/muse/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Muse
VERSION = "0.0.1"
VERSION = "0.0.4"
end
52 changes: 52 additions & 0 deletions lib/muse/version_rb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

<title>File: version.rb [muse-0.0.4 Documentation]</title>

<link type="text/css" media="screen" href="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/rdoc.css" rel="stylesheet" />

<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../../../.rvm/gems/ruby-1.9.2-p290/doc/muse-0.0.4/rdoc/js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>

<body class="file file-popup">
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
<dd class="modified-date">2012-03-11 14:43:33 +0800</dd>


<dt class="requires">Requires</dt>
<dd class="requires">
<ul>

</ul>
</dd>



</dl>
</div>

<div id="documentation">

<div class="description">
<h2>Description</h2>

</div>

</div>
</body>
</html>

Loading

0 comments on commit 395db23

Please sign in to comment.