<?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; scheduler</title>
	<atom:link href="https://codehop.com/tag/scheduler/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>Score Events</title>
		<link>https://codehop.com/score-events/</link>
		<comments>https://codehop.com/score-events/#comments</comments>
		<pubDate>Mon, 03 May 2010 15:20:45 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[instrument]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[score]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=230</guid>
		<description><![CDATA[No computer music system is complete without the ability to place notes into a score/timeline. Read and download today&#8217;s script here. The mechanisms that schedule score events and print the results are still a bit wonky. So I&#8217;m going to &#8230; <a href="https://codehop.com/score-events/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>No computer music system is complete without the ability to place notes into a score/timeline. Read and download today&#8217;s script <a href="http://snipt.org/Muj">here</a>.</p>
<p>The mechanisms that schedule score events and print the results are still a bit wonky. So I&#8217;m going to omit the explanation for now, and instead just focus on how they&#8217;re used. The following is the __main__ from the script:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
if __name__ == "__main__":
    @Instr
    def RingTine(dur, amp, freq_1, freq_2):
        return Sine(amp, freq_1) * Sine(amp, freq_2) * RiseFall(dur, 0)

    s = ScoreEvents()
    s.event(0, 0.25, RingTine(0.25, 1, 440, 44))
    s.event(0.5, 0.125, RingTine(0.125, 0.333, 262, 44))
    s.event(0.75, 0.25, RingTine(0.25, 0.25, 262, 44))
    s.event(0.75, 0.25, RingTine(0.25, 0.5, 440, 44))
    for frame in PrintSamples(s): pass
</pre>
<p>The first part of __main__ defines an instrument called RingTine that generates a percussive ring-modulated timbre. At least in theory; Still no sound output.</p>
<p>The next step creates a ScoreEvents() object. This is where events are scheduled. This is followed by 4 lines of code that schedule events for @Instr RingTine with the ScoreEvents class method event(). The method takes three arguments:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
ScoreEvents.event(start_time, duration, UnitGenerator(*args))
</pre>
<p>The very last line prints the samples generates by the score with the PrintSamples() iterator. The implementation is seriously lame at the moment, but is perfectly acceptable for a crude prototype.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/score-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Slipcue</title>
		<link>https://codehop.com/the-slipcue/</link>
		<comments>https://codehop.com/the-slipcue/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 16:19:42 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[slipcue]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=152</guid>
		<description><![CDATA[The Slipcue (@) is the object responsible for the fourth dimension of a Slipmat program: time. The name is derived from the term Slip-cueing, which Wikipedia defines as, &#8220;a turntable-based DJ technique that consists of holding a record still while &#8230; <a href="https://codehop.com/the-slipcue/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The Slipcue (@) is the object responsible for the fourth dimension of a Slipmat program: time.</p>
<p>The name is derived from the term <a href="http://en.wikipedia.org/wiki/Slip-cueing">Slip-cueing</a>, which Wikipedia defines as, <em>&#8220;a turntable-based DJ technique that consists of holding a record still while the platter rotates underneath the slipmat and releasing it at the right moment.&#8221;</em></p>
<p>The Slipcue is formally known as the <a href="http://slipmat.noisepages.com/2010/03/coding-in-time-with-the-scheduler/">@ scheduler</a>. There are various reasons for the name change. I&#8217;ve only shown the Slipcue as a simple mechanism for scheduling tasks, though it controls so much more:</p>
<ul style="padding-bottom: 16px">
<li>Syncing other Slipmat processes, ticks, threads and shreds</li>
<li>Starting, Stoping, Pausing, fast forwarding, rewinding</li>
<li>The Master Clock (or Mistress Clock)</li>
<li>Task Management</li>
<li>Units of Time</li>
<li>Tempo</li>
<li>etc</li>
</ul>
<p>Plus, &#8220;the Slipcue&#8221; rolls off the tongue rather well.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/the-slipcue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Custom Sequence List Generators</title>
		<link>https://codehop.com/custom-sequence-list-generators/</link>
		<comments>https://codehop.com/custom-sequence-list-generators/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 16:50:27 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[docstring]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scheduler]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=142</guid>
		<description><![CDATA[Python&#8217;s built-in range() list generator is full of possibilities when used in conjunction with Slipmat&#8217;s @ scheduler. And that&#8217;s just one generator out of, dare I say, a million possibilities. Imagine being able to conveniently import generators from a massive &#8230; <a href="https://codehop.com/custom-sequence-list-generators/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Python&#8217;s built-in <a href="http://slipmat.noisepages.com/2010/04/auto-generating-lists/">range() list generator</a> is full of possibilities when used in conjunction with Slipmat&#8217;s <a href="http://slipmat.noisepages.com/2010/03/coding-in-time-with-the-scheduler/">@ scheduler</a>. And that&#8217;s just one generator out of, dare I say, a million possibilities.</p>
<p>Imagine being able to conveniently import generators from a massive user library of modules. This will be a reality for Slipmat for two reasons:</p>
<ul style="padding-bottom: 16px">
<li>Users can easily write their own generators</li>
<li>Users can easily <a href="http://slipmat.noisepages.com/2010/03/importing-modules-and-reusing-code/">share, import and remix</a> generators</li>
</ul>
<p>I built a list generator called range_plus(), which takes Python&#8217;s range() function a few steps farther. range() is limited to integers; range_plus() removes this restriction and allows for floats. range() supports a single increment step value; range_plus() additionally allows users to pass a list of increment step values that are chosen at random.</p>
<p>Here&#8217;s the working Python defintion for range_plus():</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def range_plus(start, stop, random_steps=1):
    '''
    Returns a list of successive incremented values
    chosen randomly from a list.

    Input:
    start -- Starting value
    stop --  End point
    random_steps -- A list of incremental values chosen at random or a
        single numeric value
        
    Output:
    return -- A numeric list
    '''
    
    if stop < start:  # Avoid infinite loop from bad input
        return []

    if not isinstance(random_steps, list):
        random_steps = [random_steps]

    L = []

    while start < stop:
        L.append(start)
        start = start + random.choice(random_steps)

    return L
</pre>
<p>I made sure to write the <a href="http://slipmat.noisepages.com/2010/03/on-the-importance-of-docstrings/">docstrings</a>, to make life easier for anyone who may import my code later. Here's a Python interpreter session to test out some numbers:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
>>> from MyListGenerators import range_plus
>>> range_plus(0, 4, 0.5)
[0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5]
>>> range_plus(0, 4, [0.25, 0.25, 0.5, 0.75])
[0, 0.5, 1.0, 1.5, 1.75, 2.5, 3.0, 3.25, 3.75]
</pre>
<p>As applied to music, range_plus() would be a perfect fit for randomly generating rhythmic patterns, for things such as hi-hats.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0  @range_plus(0, 4, [0.25, 0.25, 0.5, 0.75]) hat()
@4  @range_plus(0, 4, [0.25, 0.25, 0.5, 0.75]) hat()
@12 @range_plus(0, 4, [0.25, 0.25, 0.5, 0.75]) hat()
@16 @range_plus(0, 4, [0.25, 0.25, 0.5, 0.75]) hat()
</pre>
<p>Here's is one scenario for what those patterns would look like in trigger notation:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
Bar 1:  x.x. x.xx ..x. xx.x
Bar 2:  xx.. x..x ..x. .xx.
Bar 3:  x..x ..x. xx.x .x..
Bar 4:  x.x. .xxx .xxx x..x
</pre>
<p>The 'x' is a 16th note trigger, the '.' is a 16th note rest, and spaces are used to distinguish between each quarter note.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/custom-sequence-list-generators/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>
		<item>
		<title>Nine Rules for Scheduling Events</title>
		<link>https://codehop.com/nine-rules-for-scheduling-events/</link>
		<comments>https://codehop.com/nine-rules-for-scheduling-events/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:03:26 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scheduler]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=116</guid>
		<description><![CDATA[How would Slipmat&#8217;s @ scheduler work when applying various Python methodologies? To celebrate the release of my friend Sarah MacLean&#8217;s new book, Nine Rules to Break When Romancing a Rake, here are 9 rules for scheduling events. Each of the &#8230; <a href="https://codehop.com/nine-rules-for-scheduling-events/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>How would Slipmat&#8217;s @ scheduler work when applying various Python methodologies?</p>
<p>To celebrate the release of my friend <a href="http://blog.macleanspace.com/index.html">Sarah MacLean&#8217;s</a> new book, <a href="http://www.amazon.com/Nine-Rules-Break-When-Romancing/dp/0061852058">Nine Rules to Break When Romancing a Rake</a>, here are 9 rules for scheduling events. Each of the following examples produce the exact same result:</p>
<p><strong>1. Individual Events</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0 foo()
@1 foo()
@2 foo()
@3 foo()
</pre>
<p><strong>2. List</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@[0, 1, 2, 3] foo()
</pre>
<p><strong>3. Identifier</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
t = [0, 1, 2, 3]
@t foo()
</pre>
<p><strong>4. List Comprehension</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@[i for i in range(0, 4)] foo()
</pre>
<p><strong>5. Loop</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
for i in range(0, 4):
    @i foo()    
</pre>
<p><strong>6. Function</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def bar():
    @0 foo()
    @1 foo()
    @2 foo()
    @3 foo()
    
bar()
</pre>
<p><strong>7. Nested</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
foo()
1:
    foo()
    1:
        foo()
        1:
            foo()
</pre>
<p><strong>8. Item Iteration</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
items = (0, 1, 2, 3)
@[i for i in items] foo()
</pre>
<p><strong>9. Map</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def bar(x): return x
@(map(bar, range(0, 4)) foo()
</pre>
<p>And a special message for Sarah, &#8220;<em>Ninjas</em>.&#8221; </p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/nine-rules-for-scheduling-events/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Live Coding and Capturing a Perfomance</title>
		<link>https://codehop.com/live-coding-and-capturing-a-perfomance/</link>
		<comments>https://codehop.com/live-coding-and-capturing-a-perfomance/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 16:40:01 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[chuck]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[live coding]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scheduler]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=89</guid>
		<description><![CDATA[It&#8217;s the latest fad that&#8217;s sweeping computer music. And I would love for Slipmat to have this ability in its arsenal of tools. Without having to sacrifice non-realtime rendering for computationally expensive processes, of course. The following conceptual live coding &#8230; <a href="https://codehop.com/live-coding-and-capturing-a-perfomance/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s the latest fad that&#8217;s sweeping computer music. And I would love for Slipmat to have this ability in its arsenal of tools. Without having to sacrifice non-realtime rendering for computationally expensive processes, of course.</p>
<p>The following conceptual live coding prototype shows what a simple session would look like if it was modeled on the Python interpreter:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
$ slipmat --capture_performance my_session.txt
>>> from LiveCodeSeq import seq
>>> from MyBassLibrary import rad_rezzy
>>> from random import random
>>> p[0] = [int(random() * 12) for i in range(0, 16)]
>>> p[1] = [int(random() * 12) for i in range(0, 16)]
>>> p[0]
[5, 9, 11, 8, 7, 8, 5, 1, 10, 7, 4, 4, 6, 4, 4, 2]
>>> p[1]
[6, 6, 5, 3, 5, 7, 8, 4, 0, 0, 8, 7, 9, 7, 2, 4]
>>> r = rad_rezzy()
>>> s = seq(instr=r, pattern=p[0], base_pch=6.00, resolution=1/16, tempo=133)
>>> s.start()
>>> s.change_pattern(pattern=p[1], on_beat=0)
>>> @60 s.stop(onbeat=0)
</pre>
<p>I have a gut feeling that there are some changes that should be made. Though as a starting point, this isn&#8217;t a terrible one.</p>
<p>Being able to capture a live coding performance would be fantastic. Not sure how workable it would be, but perhaps such a feature would produce a file that could be played back later:</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
$ cat my_session.txt
@0             global.seed(7319991298)
@4.04977535403 from LiveCodeSeq import seq
@8.43528123231 from MyBassLibrary import rad_rezzy
@10.9562488312 from random import random
@15.6027957075 p[0] = [int(random() * 12) for i in range(0, 16)]
@20.7757632586 p[1] = [int(random() * 12) for i in range(0, 16)]
@26.2462371683 p[0]
@29.3961696828 p[1]
@34.0424988199 r = rad_rezzy()
@40.3211374075 s = seq(instr=r, pattern=p[0], base_pch=6.00, resolution=1/16, 
                   tempo=133)
@45.5491938514 s.start()
@47.8991166715 s.change_pattern(pattern=p[1], onbeat=0)
@52.6267958091 @60 s.stop(onbeat=0)
</pre>
<p>The @ schedules are the times in which return was originally pressed for each event. Looks like I&#8217;ll be spending some time with <a href="http://chuck.cs.princeton.edu/">ChucK</a> soon.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/live-coding-and-capturing-a-perfomance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>When Does That Happen?</title>
		<link>https://codehop.com/when-does-that-happen/</link>
		<comments>https://codehop.com/when-does-that-happen/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 19:18:44 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[scheduler]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=68</guid>
		<description><![CDATA[Look at the following code and try to answer these two questions: When is foo() scheduled to play? When is bar() scheduled to play? Be sure to read about the @ scheduler if you haven&#8217;t already done so. @0 x &#8230; <a href="https://codehop.com/when-does-that-happen/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Look at the following code and try to answer these two questions: <em>When is foo() scheduled to play? When is bar() scheduled to play?</em> Be sure to read about the <a href="http://slipmat.noisepages.com/2010/03/coding-in-time-with-the-scheduler/">@ scheduler</a> if you haven&#8217;t already done so.</p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
@0 x = 0
@1 x = 3

@(5 + x) foo()
@5:
    @x bar()
</pre>
<p><strong>The answers:</strong> foo() is scheduled to play at beat 5, while bar() plays at beat 8.</p>
<p>Why is this?</p>
<p>For foo(), the expression for the scheduler @(5 + x) is evaluated at beat 0. At beat 0, x equals 0. This is a single schedule.</p>
<p>For bar(), there are two separate schedules that happen in tandem: @5 and then @x. The @x schedule isn&#8217;t evaluated until the @5 schedule is triggered. You might say that the @x schedule is a task of the @5 schedule. At the time @x is evaluated, x equals 3.</p>
<p>Of course, this is all theoretical at the moment.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/when-does-that-happen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coding in Time with the @ Scheduler</title>
		<link>https://codehop.com/coding-in-time-with-the-scheduler/</link>
		<comments>https://codehop.com/coding-in-time-with-the-scheduler/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 03:23:36 +0000</pubDate>
		<dc:creator><![CDATA[Jacob Joaquin]]></dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[max mathews]]></category>
		<category><![CDATA[radio baton]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[scheduling]]></category>

		<guid isPermaLink="false">http://slipmat.noisepages.com/?p=30</guid>
		<description><![CDATA[One idea I have for my theoretical computer music language is having scheduling built right into the syntax, with the hopes that it will add the right balance of functionality and clarity. I like the idea of having a score &#8230; <a href="https://codehop.com/coding-in-time-with-the-scheduler/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>One idea I have for my theoretical computer music language is having scheduling built right into the syntax, with the hopes that it will add the right balance of functionality and clarity.</p>
<p>I like the idea of having a score language separate from the orchestra language, though I&#8217;ve learned over the years that this approach acts as a bottle neck. The @ scheduler is a potential solution to bring both together, without losing the purpose of the score.</p>
<p>Instead of going into great detail on how the @ scheduler might work, I&#8217;ll just present the following four examples.</p>
<p><strong>Example 1 &#8212; Nested Time:</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
do_something()     # Do something at beat 0, (@0 assumed)
@2 do_something()  # Do something at beat 2

@5:
    do_something()     # Do something at beat 5: 5 + 0, (@0 assumed)
    @3 do_something()  # Do something at beat 8: 5 + 3
    
    @4:                    # Block starts at beat 9: 5 + 4
        do_something()     # Do something at beat 9: 5 + 4 + 0, (@0 assumed)
        @1 do_something()  # Do something at beat 10: 5 + 4 + 1
</pre>
<p><strong>Example 2 &#8212; Changing values mid-event:</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def foo():
    freq = 440                                 # Initial frequency
    @1 freq *= 2                               # Frequncy doubles at time 1
    output Wavetable.osc(1, freq, sine(8192))  # Output signal
</pre>
<p><strong>Example 3 &#8212; Scheduler error:</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def foo():
    @1 freq = 440
    output Wavetable.osc(1, freq, sine(8192))  # Broken, freq doesn't exist
</pre>
<p><strong>Example 4 &#8212; Organized score + generated events:</strong></p>
<pre style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 1.2em; padding-bottom: 16px">
def hat_eights():
    for i in range(0, 8):
        @(i / 2.0) hat()

@0:
    hat_eights()
    @0 kick()
    @1 snare()
    @2 kick()
    @3 snare()
    
@4:
    hat_eights()
    @0 kick()
    @1 snare()
    @2 kick()
    @2.5 kick()
    @3 snare()
</pre>
<p>That last example reminds me of Max Mathews&#8217; <a href="http://www.csounds.com/mathews/manuals/ConductorManual.pdf">Radio Baton Conductor language</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://codehop.com/coding-in-time-with-the-scheduler/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
