<?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; list</title>
	<atom:link href="https://codehop.com/tag/list/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>List Comprehension Grain Generator</title>
		<link>https://codehop.com/list-comprehension-grain-generator/</link>
		<comments>https://codehop.com/list-comprehension-grain-generator/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 18:54:59 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[granular]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[visuals]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=148</guid>
		<description><![CDATA[This is a granular synthesizer: @[random() * 8 for i in range(1000)] foo() This generates 1000 events over the span of 8 beats, using list comprehension. The function foo() is intentionally left blank. It may produce random single-cycle waveforms, bits &#8230; <a href="https://codehop.com/list-comprehension-grain-generator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This is a granular synthesizer:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@[random() * 8 for i in range(1000)] foo()
</pre>
<p>This generates 1000 events over the span of 8 beats, using <a href="http://docs.python.org/tutorial/datastructures.html#list-comprehensions">list comprehension</a>.</p>
<p>The function foo() is intentionally left blank. It may produce random single-cycle waveforms, bits of a sample, or glowing TRON-like particles for your live performance visuals. Whatever. </p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/list-comprehension-grain-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lists as Micro-Sequencers</title>
		<link>https://codehop.com/lists-as-micro-sequencers/</link>
		<comments>https://codehop.com/lists-as-micro-sequencers/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 19:32:38 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[sequencer]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=129</guid>
		<description><![CDATA[On Friday, I listed nine ways in which python methodologies could be used with the @ scheduler. How would they work in a real-world musical context? Today, I&#8217;m showcasing the List as a super convenient micro-sequencer. When the @ scheduler &#8230; <a href="https://codehop.com/lists-as-micro-sequencers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>On Friday, I listed <a href="http://slipmat.noisepages.com/2010/04/nine-rules-for-scheduling-events/">nine ways</a> in which python methodologies could be used with the <a href="http://slipmat.noisepages.com/2010/03/coding-in-time-with-the-scheduler/">@ scheduler</a>. How would they work in a real-world musical context? Today, I&#8217;m showcasing the List as a super convenient micro-sequencer.</p>
<p>When the @ scheduler is given a list of numbers, every value in the list is used to schedule an event; This saves keystrokes and increases legibility. Let&#8217;s see this applied to a simple four-beat rock groove with 8th note hats:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@[0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5] hat()
@[1, 3]                           snare()
@[0, 2]                           kick()
</pre>
<p>That plays hat() eight times, and snare() and kick() twice each. This beats having to type out 12 events.</p>
<p>Alternatively, an identifier can point to a predefined list, thus, a sequence can be reused multiple times. The following stores a complex hi-hat pattern in identifier p, and then plays it four times:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
p = [0, 0.5, 1, 1.5, 2, 2.25, 2.5, 2.75, 3, 3.75]

@0  @p hat()
@4  @p hat()
@8  @p hat()
@12 @p hat()
</pre>
<p>Here&#8217;s the shorthand equivalent:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
p = [0, 0.5, 1, 1.5, 2, 2.25, 2.5, 2.75, 3, 3.75]

@[0, 4, 8, 12] @p hat()
</pre>
<p>That&#8217;s 40 events in two lines of code, with improved legibility. If this was presented as 40 individual events, it would not be obvious that the same hat pattern is repeated four times.</p>
<p><strong>Banks of Patterns</strong></p>
<p>A list can be utilized as a bank of patterns, a list of lists. In the following example, an empty bank is created, filled with three patterns, and then used in a four measure sequence.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
b = []
b.append([0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5])               # x.x. x.x. x.x. x.x.
b.append([0, 0.5, 1, 1.5, 2, 2.25, 2.5, 2.75, 3, 3.75])  # x.x. x.x. xxxx x..x
b.append([0, 0.5, 1, 1.5, 2, 2.5, 2.75, 3, 3.5, 3.75])   # x.x. x.x. x.xx x.xx

@0  @b[0] hat()
@4  @b[1] hat()
@8  @b[0] hat()
@12 @b[2] hat()
</pre>
<p><strong>Bonus Round &#8212; Eight Ways to Notate 8th Note Hats</strong></p>
<p>Some good, some bad, some ugly. All produce the same result.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
1. @map(lambda x: x / 2.0, range(0, 8)) hat()
2. @[0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5] hat()
3. @[i / 2.0 for i in range(0, 8)] hat()
4. @[i / 2.0 for i in range(8)] hat()
5. @[0, 2] @[0, 1] @[0, 0.5] hat()
6. @[0, 1, 2, 3] @[0, 0.5] hat()
7. @range(0, 4) @[0, 0.5] hat()
8. @range(4) @[0, 0.5] hat()
</pre>
<p>Examples 2, 6 and 8 are my personal favorites.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/lists-as-micro-sequencers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
