<?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; range</title>
	<atom:link href="https://codehop.com/tag/range/feed/" rel="self" type="application/rss+xml" />
	<link>https://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>Functions as Reusable Score Clips</title>
		<link>https://codehop.com/functions-as-reusable-score-clips/</link>
		<comments>https://codehop.com/functions-as-reusable-score-clips/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 16:05:06 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[clip]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[score]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=158</guid>
		<description><![CDATA[I&#8217;m not a fan of the copy and paste method for composing computer music scores. I&#8217;d rather write something once, and reuse it as needed. Slipmat uses function definitions as one method for creating reusable score clips. The following function &#8230; <a href="https://codehop.com/functions-as-reusable-score-clips/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m not a fan of the copy and paste method for composing computer music scores. I&#8217;d rather write something once, and reuse it as needed. Slipmat uses function definitions as one method for creating reusable score clips.</p>
<p>The following function rock_drums() stores a simple rock drum pattern with 8th note hats:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def rock_drums():
    @[0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5] hat()
    @[1, 3]                           snare()
    @[0, 2]                           kick()
</pre>
<p>Here, the rock_drum() clip is played 4 times:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0  rock_drums()
@4  rock_drums()
@8  rock_drums()
@12 rock_drums()
</pre>
<p>Here are 16 bars using the <a href="http://slipmat.noisepages.com/2010/04/auto-generating-lists/">range() shorthand method</a>:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@range(0, 64, 4) rock_drums()
</pre>
<p>Using functions as clips can save time and keystrokes while greatly improving legibility. The easier your code is to read, the more likely others will remix your work. If they can&#8217;t make heads or tails out of it, they&#8217;re more likely to move on.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/functions-as-reusable-score-clips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto-Generating Lists</title>
		<link>https://codehop.com/auto-generating-lists/</link>
		<comments>https://codehop.com/auto-generating-lists/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 12:57:28 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[goa]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[range]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=137</guid>
		<description><![CDATA[In yesterday&#8217;s blog, Lists as Micro-Sequencers, we discussed writing lists instead of individual events. Today, we&#8217;ll generate lists instead of writing list values. Python comes with the built-in range() function that generates and returns a list of integers, which can &#8230; <a href="https://codehop.com/auto-generating-lists/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In yesterday&#8217;s blog, <a href="http://slipmat.noisepages.com/2010/04/lists-as-micro-sequencers/">Lists as Micro-Sequencers</a>, we discussed writing lists instead of individual events. Today, we&#8217;ll generate lists instead of writing list values.</p>
<p>Python comes with the built-in <a href="http://docs.python.org/library/functions.html#range">range()</a> function that generates and returns a list of integers, which can be used to schedule events. The following python interpreter session demos range() with three sets of args along with their respective outputs.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
>>> range(4)
[0, 1, 2, 3]
>>> range(5, 9)
[5, 6, 7, 8]
>>> range(0, 16, 4)
[0, 4, 8, 12]
</pre>
<p>The range() function can be a huge saver of time and keystrokes. Especially if you&#8217;re composing <a href="http://en.wikipedia.org/wiki/Goa_trance">goa trance</a>:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@range(1024) goa_kick()
</pre>
<p><em>&#8220;The kicks are done, man.&#8221;</em> Just to be absolutely clear, that generates 1024 goa_kick() events, one per beat.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/auto-generating-lists/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
