<?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; interpreter</title>
	<atom:link href="https://codehop.com/tag/interpreter/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>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>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>
	</channel>
</rss>
