<?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>codehop &#187; notation</title>
	<atom:link href="http://codehop.com/tag/notation/feed/" rel="self" type="application/rss+xml" />
	<link>http://codehop.com</link>
	<description>#code #art #music</description>
	<lastBuildDate>Mon, 23 Apr 2012 18:37:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>x Trigger Notation</title>
		<link>http://codehop.com/x-trigger-notation/</link>
		<comments>http://codehop.com/x-trigger-notation/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 15:10:59 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[docstring]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[notation]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=166</guid>
		<description><![CDATA[In Roll You Own Syntax, I theorized how users could construct their own systems of notation using strings. I&#8217;ve constructed a working function, called trig(), to show how it&#8217;s done. First, let&#8217;s see trig() in action. The following is complete &#8230; <a href="http://codehop.com/x-trigger-notation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In <a href="http://slipmat.noisepages.com/2010/04/roll-your-own-score-syntax/">Roll You Own Syntax</a>, I theorized how users could construct their own systems of notation using strings. I&#8217;ve constructed a working function, called trig(), to show how it&#8217;s done.</p>
<p>First, let&#8217;s see trig() in action. The following is complete conceptual prototype Slipmat program that generates a rock drum groove with 8th note hats:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
#!/usr/bin/env slipmat

from JakeLib.Generators import trig
from EasyKit import hat, snare, kick
    
@trig('x.x. x.x. x.x. x.x.') hat()
@trig('.... x... .... x...') snare()
@trig('x... .... x... ....') kick()
</pre>
<p>This horizontal system for notating triggers, and others like it, can greatly improve the legibility of a piece, while catering to a composer&#8217;s preferred style of working. A composer quickly scans this and comprehends it without having to reconstruct it in their head from a list of individual events:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0    hat()
@0    kick()
@0.5  hat()
@1    hat()
@1    snare()
@1.5  hat()
@2    hat()
@2    kick()
@2.5  hat()
@3    hat()
@3    snare()
@3.5  hat()
</pre>
<p>The form is lost in translation.</p>
<p>Building the function is pretty straight forward if you&#8217;re somewhat experienced with Python. I put together the following function definition, with <a href="http://slipmat.noisepages.com/2010/03/on-the-importance-of-docstrings/">docstrings</a>, in roughly 15 minutes:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def trig(seq, res=0.25):
    '''
    Creates a numeric sequence from a string and returns a list.

    Description:
    A string trigger sequencer, where an 'x' creates a trigger, and a
    '.' creates a rest. All other glyphs are ignored. The resolution
    of triggers and rests are determined by the argument res.

    Input:
    seq -- A string containing a sequence of 'x' triggers and '.' rests
    res -- Resolution of note triggers and rests
        
    Output:
    return -- A numeric list
    '''    
    
    L = []  # The return list
    p = 0   # Position in sequence

    for c in seq:
        if c == 'x':
            L.append(p * res)
            p += 1            
        elif c == '.':
            p += 1

    return L
</pre>
<p>The trig() function accepts a string formatted in what I call &#8216;x trigger notation.&#8217; The function parses the string and <a href="http://slipmat.noisepages.com/2010/04/auto-generating-lists/">auto-generates a list</a> of numbers representing trigger times. A trigger is denoted by an &#8216;x&#8217;, while a rest is a &#8216;.&#8217;. All other glyphs are ignored. I use a single space between beats for clarity. The default resolution is a 16th note, though trig() accepts an optional argument for changing the resolution, increasing its usefulness.</p>
<p><strong>Import, Reuse, Remix</strong></p>
<p>The best part about custom functions is that they can be reused multiple times in multiple programs by multiple people with the use of the <a href="http://slipmat.noisepages.com/2010/03/importing-modules-and-reusing-code/">import</a>. No refactoring of code, no copy and paste, no reinventing of the wheel. Just import, reuse, remix.</p>
]]></content:encoded>
			<wfw:commentRss>http://codehop.com/x-trigger-notation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roll Your Own Score Syntax</title>
		<link>http://codehop.com/roll-your-own-score-syntax/</link>
		<comments>http://codehop.com/roll-your-own-score-syntax/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 23:54:13 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[csound]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[notation]]></category>
		<category><![CDATA[score]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=73</guid>
		<description><![CDATA[A music language that comes with a fully-loaded set of string capabilities, including regular expressions, would allow users to develop their own methods for notating music. For example, here is a horizontal representation for rhythm guitar. @0 strum('C', '/... /... &#8230; <a href="http://codehop.com/roll-your-own-score-syntax/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>A music language that comes with a fully-loaded set of string capabilities, including regular expressions, would allow users to develop their own methods for notating music. For example, here is a horizontal representation for rhythm guitar.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0  strum('C',  '/... /... /./. /...')
@4  strum('Dm', '/... /... //// /./.')
@8  strum('G7', '/... /... ///. ../.')
@12 strum('C',  '/... /... /... ///.')
</pre>
<p>The slash triggers an event and advances time by a 16th note. The dot just advances time by a 16th note. A space does nothing.</p>
<p>These 4 lines of code represent 24 events. Not only does this shorten the score and save keystrokes, but is far more readable than if each individual event was explicitly written. In fact, I bet there are many guitar players out there that could play this as it&#8217;s written, providing he or she was given a brief explanation about the notation.</p>
<p>What about a system for triggering drums? Here&#8217;s the all-to-familiar 4-beat rock pattern with 8th note hats.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
trigger(hat(),   'x.x. x.x. x.x. x.x.')
trigger(snare(), '.... x... .... x...')
trigger(kick(),  'x... .... x... ....')
</pre>
<p>Once again, the music is notated horizontally. Instead of 12 lines of code, there are only 3. Let&#8217;s take a look at the vertical equivalent:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0   hat()
@0   kick()
@0.5 hat()
@1   hat()
@1   snare()
@1.5 hat()
@2   hat()
@2   kick()
@2.5 hat()
@3   hat()
@3   snare()
@3.5 hat()
</pre>
<p>In theory, people could write slipmat modules that mimic other text-based notation systems, such as the Csound score language.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
import CsoundScore as CS
from MyLibrary import bassFM
from MyLibrary import pad

# For mapping slipmat instruments to a Csound-styled score
instrs = {"i1": bassFM(), "i2": pad()}

# A Csound-styled score
score = '''
i 1 0 2 0.5 7.00
i 1 + . .   6.05

i 2 0 8 0.333 8.09 0.77 1000
'''

CS.playScore(instrs, score)  # Play Csound-styled score
</pre>
<p>That would translate to:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0 bassFM(2, 0.5, 7.00)
@2 bassFM(2, 0.5, 6.05)
@0 pad(8, 0.333, 8.09, 0.77, 1000)
</pre>
<p>Much of this can be done with some of the existing music languages out in the wild. The guitar strum and drum trigger examples can be accomplished in pure Csound code (see <a href="http://www.csounds.com/journal/issue8/dseq.html">dseq &#8212; A Drum Machine Micro-Language</a>). Even more so, Csound combined with the Python API can do some truly amazing things along these lines. Though it probably wouldn&#8217;t be nearly as fluid as a language that had this in mind when being designed from the ground up.</p>
<p>If you haven&#8217;t done so yet, take a moment to ponder the possibilities. And be sure to think about the things others will dream up that can be simply imported into your own compositions/synthesizers/sequencers/etc&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://codehop.com/roll-your-own-score-syntax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
