<?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>work in progress &#187; Pure Data</title>
	<atom:link href="http://www.workinprogress.ca/category/pure-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.workinprogress.ca</link>
	<description>of patrick sébastien</description>
	<lastBuildDate>Fri, 23 Dec 2011 20:56:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>libpd</title>
		<link>http://www.workinprogress.ca/libpd/</link>
		<comments>http://www.workinprogress.ca/libpd/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 05:55:46 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Pure Data]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=902</guid>
		<description><![CDATA[Embedding Pure Data as a DSP library Get it: git clone git://gitorious.org/pdlib/libpd.git Build it: make libs/libpd.so Test it with PulseAudio: /* C example of using libpd with pulseaudio * RECORD &#38; PLAYBACK * * gcc -c main.c `pkg-config --cflags libpulse-simple` -o main.o &#34;-I.&#34; &#34;-I/home/psc/src/libpd/libpd_wrapper&#34; &#34;-I/home/psc/src/libpd/pure-data/src&#34; * gcc -o myapp main.o &#34;-L.&#34; -O2 `pkg-config --libs libpulse-simple` [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Embedding Pure Data as a DSP library</strong></p>
<p><strong>Get it:</strong><br />
<i>git clone git://gitorious.org/pdlib/libpd.git</i>
</p>
<p><strong>Build it:</strong><br />
<i>make libs/libpd.so</i>
</p>
<p><strong>Test it with PulseAudio</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* C example of using libpd with pulseaudio
 * RECORD &amp; PLAYBACK
 *
 * gcc -c  main.c `pkg-config --cflags libpulse-simple`  -o main.o &quot;-I.&quot; &quot;-I/home/psc/src/libpd/libpd_wrapper&quot; &quot;-I/home/psc/src/libpd/pure-data/src&quot;
 * gcc -o myapp main.o  &quot;-L.&quot; -O2 `pkg-config --libs libpulse-simple` /home/psc/src/libpd/libs/libpd.so
 *
 * http://www.workinprogress.ca/libpd
 */</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// libpd</span>
<span style="color: #339933;">#include &quot;z_libpd.h&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// pulseaudio</span>
<span style="color: #339933;">#include &lt;pulse/simple.h&gt;</span>
<span style="color: #339933;">#include &lt;pulse/error.h&gt;</span>
<span style="color: #339933;">#include &lt;pulse/gccmacro.h&gt;</span>
<span style="color: #339933;">#define NUMBERSECOND 10</span>
<span style="color: #339933;">#define SAMPLE_RATE 44100</span>
<span style="color: #339933;">#define NBCHANNEL 2</span>
<span style="color: #339933;">#define BLOCKSIZE 64</span>
<span style="color: #339933;">#define TICK 1</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//libpd catch [print] function</span>
<span style="color: #993333;">void</span> pdprint<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">**</span>argv<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;usage: %s file folder<span style="color: #000099; font-weight: bold;">\n</span>example: ./libpd echo.pd ./<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// libpd</span>
	libpd_printhook <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>t_libpd_printhook<span style="color: #009900;">&#41;</span> pdprint<span style="color: #339933;">;</span>
	libpd_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_init_audio<span style="color: #009900;">&#40;</span>NBCHANNEL<span style="color: #339933;">,</span> NBCHANNEL<span style="color: #339933;">,</span> SAMPLE_RATE<span style="color: #339933;">,</span> TICK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// input channel, output channel, sr, tick per buffer</span>
	<span style="color: #666666; font-style: italic;">// compute audio    [; pd dsp 1(</span>
	libpd_start_message<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_add_float<span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_finish_message<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pd&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;dsp&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// open patch       [; pd open file folder(</span>
	libpd_start_message<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_add_symbol<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_add_symbol<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_finish_message<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pd&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;open&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// pulseaudio</span>
	<span style="color: #666666; font-style: italic;">// puredata use PA_SAMPLE_FLOAT32LE</span>
	<span style="color: #993333;">static</span> <span style="color: #993333;">const</span> pa_sample_spec ss <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
		.<span style="color: #202020;">format</span> <span style="color: #339933;">=</span> PA_SAMPLE_FLOAT32LE<span style="color: #339933;">,</span>
		.<span style="color: #202020;">rate</span> <span style="color: #339933;">=</span> SAMPLE_RATE<span style="color: #339933;">,</span>
		.<span style="color: #202020;">channels</span> <span style="color: #339933;">=</span> NBCHANNEL<span style="color: #339933;">,</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// low-latency setting</span>
	pa_buffer_attr ba<span style="color: #339933;">;</span>
	ba.<span style="color: #202020;">tlength</span> <span style="color: #339933;">=</span> pa_usec_to_bytes<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">50</span><span style="color: #339933;">*</span><span style="color: #0000dd;">1000</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ss<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ba.<span style="color: #202020;">minreq</span> <span style="color: #339933;">=</span> pa_usec_to_bytes<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ss<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ba.<span style="color: #202020;">maxlength</span> <span style="color: #339933;">=</span> pa_usec_to_bytes<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">50</span><span style="color: #339933;">*</span><span style="color: #0000dd;">1000</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ss<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ba.<span style="color: #202020;">fragsize</span> <span style="color: #339933;">=</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">uint32_t</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Adjust this value if it's glitchy</span>
	pa_simple <span style="color: #339933;">*</span>s <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
	pa_simple <span style="color: #339933;">*</span>r <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// init pulseaudio</span>
	<span style="color: #993333;">int</span> error<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>r <span style="color: #339933;">=</span> pa_simple_new<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;pdlib&quot;</span><span style="color: #339933;">,</span> PA_STREAM_RECORD<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ss<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ba<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> __FILE__<span style="color: #ff0000;">&quot;: pa_simple_new() - record failed: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pa_strerror<span style="color: #009900;">&#40;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">goto</span> problem<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>s <span style="color: #339933;">=</span> pa_simple_new<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;pdlib&quot;</span><span style="color: #339933;">,</span> PA_STREAM_PLAYBACK<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ss<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>ba<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> __FILE__<span style="color: #ff0000;">&quot;: pa_simple_new() - playback failed: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pa_strerror<span style="color: #009900;">&#40;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">goto</span> problem<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">// now run pd for ten seconds (logical time)</span>
	<span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
	<span style="color: #993333;">float</span> inbuf<span style="color: #009900;">&#91;</span>NBCHANNEL <span style="color: #339933;">*</span> BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> outbuf<span style="color: #009900;">&#91;</span>NBCHANNEL <span style="color: #339933;">*</span> BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NUMBERSECOND <span style="color: #339933;">*</span> SAMPLE_RATE <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// pulseaudio input</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>pa_simple_read<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">,</span> inbuf<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>t_float<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> BLOCKSIZE <span style="color: #339933;">*</span> NBCHANNEL <span style="color: #339933;">*</span> TICK<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>error<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> __FILE__<span style="color: #ff0000;">&quot;: pa_simple_read() failed: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pa_strerror<span style="color: #009900;">&#40;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">goto</span> problem<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// libpd process dsp</span>
		libpd_process_float<span style="color: #009900;">&#40;</span>inbuf<span style="color: #339933;">,</span> outbuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// pulseaudio output</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>pa_simple_write<span style="color: #009900;">&#40;</span>s<span style="color: #339933;">,</span> outbuf<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>t_float<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> BLOCKSIZE <span style="color: #339933;">*</span> NBCHANNEL <span style="color: #339933;">*</span> TICK<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>error<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> __FILE__<span style="color: #ff0000;">&quot;: pa_simple_write() failed: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pa_strerror<span style="color: #009900;">&#40;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">goto</span> problem<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #808080; font-style: italic;">/*
		//pulseaudio - report latency
		pa_usec_t latency;
		if ((latency = pa_simple_get_latency(s, &amp;error)) == (pa_usec_t) -1) {
		    fprintf(stderr, __FILE__&quot;: pa_simple_get_latency() failed: %s\n&quot;, pa_strerror(error));
		    goto problem;
		}
		fprintf(stderr, &quot;%0.0f usec    \r&quot;, (float)latency);
		*/</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #808080; font-style: italic;">/* Make sure that every single sample was played */</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>pa_simple_drain<span style="color: #009900;">&#40;</span>s<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>error<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> __FILE__<span style="color: #ff0000;">&quot;: pa_simple_drain() failed: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pa_strerror<span style="color: #009900;">&#40;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">goto</span> problem<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	pa_simple_free<span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	pa_simple_free<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
problem<span style="color: #339933;">:</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		pa_simple_free<span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		pa_simple_free<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;An error occured&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</p>
<p><strong>Test it with PortAudio</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* C example of using libpd with portaudio
 * RECORD &amp; PLAYBACK
 *
 * gcc -c  main.c `pkg-config --cflags portaudio-2.0`  -o main.o &quot;-I.&quot; &quot;-I/home/psc/src/libpd/libpd_wrapper&quot; &quot;-I/home/psc/src/libpd/pure-data/src&quot;
 * gcc -o myapp main.o  &quot;-L.&quot; -O2 `pkg-config --libs portaudio-2.0` /home/psc/src/libpd/libs/libpd.so
 */</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// libpd</span>
<span style="color: #339933;">#include &quot;z_libpd.h&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// portaudio</span>
<span style="color: #339933;">#include &quot;portaudio.h&quot;</span>
&nbsp;
<span style="color: #339933;">#define NUMBERSECOND 10</span>
<span style="color: #339933;">#define SAMPLE_RATE 44100</span>
<span style="color: #339933;">#define NBCHANNEL 2</span>
<span style="color: #339933;">#define BLOCKSIZE 64</span>
<span style="color: #339933;">#define TICK 1</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//libpd catch [print] function</span>
<span style="color: #993333;">void</span> pdprint<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">**</span>argv<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;usage: %s file folder<span style="color: #000099; font-weight: bold;">\n</span>example: ./libpd echo.pd ./<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// libpd</span>
	libpd_printhook <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>t_libpd_printhook<span style="color: #009900;">&#41;</span> pdprint<span style="color: #339933;">;</span>
	libpd_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_init_audio<span style="color: #009900;">&#40;</span>NBCHANNEL<span style="color: #339933;">,</span> NBCHANNEL<span style="color: #339933;">,</span> SAMPLE_RATE<span style="color: #339933;">,</span> TICK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// input channel, output channel, sr, tick per buffer</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// compute audio    [; pd dsp 1(</span>
	libpd_start_message<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_add_float<span style="color: #009900;">&#40;</span><span style="color:#800080;">1.0f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_finish_message<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pd&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;dsp&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// open patch       [; pd open file folder(</span>
	libpd_start_message<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_add_symbol<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_add_symbol<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	libpd_finish_message<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pd&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;open&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">// portaudio</span>
	PaStreamParameters inputParameters<span style="color: #339933;">,</span> outputParameters<span style="color: #339933;">;</span>
    PaStream <span style="color: #339933;">*</span>stream<span style="color: #339933;">;</span>
    PaError err<span style="color: #339933;">;</span>
&nbsp;
    err <span style="color: #339933;">=</span> Pa_Initialize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// input</span>
    inputParameters.<span style="color: #202020;">device</span> <span style="color: #339933;">=</span> Pa_GetDefaultInputDevice<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* default input device */</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>inputParameters.<span style="color: #202020;">device</span> <span style="color: #339933;">==</span> paNoDevice<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;Error: No default input device.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    inputParameters.<span style="color: #202020;">channelCount</span> <span style="color: #339933;">=</span> NBCHANNEL<span style="color: #339933;">;</span>
    inputParameters.<span style="color: #202020;">sampleFormat</span> <span style="color: #339933;">=</span> paFloat32<span style="color: #339933;">;</span>
    inputParameters.<span style="color: #202020;">suggestedLatency</span> <span style="color: #339933;">=</span> Pa_GetDeviceInfo<span style="color: #009900;">&#40;</span> inputParameters.<span style="color: #202020;">device</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>defaultLowInputLatency<span style="color: #339933;">;</span>
    inputParameters.<span style="color: #202020;">hostApiSpecificStreamInfo</span> <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// output</span>
    outputParameters.<span style="color: #202020;">device</span> <span style="color: #339933;">=</span> Pa_GetDefaultOutputDevice<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* default output device */</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>outputParameters.<span style="color: #202020;">device</span> <span style="color: #339933;">==</span> paNoDevice<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;Error: No default output device.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    outputParameters.<span style="color: #202020;">channelCount</span> <span style="color: #339933;">=</span> NBCHANNEL<span style="color: #339933;">;</span>
    outputParameters.<span style="color: #202020;">sampleFormat</span> <span style="color: #339933;">=</span> paFloat32<span style="color: #339933;">;</span>
    outputParameters.<span style="color: #202020;">suggestedLatency</span> <span style="color: #339933;">=</span> Pa_GetDeviceInfo<span style="color: #009900;">&#40;</span> outputParameters.<span style="color: #202020;">device</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>defaultLowOutputLatency<span style="color: #339933;">;</span>
    outputParameters.<span style="color: #202020;">hostApiSpecificStreamInfo</span> <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
&nbsp;
    err <span style="color: #339933;">=</span> Pa_OpenStream<span style="color: #009900;">&#40;</span>
              <span style="color: #339933;">&amp;</span>stream<span style="color: #339933;">,</span>
              <span style="color: #339933;">&amp;</span>inputParameters<span style="color: #339933;">,</span>
              <span style="color: #339933;">&amp;</span>outputParameters<span style="color: #339933;">,</span>
              SAMPLE_RATE<span style="color: #339933;">,</span>
              BLOCKSIZE<span style="color: #339933;">,</span>
              paClipOff<span style="color: #339933;">,</span> <span style="color: #808080; font-style: italic;">/* paClipOff, */</span>  <span style="color: #808080; font-style: italic;">/* we won't output out of range samples so don't bother clipping them */</span>
              NULL<span style="color: #339933;">,</span>
              NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
    err <span style="color: #339933;">=</span> Pa_StartStream<span style="color: #009900;">&#40;</span> stream <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// now run pd for ten seconds (logical time)</span>
	<span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
	<span style="color: #993333;">float</span> inbuf<span style="color: #009900;">&#91;</span>NBCHANNEL <span style="color: #339933;">*</span> BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> outbuf<span style="color: #009900;">&#91;</span>NBCHANNEL <span style="color: #339933;">*</span> BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NUMBERSECOND <span style="color: #339933;">*</span> SAMPLE_RATE <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span>BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// portaudio input</span>
		err <span style="color: #339933;">=</span> Pa_ReadStream<span style="color: #009900;">&#40;</span>stream<span style="color: #339933;">,</span> inbuf<span style="color: #339933;">,</span> BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// libpd process dsp</span>
		libpd_process_float<span style="color: #009900;">&#40;</span>inbuf<span style="color: #339933;">,</span> outbuf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// portaudio output</span>
		err <span style="color: #339933;">=</span> Pa_WriteStream<span style="color: #009900;">&#40;</span>stream<span style="color: #339933;">,</span> outbuf<span style="color: #339933;">,</span> BLOCKSIZE <span style="color: #339933;">*</span> TICK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//portaudio - stop stream, close, and terminate</span>
    err <span style="color: #339933;">=</span> Pa_StopStream<span style="color: #009900;">&#40;</span> stream <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
    err <span style="color: #339933;">=</span> Pa_CloseStream<span style="color: #009900;">&#40;</span> stream <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> err <span style="color: #339933;">!=</span> paNoError <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">goto</span> error<span style="color: #339933;">;</span>
&nbsp;
    Pa_Terminate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Test finished.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
error<span style="color: #339933;">:</span>
    Pa_Terminate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;An error occured while using the portaudio stream<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Error number: %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> err <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    fprintf<span style="color: #009900;">&#40;</span> stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Error message: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> Pa_GetErrorText<span style="color: #009900;">&#40;</span> err <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</p>
<p><strong>Want libpd.a?</strong><br />
<i>mkdir staticlib<br />
cp libpd_wrapper/*.o pure-data/src/*.o staticlib/<br />
ar rcs libpd.a *.o</i></p>
<p>compile your program with:<br />
<i>-Wl,&#8211;export-dynamic -Wl,&#8211;whole-archive ./libpd.a -Wl,&#8211;no-whole-archive</i>
</p>
<p><strong>WxWidgets C++ GUI example (wxlibpd)</strong><br />
<img src="http://www.workinprogress.ca/wp-content/uploads/wxlibpd1.jpg" alt="" title="wxlibpd" width="382" height="366" class="alignnone size-full wp-image-922" /><br />
<img src="http://www.workinprogress.ca/wp-content/uploads/wxlibpdpd.jpg" alt="" title="wxlibpdpd" width="638" height="375" class="alignnone size-full wp-image-926" /></p>
<p>Download project (codelite) &#038; exectuable (linux &#8211; gtk):<br />
<a href='http://www.workinprogress.ca/wp-content/uploads/wxlibpd.zip'>wxlibpd</a></p>
<p><strong>Documentation:</strong><br />
<a href="http://gitorious.org/pdlib/pages/Libpd">http://gitorious.org/pdlib/pages/Libpd</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/libpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pure data external pthread template</title>
		<link>http://www.workinprogress.ca/pure-data-external-pthread-template/</link>
		<comments>http://www.workinprogress.ca/pure-data-external-pthread-template/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 17:19:52 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=555</guid>
		<description><![CDATA[This external for Pure Data is using POSIX Threads for avoiding glitches in the DSP. Any recommendation to tight it up? threadtemplate.tar.gz Bonus: Le chat sort du sac]]></description>
			<content:encoded><![CDATA[<p>This external for <a href="http://puredata.info" target="_blank">Pure Data</a> is using <a href="http://en.wikipedia.org/wiki/POSIX_Threads" target="_blank">POSIX Threads</a> for avoiding glitches in the DSP. Any recommendation to tight it up?</p>
<p><a href="http://www.workinprogress.ca/wp-content/uploads/threadtemplate.tar.gz">threadtemplate.tar.gz</a></p>
<p>Bonus:<br />
<strong>Le chat sort du sac</strong><br />
<img src="http://www.workinprogress.ca/wp-content/plugins/flash-video-player/default_video_player.gif" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/pure-data-external-pthread-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.workinprogress.ca/wp-content/uploads/kicad_part1.mp4" length="34750464" type="video/mp4" />
		</item>
		<item>
		<title>face 2 blender</title>
		<link>http://www.workinprogress.ca/face-2-blender/</link>
		<comments>http://www.workinprogress.ca/face-2-blender/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 20:12:36 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Blender]]></category>
		<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=399</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5699993&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5699993&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/face-2-blender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gesture recognition in pure data with easystroke</title>
		<link>http://www.workinprogress.ca/gesture-recognition-in-pure-data-with-easystroke/</link>
		<comments>http://www.workinprogress.ca/gesture-recognition-in-pure-data-with-easystroke/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 18:07:28 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=291</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=5120962&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=5120962&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/gesture-recognition-in-pure-data-with-easystroke/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>sphinx3 to pure data</title>
		<link>http://www.workinprogress.ca/sphinx3-to-pure-data/</link>
		<comments>http://www.workinprogress.ca/sphinx3-to-pure-data/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 16:57:47 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=282</guid>
		<description><![CDATA[1- Basic software installation sudo apt-get install build-essential autoconf libtool automake libasound2-dev python-dev subversion sox libsox-fmt-all 2- Getting and installing Sphinx3 Download: sphinx3 sphinxbase mkdir sphinx &#38;&#38; cd sphinx tar xzpf sphinx3... tar xzpf sphinxbase... cd sphinxbase ./autogen.sh --prefix=/usr/local make &#38;#038;&#38;#038; make install cd sphinx3 ./autogen.sh --prefix=/usr/local make &#38;#038;&#38;#038; make install ldconfig cd python nano [...]]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="249" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=2814913&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="249" src="http://vimeo.com/moogaloop.swf?clip_id=2814913&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>1- Basic software installation</strong></p>
<p><pre><pre class="brush:bash">sudo apt-get install build-essential autoconf libtool automake libasound2-dev python-dev subversion sox libsox-fmt-all
</pre></pre></p>
<p><strong>2- Getting and installing Sphinx3</strong></p>
<p>Download:<br />
<a href="http://sourceforge.net/project/showfiles.php?group_id=1904&amp;package_id=68406">sphinx3</a><br />
<a href="http://sourceforge.net/project/showfiles.php?group_id=1904&amp;package_id=199515">sphinxbase</a></p>
<p><pre><pre class="brush:bash">
mkdir sphinx &amp;&amp; cd sphinx
tar xzpf sphinx3...
tar xzpf sphinxbase...
cd sphinxbase
./autogen.sh --prefix=/usr/local
make &amp;#038;&amp;#038; make install
cd sphinx3
./autogen.sh --prefix=/usr/local
make &amp;#038;&amp;#038; make install
ldconfig
cd python
nano setup.py (MODIFY THE PATHS)
python setup.py install
</pre></pre>
<p><strong>3- Download the patch, python script and lexical</strong></p>
<p><pre><pre class="brush:bash">
wget http://puredata.info/Members/patrick/sphinx2pd
tar xzpf sphinx2pd.tar.gz
cd sphinx2pd
pd sphinx2pd.pd
</pre></pre>
<p><strong>Make your own lexical and language modeling files</strong> <em>(optional)</em><br />
Upload your textfile containing your puredata commands here:<br />
<a href="http://www.speech.cs.cmu.edu/tools/lmtool.html">http://www.speech.cs.cmu.edu/tools/lmtool.html</a></p>
<p>Download the gzip&#8217;d tar file &amp; unzip it to /dic<br />
Dump in binary:</p>
<p><pre><pre class="brush:bash">
svn co https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/share/lm3g2dmp
cd lm3g2dmp &amp;#038;&amp;#038; make &amp;amp;&amp;amp; cd ..
lm3g2dmp/lm3g2dmp dic/XXXX.sent.arpabo dic
mv dic/XXXX.sent.arpabo.DMP dic/pd.dmp
mv dic/XXXX.dic dic/pd.dic
</pre></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/sphinx3-to-pure-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>chess music</title>
		<link>http://www.workinprogress.ca/chess-music/</link>
		<comments>http://www.workinprogress.ca/chess-music/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 22:58:10 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=238</guid>
		<description><![CDATA[A simple bridge between glchess and pure data:]]></description>
			<content:encoded><![CDATA[<p>A simple bridge between glchess and pure data:</p>
<p><object width="400" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5430536&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5430536&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="250"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/chess-music/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>theremin 2 pure data</title>
		<link>http://www.workinprogress.ca/theremin-2-pure-data/</link>
		<comments>http://www.workinprogress.ca/theremin-2-pure-data/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 17:38:47 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=235</guid>
		<description><![CDATA[My first electronic project (2005):]]></description>
			<content:encoded><![CDATA[<p>My first electronic project (2005):</p>
<p><object width="400" height="267"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5426041&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5426041&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="267"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/theremin-2-pure-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>stock market music</title>
		<link>http://www.workinprogress.ca/stock-market-music/</link>
		<comments>http://www.workinprogress.ca/stock-market-music/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 01:55:46 +0000</pubDate>
		<dc:creator>psc</dc:creator>
				<category><![CDATA[Pure Data]]></category>

		<guid isPermaLink="false">http://www.workinprogress.ca/?p=218</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="400" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5415629&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5415629&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="250"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.workinprogress.ca/stock-market-music/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

