<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>X-Combinator &#187; music</title>
	<atom:link href="http://www.xcombinator.com/category/music/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xcombinator.com</link>
	<description>making the human scalable</description>
	<lastBuildDate>Thu, 09 Sep 2010 03:46:53 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Interval &#8211; a ruby library for musical interval arithmetic</title>
		<link>http://www.xcombinator.com/2009/11/17/interval-a-ruby-library-for-musical-interval-arithmetic/</link>
		<comments>http://www.xcombinator.com/2009/11/17/interval-a-ruby-library-for-musical-interval-arithmetic/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 16:43:45 +0000</pubDate>
		<dc:creator>Nate Murray</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.xcombinator.com/?p=144</guid>
		<description><![CDATA[Interval
interval is a tiny library that provides simple musical note pitch and interval arithmetic. It is intended to do one thing: given a pitch add (or subtract) an interval and give the resulting pitch.
Observe:

p = Interval::Pitch.from_string&#40;&#34;c&#34;&#41;
i = Interval::Interval.from_string&#40;&#34;M3&#34;&#41;
p2 = p + i
p2.to_short_name # =&#62; &#34;e&#34;
&#160;
i.to_s # =&#62; &#34;Major Third&#34;
&#160;
i2 = Interval::Interval.from_string&#40;&#34;p5&#34;&#41;
i2.to_s # =&#62; &#34;Perfect Fifth&#34;
&#160;
&#40;p2 [...]]]></description>
			<content:encoded><![CDATA[<h1>Interval</h1>
<p><code>interval</code> is a tiny library that provides simple musical note pitch and interval arithmetic. It is intended to do one thing: given a pitch add (or subtract) an interval and give the resulting pitch.</p>
<p>Observe:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">p</span> = <span style="color:#6666ff; font-weight:bold;">Interval::Pitch</span>.<span style="color:#9900CC;">from_string</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;c&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
i = <span style="color:#6666ff; font-weight:bold;">Interval::Interval</span>.<span style="color:#9900CC;">from_string</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;M3&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
p2 = <span style="color:#CC0066; font-weight:bold;">p</span> <span style="color:#006600; font-weight:bold;">+</span> i
p2.<span style="color:#9900CC;">to_short_name</span> <span style="color:#008000; font-style:italic;"># =&gt; &quot;e&quot;</span>
&nbsp;
i.<span style="color:#9900CC;">to_s</span> <span style="color:#008000; font-style:italic;"># =&gt; &quot;Major Third&quot;</span>
&nbsp;
i2 = <span style="color:#6666ff; font-weight:bold;">Interval::Interval</span>.<span style="color:#9900CC;">from_string</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;p5&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
i2.<span style="color:#9900CC;">to_s</span> <span style="color:#008000; font-style:italic;"># =&gt; &quot;Perfect Fifth&quot;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#40;</span>p2 <span style="color:#006600; font-weight:bold;">-</span> i2<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">to_s</span> <span style="color:#008000; font-style:italic;"># =&gt; &quot;a&quot;</span></pre></div></div>

<h1>Interval Quiz</h1>
<p><code>interval</code> was written primarily for learning intervals. <code>interval-quiz</code> is a gem that depends on <code>interval</code> that provides a command-line quiz. Here&#8217;s the output of an <code>interval-quiz</code> session:</p>
<pre><code>$ interval-quiz
Here are the intervals:
unison  p1        a1
second  m2 M2  d2 a2
third   m3 M3  d3 a3
fourth  p4     d4 a4
fifth   d5 p5  d5 a5
sixth   m6 M6  d6 a6
seventh m7 M7  d7 a7
octave  p8     d8
enter the intervals you want (or a blank line to quit):
M3
p5

["M3", "p5"]
1. above
2. below
3. both
do you want to be quizzed on intervals above, below, or both?  3
what is a major third below f# ? d
correct!
what is a major third above g# 1/1 (100%)? b#
correct!
what is a major third below b 2/2 (100%)? g
correct!
what is a perfect fifth below eb 3/3 (100%)? a
wrong. the answer is ab
what is a perfect fifth below c# 3/4 (75%)? d
wrong. the answer is f#
</code></pre>
<h1>Installing</h1>
<pre><code>gem install interval interval-quiz
</code></pre>
<h1>Source</h1>
<p><a href="http://github.com/jashmenn/interval">http://github.com/jashmenn/interval</a><br />
<a href="http://github.com/jashmenn/interval-quiz">http://github.com/jashmenn/interval-quiz</a></p>
<p>Share:</p>
<p>	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F&amp;title=Interval%20-%20a%20ruby%20library%20for%20musical%20interval%20arithmetic&amp;notes=Interval%0D%0A%0D%0Ainterval%20is%20a%20tiny%20library%20that%20provides%20simple%20musical%20note%20pitch%20and%20interval%20arithmetic.%20It%20is%20intended%20to%20do%20one%20thing%3A%20given%20a%20pitch%20add%20%28or%20subtract%29%20an%20interval%20and%20give%20the%20resulting%20pitch.%0D%0A%0D%0AObserve%3A%0D%0A%0D%0Ap%20%3D%20Interval%3A%3APitch.from_" title="del.icio.us"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F&amp;title=Interval%20-%20a%20ruby%20library%20for%20musical%20interval%20arithmetic" title="Reddit"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F" title="Technorati"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://twitter.com/home?status=Interval%20-%20a%20ruby%20library%20for%20musical%20interval%20arithmetic%20-%20http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F" title="Twitter"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F&amp;t=Interval%20-%20a%20ruby%20library%20for%20musical%20interval%20arithmetic" title="Facebook"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F&amp;title=Interval%20-%20a%20ruby%20library%20for%20musical%20interval%20arithmetic&amp;annotation=Interval%0D%0A%0D%0Ainterval%20is%20a%20tiny%20library%20that%20provides%20simple%20musical%20note%20pitch%20and%20interval%20arithmetic.%20It%20is%20intended%20to%20do%20one%20thing%3A%20given%20a%20pitch%20add%20%28or%20subtract%29%20an%20interval%20and%20give%20the%20resulting%20pitch.%0D%0A%0D%0AObserve%3A%0D%0A%0D%0Ap%20%3D%20Interval%3A%3APitch.from_" title="Google Bookmarks"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F&amp;t=Interval%20-%20a%20ruby%20library%20for%20musical%20interval%20arithmetic" title="HackerNews"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.xcombinator.com%2F2009%2F11%2F17%2Finterval-a-ruby-library-for-musical-interval-arithmetic%2F&amp;partner=sociable" title="PDF"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a><br />
	<a rel="nofollow"  href="http://www.xcombinator.com/feed/" title="RSS"><img src="http://www.xcombinator.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></p>
<p><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xcombinator.com/2009/11/17/interval-a-ruby-library-for-musical-interval-arithmetic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.511 seconds -->
