<?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>jeff watson &#187; ctin-544</title>
	<atom:link href="http://remotedevice.net/tag/ctin-544/feed/" rel="self" type="application/rss+xml" />
	<link>http://remotedevice.net</link>
	<description>remotedevice.net</description>
	<lastBuildDate>Wed, 28 Jul 2010 03:14:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sonar Tonebank</title>
		<link>http://remotedevice.net/projects/sonar-tonebank/</link>
		<comments>http://remotedevice.net/projects/sonar-tonebank/#comments</comments>
		<pubDate>Sun, 10 May 2009 05:33:41 +0000</pubDate>
		<dc:creator>Jeff Watson</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[ctin-544]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[perry hoberman]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[sonar]]></category>

		<guid isPermaLink="false">http://remotedevice.net/?p=891</guid>
		<description><![CDATA[The Sonar Tonebank is a musical instrument that uses a range sensor to trigger sound samples.]]></description>
			<content:encoded><![CDATA[<p>The Sonar Tonebank is a simple musical instrument that uses a range sensor to trigger sound samples. Players can create musical soundscapes by moving in front of the range sensor, which maps pitch to distance. This project was created using an <a href="http://arduino.cc/">Arduino</a>, a PING sonar sensor and the Minim sound library in <a href="http://processing.org/">Processing</a>.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/GtSfzf-Squs&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/GtSfzf-Squs&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<h3>Code &#038; Notes</h3>
<p><strong>The Processing code</strong> is actually very simple. The program reads range data from the Arduino via the serial port, then triggers samples and visualizer elements according to the distances reported. Any set of samples could be used (for this version, I&#8217;m using 16 different short sound textures generated with Reason), and it&#8217;s easy to imagine how the code could be modified to send MIDI signals instead of triggering samples.</p>
<p><img src="http://remotedevice.net/wp-content/uploads/2009/05/img_0209.jpg" alt="img_0209" title="img_0209" width="425" height="319" class="alignnone size-full wp-image-960" /></p>
<blockquote><p>// SONAR TONEBANK</p>
<p>// 1.0<br />
// Jeff Watson<br />
// 27 April 2009</p>
<p>import processing.serial.*;<br />
import ddf.minim.*;</p>
<p>// arduino variables</p>
<p>Serial myPort;        // The serial port</p>
<p>// video variables</p>
<p>// minim variables</p>
<p>Minim minim;</p>
<p>AudioSample bell;<br />
AudioSample bell2;<br />
AudioSample bell3;<br />
AudioSample bell4;<br />
AudioSample bell5;<br />
AudioSample bell6;<br />
AudioSample bell7;<br />
AudioSample bell8;<br />
AudioSample bell9;<br />
AudioSample bell10;<br />
AudioSample bell11;<br />
AudioSample bell12;<br />
AudioSample bell13;<br />
AudioSample bell14;<br />
AudioSample bell15;<br />
AudioSample bell16;</p>
<p>// visualizer variables</p>
<p>void setup () {</p>
<p>  size(640, 480, P2D);<br />
  background(0);<br />
  noStroke();</p>
<p>  minim = new Minim(this);<br />
  bell = minim.loadSample(&#8220;F#3.wav&#8221;, 2048);<br />
  bell2 = minim.loadSample(&#8220;G#3.wav&#8221;, 2048);<br />
  bell3 = minim.loadSample(&#8220;A#3.wav&#8221;, 2048);<br />
  bell4 = minim.loadSample(&#8220;C#4.wav&#8221;, 2048);<br />
  bell5 = minim.loadSample(&#8220;D#4.wav&#8221;, 2048);<br />
  bell6 = minim.loadSample(&#8220;F#4.wav&#8221;, 2048);<br />
  bell7 = minim.loadSample(&#8220;G#4.wav&#8221;, 2048);<br />
  bell8 = minim.loadSample(&#8220;A#4.wav&#8221;, 2048);<br />
  bell9 = minim.loadSample(&#8220;C#5.wav&#8221;, 2048);<br />
  bell10 = minim.loadSample(&#8220;D#5.wav&#8221;, 2048);<br />
  bell11 = minim.loadSample(&#8220;F#5.wav&#8221;, 2048);<br />
  bell12 = minim.loadSample(&#8220;G#5.wav&#8221;, 2048);<br />
  bell13 = minim.loadSample(&#8220;A#5.wav&#8221;, 2048);<br />
  bell14 = minim.loadSample(&#8220;C#6.wav&#8221;, 2048);<br />
  bell15 = minim.loadSample(&#8220;D#6.wav&#8221;, 2048);<br />
  bell16 = minim.loadSample(&#8220;F#6.wav&#8221;, 2048);</p>
<p>  // List all the available serial ports<br />
  println(Serial.list());<br />
  // Open whatever port is the one you&#8217;re using.<br />
  myPort = new Serial(this, Serial.list()[1], 9600);<br />
  // don&#8217;t generate a serialEvent() unless you get a newline character:<br />
  myPort.bufferUntil(&#8216;\n&#8217;);<br />
}</p>
<p>void draw () {<br />
  // everything happens in the serialEvent()<br />
}</p>
<p>void serialEvent (Serial myPort) {<br />
  // get the ASCII string:<br />
  String inString = myPort.readStringUntil(&#8216;\n&#8217;);</p>
<p>  if (inString != null) {<br />
    // trim off any whitespace:<br />
    inString = trim(inString);<br />
    // convert to an int and map to the screen height:<br />
    float inByte = float(inString);<br />
    int VideoMod = int(inString);</p>
<p>println(VideoMod);</p>
<p>// 1st Octave</p>
<p>if ( VideoMod < 5 )<br />
{<br />
bell.trigger();<br />
delay(33);<br />
fill(0,0,255);<br />
rect(1,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 8 )<br />
{<br />
  bell2.trigger();<br />
  delay(33);<br />
  fill(13,82,122);<br />
  rect(129,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 11 )<br />
{<br />
  bell3.trigger();<br />
  delay(33);<br />
  fill(0,0,255);<br />
  rect(257,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 14 )<br />
{<br />
  bell4.trigger();<br />
  delay(33);<br />
  fill(13,82,122);<br />
  rect(385,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 17 )<br />
{<br />
  bell5.trigger();<br />
  delay(33);<br />
  fill(0,0,255);<br />
  rect(513,0,128,480);<br />
}</p>
<p>// 2nd Octave</p>
<p>else if ( VideoMod < 20 )<br />
{<br />
  bell6.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,0,640,480);<br />
  fill(0,0,255,191);<br />
  rect(1,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 23 )<br />
{<br />
  bell7.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,0,640,480);<br />
  fill(13,82,122,191);<br />
  rect(129,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 26 )<br />
{<br />
  bell8.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,0,640,480);<br />
  fill(0,0,255,191);<br />
  rect(257,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 29 )<br />
{<br />
  bell9.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,0,640,480);<br />
  fill(13,82,122,191);<br />
  rect(385,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 32 )<br />
{<br />
  bell10.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,0,640,480);<br />
  fill(0,0,255,191);<br />
  rect(513,0,128,480);<br />
}</p>
<p>// 3rd Octave</p>
<p>else if ( VideoMod < 35 )<br />
{<br />
  bell11.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,100,640,380);<br />
  fill(0,0,255,127);<br />
  rect(1,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 38 )<br />
{<br />
  bell12.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,100,640,380);<br />
  fill(13,82,122,191);<br />
  rect(129,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 41 )<br />
{<br />
  bell13.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,100,640,380);<br />
  fill(0,0,255,191);<br />
  rect(257,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 44 )<br />
{<br />
  bell14.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,100,640,380);<br />
  fill(13,82,122,191);<br />
  rect(385,0,128,480);<br />
}</p>
<p>else if ( VideoMod < 47 )<br />
{<br />
  bell15.trigger();<br />
  delay(33);<br />
  fill(0,0,0);<br />
  rect(0,100,640,380);<br />
  fill(0,0,255,191);<br />
  rect(513,0,128,480);<br />
}</p>
<p>// Extra note clears screen</p>
<p>else if ( VideoMod < 50 )<br />
{<br />
  bell16.trigger();<br />
  delay(33);<br />
  background(0);<br />
}</p>
<p>else if ( VideoMod > 50 )<br />
{<br />
}</p>
<p>}<br />
}
</p></blockquote>
<p><em>See also:</em> <a href="http://www.arduino.cc/en/Tutorial/Graph">Arduino-Graph</a></p>
<p><img src="http://remotedevice.net/wp-content/uploads/2009/05/img_0207.jpg" alt="img_0207" title="img_0207" width="425" height="319" class="alignnone size-full wp-image-961" /></p>
<p><strong>The Arduino code</strong> is also pretty straight-forward. All it does is translate the raw PING sonar data into easier-to-handle Imperial and metric measurements, which are then sent out the serial port to Processing.</p>
<blockquote><p>int pingPin = 7;</p>
<p>void setup()<br />
{<br />
  Serial.begin(9600);<br />
}</p>
<p>void loop()<br />
{<br />
  long duration, inches, cm;</p>
<p>  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.<br />
  // We give a short LOW pulse beforehand to ensure a clean HIGH pulse.<br />
  pinMode(pingPin, OUTPUT);<br />
  digitalWrite(pingPin, LOW);<br />
  delayMicroseconds(2);<br />
  digitalWrite(pingPin, HIGH);<br />
  delayMicroseconds(5);<br />
  digitalWrite(pingPin, LOW);</p>
<p>  // The same pin is used to read the signal from the PING))): a HIGH<br />
  // pulse whose duration is the time (in microseconds) from the sending<br />
  // of the ping to the reception of its echo off of an object.<br />
  pinMode(pingPin, INPUT);<br />
  duration = pulseIn(pingPin, HIGH);</p>
<p>  // convert the time into a distance<br />
  inches = microsecondsToInches(duration);<br />
  cm = microsecondsToCentimeters(duration);</p>
<p>  Serial.println(inches);</p>
<p>  delay(100);<br />
}</p>
<p>long microsecondsToInches(long microseconds)<br />
{<br />
  // According to Parallax&#8217;s datasheet for the PING))), there are<br />
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per<br />
  // second).  This gives the distance travelled by the ping, outbound<br />
  // and return, so we divide by 2 to get the distance of the obstacle.<br />
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf<br />
  return microseconds / 74 / 2;<br />
}</p>
<p>long microsecondsToCentimeters(long microseconds)<br />
{<br />
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.<br />
  // The ping travels out and back, so to find the distance of the<br />
  // object we take half of the distance travelled.<br />
  return microseconds / 29 / 2;<br />
}</p></blockquote>
<p><em><br />
See also:</em> <a href="http://arduino.cc/en/Tutorial/Ping">Arduino-Ping</a></p>
<p><img src="http://remotedevice.net/wp-content/uploads/2009/05/img_0208.jpg" alt="img_0208" title="img_0208" width="425" height="319" class="alignnone size-full wp-image-962" /></p>
<p>During the early prototyping phase, I also made a simple Theremin using the PING sensor, based on Alberto Bietti&#8217;s <a href="http://alandtech.blogspot.com/2007/12/arduino-theremin.html">excellent documentation</a>. The piezo speaker and button on the current version of the project are remnants of this prototype; I&#8217;ve left them on there for now for demoing purposes.</p>
<p>This project was created as an exercise for Perry Hoberman&#8217;s graduate seminar, <em>Experiments in Interactivity II</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://remotedevice.net/projects/sonar-tonebank/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Phrases</title>
		<link>http://remotedevice.net/blog/usfl_phrss/</link>
		<comments>http://remotedevice.net/blog/usfl_phrss/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 09:48:16 +0000</pubDate>
		<dc:creator>Jeff Watson</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[blosxom]]></category>
		<category><![CDATA[ctin-544]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[grenville kleiser]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[markov]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[rita]]></category>

		<guid isPermaLink="false">http://remotedevice.net/?p=816</guid>
		<description><![CDATA[Useful Phrases uses Markov word/phrase probabilities to generate unique sentences by breaking apart a source text. These sentences are then added to a blog.]]></description>
			<content:encoded><![CDATA[<p><a href="http://remotedevice.net/cgi-bin/blosxom.cgi" target="_blank"><em>Useful Phrases</em></a> (usfl_phrss) uses Markov word/phrase probabilities to generate unique sentences by breaking apart a source text &#8212; in this case, the introduction to <em>&#8220;Fifteen Thousand Useful Phrases&#8221;</em> by Grenville Kleiser. These sentences are then added to a blog.</p>
<p>Click <a href="http://remotedevice.net/cgi-bin/blosxom.cgi" target="_blank">here</a> to view the blog or <a href="http://remotedevice.net/sw/usfl_phrss_proc/applet/" target="_blank">here</a> to go straight to the &#8220;writing&#8221; tool.</p>
<p>The application was built with <a href="http://processing.org/">Processing</a>/<a href="http://www.rednoise.org/rita/">RiTA</a> and <a href="http://www.blosxom.com/">blosxom</a>. The source code can be viewed <a href="../sw/usfl_phrss_proc/applet/usfl_phrss_proc.pde">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://remotedevice.net/blog/usfl_phrss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dream_Jrnl</title>
		<link>http://remotedevice.net/projects/dream_jrnl/</link>
		<comments>http://remotedevice.net/projects/dream_jrnl/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 03:35:01 +0000</pubDate>
		<dc:creator>Jeff Watson</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ctin-544]]></category>
		<category><![CDATA[dreams]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[perry hoberman]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[rita]]></category>

		<guid isPermaLink="false">http://remotedevice.net/?p=615</guid>
		<description><![CDATA[Dream_Jrnl is a generative literature experiment that algorithmically creates evocative and mysterious texts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://remotedevice.net/processing/dream_jrnl/applet/" target="_blank"><img class = "float" src="http://remotedevice.net/wp-content/uploads/2009/01/dream_jrnl.jpg" alt="dream_jrnl" width="299" height="290" border=0 /></a></p>
<p>Dream_Jrnl is a generative literature experiment that algorithmically creates evocative and mysterious texts.</p>
<p>This program was created using <a onclick="javascript:pageTracker._trackPageview('/outbound/article/http://processing.org/');" href="http://processing.org/">Processing</a> and <a href="http://www.rednoise.org/rita/">RiTA</a> as an exercise for <a onclick="javascript:pageTracker._trackPageview('/outbound/article/http://en.wikipedia.org/wiki/Perry_Hoberman');" href="http://en.wikipedia.org/wiki/Perry_Hoberman">Perry Hoberman</a>’s <em>Experiments in Interactivity II</em> (CTIN-544) seminar. The source material is a dream log I kept during the summer of 2008.</p>
<p>Click <a href="http://remotedevice.net/processing/dream_jrnl/applet/" target="_blank">here</a> to launch Dream_Jrnl in a separate window. Interact with the application by clicking, moving the mouse or typing.</p>
]]></content:encoded>
			<wfw:commentRss>http://remotedevice.net/projects/dream_jrnl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Kcolc</title>
		<link>http://remotedevice.net/projects/kcolc/</link>
		<comments>http://remotedevice.net/projects/kcolc/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 19:40:50 +0000</pubDate>
		<dc:creator>Jeff Watson</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ctin-544]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[kcolc]]></category>
		<category><![CDATA[perry hoberman]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://remotedevice.net/?p=548</guid>
		<description><![CDATA[Kcolc is a visual/textual timepiece suitable for display on billboards or other large public displays.]]></description>
			<content:encoded><![CDATA[<p>Kcolc is a visual/textual timepiece suitable for display on billboards or other large public displays.</p>
<p>This program was created using <a href="http://processing.org/">Processing</a> as an introductory exercise for <a href="http://en.wikipedia.org/wiki/Perry_Hoberman">Perry Hoberman</a>&#8217;s <em>Experiments in Interactivity II</em> (CTIN-544) seminar.</p>
<p><a href="http://remotedevice.net/processing/kcolc/" target="_blank">Click here</a> to launch Kcolc in a separate window.</p>
]]></content:encoded>
			<wfw:commentRss>http://remotedevice.net/projects/kcolc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
