<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>El Tramo | Haskell</title>
  <subtitle>Remko Tronçon's Homepage</subtitle>
  <link href="http://el-tramo.be/blog/tag/haskell/feed/" rel="self" type="application/rss+xml"/>
  <link href="http://el-tramo.be/"/>
  <updated>2012-05-19T12:29:42+02:00</updated>
  <id>http://el-tramo.be/</id>
  <author>
    <name>Remko Tronçon</name>
    <uri>http://el-tramo.be/about/</uri>
  </author>
  
  <entry>
    <title>Basic Music Theory in Haskell</title>
    <author>
      <name>Remko Tronçon</name>
      <uri>http://el-tramo.be/about/</uri>
    </author>
    <link href="http://el-tramo.be/blog/basic-music-theory-in-haskell"/>
    <updated>2008-06-19T00:00:00+02:00</updated>
    <id>http://el-tramo.be/blog/basic-music-theory-in-haskell</id>
    <content type="html">&lt;p&gt;While doing some spring cleaning around my hard disk, I found a &lt;a href=&quot;/git/haskell/tree/MusicTheoryBasics.hs&quot;&gt;little Haskell program&lt;/a&gt; I wrote several years ago in an attempt to learn the basics of music theory. Now, I&amp;rsquo;m not a pro at writing Haskell, and I know even less about music theory, but I&amp;rsquo;m hoping that what I wrote down back then is a bit accurate. The program seems to summarize the basics quite consisely: by just having a glance at the program, I&amp;rsquo;m rediscovering some things I totally forgot about scales and chords.&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;For example, this is what it says about the &lt;em&gt;sus4&lt;/em&gt; chord:&lt;/p&gt;

&lt;blockquote&gt;chordNotes Five = [(ScaleNote Major 1), (ScaleNote Major 5)]
chordNotes Sus4 = (chordNotes Five) ++ [(ScaleNote Major 4)]&lt;/blockquote&gt;


&lt;p&gt;So, &lt;em&gt;sus4&lt;/em&gt; is a power (&lt;em&gt;5&lt;/em&gt;) chord (consisting of the first and the fifth of the major scale), added with the 4th note of the major scale. So, for &lt;em&gt;Esus4&lt;/em&gt;, the program tells me:&lt;/p&gt;

&lt;blockquote&gt;Main&amp;gt; scale2notes $ Scale (read &quot;E&quot;) Major
[E,F#,G#,A,B,C#,D#]
&lt;div&gt;Main&amp;gt; chord2notes $ Chord (read &quot;E&quot;) Sus4&lt;/div&gt;
&lt;div&gt;[E,A,B]&lt;/div&gt;&lt;/blockquote&gt;


&lt;p&gt;Something else I forgot is:&lt;/p&gt;

&lt;blockquote&gt;intervals Ionian = [2,2,1,2,2,2,1]
intervals Major = Ionian
intervals scale = shift (intervals Ionian) (rank scale)
where rank ...&lt;/blockquote&gt;


&lt;p&gt;So, every scale is really a shift of the major (well, any) scale, which is actually called the Ionian scale.&lt;/p&gt;

&lt;p&gt;This program might come in handy as a summary of music theory in case I forget these things again :)&lt;/p&gt;
</content>
  </entry>
  
</feed>

