<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Thoughts</title>
	<atom:link href="https://westkamper.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://westkamper.wordpress.com</link>
	<description>on audio DSP coding in Linux</description>
	<lastBuildDate>Sat, 11 May 2013 10:17:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='westkamper.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s2.wp.com/i/buttonw-com.png</url>
		<title>Thoughts</title>
		<link>https://westkamper.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://westkamper.wordpress.com/osd.xml" title="Thoughts" />
	<atom:link rel='hub' href='https://westkamper.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Typed Lisp adventure</title>
		<link>https://westkamper.wordpress.com/2013/04/20/typed-lisp-adventure/</link>
		<comments>https://westkamper.wordpress.com/2013/04/20/typed-lisp-adventure/#comments</comments>
		<pubDate>Sat, 20 Apr 2013 16:47:30 +0000</pubDate>
		<dc:creator>timowest</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://westkamper.wordpress.com/?p=131</guid>
		<description><![CDATA[After having been inspired by overtone and extempore to try out a Lisp dialect for DSP coding I wondered if it would be possible to use a Lisp language directly in synth plugins without a host environment. My second (or &#8230; <a href="https://westkamper.wordpress.com/2013/04/20/typed-lisp-adventure/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=131&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>After having been inspired by <a href="https://github.com/overtone/overtone" title="overtone">overtone</a> and <a href="https://github.com/digego/extempore" title="extempore">extempore</a> to try out a Lisp dialect for DSP coding I wondered if it would be possible to use a Lisp language directly in synth plugins without a host environment.</p>
<p>My second (or third) language in daytime programming is <a href="http://clojure.org/" title="Clojure">Clojure</a>, which I am very content with, so I wanted to use something similar in my &#8220;freetime&#8221; for DSP programming. I initally tried some Scheme dialects such a Chicken, Gambit and Bigloo, but became a little annoyed by the verbose syntax and the lack of proper abstractions for collection like types.</p>
<p>On GitHub I stumbled upon a few statically typed Lisp dialects and was especially convinced by looking at extempore that writing a statically typed LISP was possible and for some programming domains even useful. So I decided to write something similar like extempore, but with Clojure syntax instead of Scheme and without a host environment but gcc based compilation instead. I named the exercise <a href="https://github.com/timowest/symbol" title="symbol">symbol</a>.</p>
<p>I considered using LLVM as the compilation backend briefly, but found especially closure handling too difficult to handle, since I hadn&#8217;t any prior experience in compiler programming. I went with using C++11 as the target language since it has some nice features such as templates, closures, direct C bindings and fast compilers.</p>
<p>Next I began to sketch the architecture for my language compiler. After a few iterations and studying various Clojure/script compilation projects I went with</p>
<ul>
<li>reading via a customized Clojure Lisp reader</li>
<li>macro expansion, using Clojure macros</li>
<li>form normalization via various function based rules</li>
<li>type inference using <a href="https://github.com/clojure/core.logic" title="core.logic">core.logic</a>
<li>serialization to C++</li>
<li>compilation via g++</li>
</ul>
<p>The most challenging part was probably the type inference. Having used logic programming actively 10 years ago it was a little difficult to get into logic programming concepts again, but after a few core.logic performance issues, most things went quite smoothly.</p>
<p>I was able to infer variable types based on assignments and function argument and return types via body expressions using a simplified version of the <a href="https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner" title="Hindley-Milner"></a> type inference. In addition to Hindley-Milner type inference I also extended the set of literals of the syntax via a custom reader to support integer and float literals in addition to ones Clojure supports.</p>
<p>I was quite successful with porting simple extempore examples to symbol, but struggled with more complex programs. I also couldn&#8217;t decide whether to include garbage collection or not. Using smart C++ pointers might have been a good alternative, but might have been difficult for type inference, so I continued with raw pointers and without garbage collection.</p>
<p>I tried to use C++ bindings directly via <a href="http://gccxml.github.io/HTML/Index.html">gccxml</a> which dumps the intermediate format of the gcc compilation via XML, but had some issues with it. gccxml doesn&#8217;t support templates and the XML format was difficult to transform into a form that was compatible with the types of the type inference.</p>
<p>Another difficult issue was to map both stack and heap allocation to the minimal syntax of symbol. After a while I gave up and began to use C++ directly for DSP programming. All in all this was a really interesting experience to sketch a new language, or better a compilation chain, since what I did could also be described as mapping a subset of Clojure syntax to C++. I might continue with symbol once I am more familiar with C++, but for now it&#8217;s suspended.</p>
<p>Various syntax examples are available <a href="https://github.com/timowest/symbol/tree/master/dev-resources/tests">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/westkamper.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/westkamper.wordpress.com/131/" /></a> <img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=131&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://westkamper.wordpress.com/2013/04/20/typed-lisp-adventure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="https://2.gravatar.com/avatar/2a812bdd1b242988b293b218d02c881e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timowest</media:title>
		</media:content>
	</item>
		<item>
		<title>Diving into D</title>
		<link>https://westkamper.wordpress.com/2012/05/01/diving-into-d/</link>
		<comments>https://westkamper.wordpress.com/2012/05/01/diving-into-d/#comments</comments>
		<pubDate>Tue, 01 May 2012 07:49:36 +0000</pubDate>
		<dc:creator>timowest</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://westkamper.wordpress.com/?p=105</guid>
		<description><![CDATA[After having used C++ and Faust for a while to write Synth plugins I decided to try out some alternatives. My main requirements for the language were automatic memory management, easy to use bidirectional C interfacing for using and exposing &#8230; <a href="https://westkamper.wordpress.com/2012/05/01/diving-into-d/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=105&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>After having used C++ and <a href="http://faust.grame.fr/">Faust</a> for a while to write Synth plugins I decided to try out some alternatives. My main requirements for the language were automatic memory management, easy to use bidirectional C interfacing for using and exposing C libraries and support for functional programming. I considered amongst others <a href="http://caml.inria.fr/ocaml/">OCaml</a>, <a href="http://www.haskell.org/haskellwiki/Haskell">Haskell</a>, <a href="http://dlang.org/">D</a> and <a href="http://live.gnome.org/Vala">Vala</a> as language options. After a small evaluation of the options I decided to focus on D. OCaml didn&#8217;t look like a <a href="http://adam.chlipala.net/mlcomp/">proper evolution over Standard ML</a>, Haskell too demanding to learn and Vala with too many Gnome dependencies.</p>
<p>D is a statically typed C-based language with the ambitious goal to provide a better C++. It feels more consistent than C++, but sits oddly between a system and application level language. As a small exercise I ported the <a href="https://github.com/timowest/synd">STK</a> library to D to get a better feel of the language features. I named the port <a href="https://github.com/timowest/synd">synd</a>.</p>
<p>What I liked were the module system, properties, type inference and integrated support for unit tests. What I found confusing were mutability of ranges, initialization of members and the quite <a href="http://forum.dlang.org/thread/jnhe1i$2vcm$1@digitalmars.com">heterogeneous community</a>. Missing support for shared library creation in Linux is a showstopper for now.</p>
<p>I am still trying to figure out whether to use closures for lower level elements or Class based objects. The FP approach allows for more consistent types and composition of elements whereas the OOP approach offers better separation between configuration and other method calls.</p>
<p>Cascaded delegate construction would also work in D. And it works quite well for elements where only static and sample based configuration parameters are used. For configuration updates let&#8217;s say every 32 samples something else would need to be used.</p>
<p>Both <a href="https://github.com/digego/extempore">extempore</a> and <a href="http://rosejn.github.com/overtone/">Overtone</a> look like good sources of inspiration for doing functional audio coding.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/westkamper.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/westkamper.wordpress.com/105/" /></a> <img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=105&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://westkamper.wordpress.com/2012/05/01/diving-into-d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="https://2.gravatar.com/avatar/2a812bdd1b242988b293b218d02c881e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timowest</media:title>
		</media:content>
	</item>
		<item>
		<title>Soft synth plugins for Linux</title>
		<link>https://westkamper.wordpress.com/2012/03/03/soft-synth-plugins-for-linux/</link>
		<comments>https://westkamper.wordpress.com/2012/03/03/soft-synth-plugins-for-linux/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 08:08:37 +0000</pubDate>
		<dc:creator>timowest</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://westkamper.wordpress.com/?p=67</guid>
		<description><![CDATA[Before starting with a new Soft synth project for Linux I decided to track what kind of synthesizers are already out there available. I focused on LV2 plugins, since LV2 is the plugin standard I want to use. LADSPA is &#8230; <a href="https://westkamper.wordpress.com/2012/03/03/soft-synth-plugins-for-linux/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=67&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Before starting with a new Soft synth project for Linux I decided to track what kind of synthesizers are already out there available. I focused on LV2 plugins, since LV2 is the plugin standard I want to use. LADSPA is outdated and DSSI doesn&#8217;t seem to be as widely used as LV2.</p>
<p>With the aim to provide a clear separation between the synthesis engine, the LV2 integration and the GUI I focused also on architectural aspects.</p>
<p>So here is a list of LV2 soft synths for Linux in no particular order.</p>
<h3>Calf plugins</h3>
<p><a target="_blank" href="http://calf.sourceforge.net/">Calf plugins</a> provides a set of plugins available as LV2, including a flanger, an organ synth, a phaser, a reverb, some filters, a chorus and a rotary speaker simulator.</p>
<div id="attachment_78" class="wp-caption alignnone" style="width: 610px"><a href="http://westkamper.files.wordpress.com/2012/03/calf-monosynth-git-600x309.png"><img class="size-full wp-image-78" title="calf-monosynth-git-600x309" src="http://westkamper.files.wordpress.com/2012/03/calf-monosynth-git-600x309.png?w=584" alt=""   /></a><p class="wp-caption-text">Calf Monosynth</p></div>
<p>The Calf Monosynth is a monophonic subtractive soft synth.</p>
<div id="attachment_79" class="wp-caption alignnone" style="width: 640px"><a href="http://westkamper.files.wordpress.com/2012/03/calf-organ-git.png"><img class="size-full wp-image-79" title="calf-organ-git" src="http://westkamper.files.wordpress.com/2012/03/calf-organ-git.png?w=584" alt=""   /></a><p class="wp-caption-text">Calf Organ</p></div>
<p>The Calf Organ is a mixture of a traditional drawbar organ and a subtractive synth.</p>
<div id="attachment_77" class="wp-caption alignnone" style="width: 636px"><a href="http://westkamper.files.wordpress.com/2012/03/calf-fluidsynth.png"><img class="size-full wp-image-77" title="calf-fluidsynth" src="http://westkamper.files.wordpress.com/2012/03/calf-fluidsynth.png?w=584" alt=""   /></a><p class="wp-caption-text">Calf Fluidsynth</p></div>
<p>The Calf Fluidsynth is a frontend for the Fluidsynth Sampler engine.</p>
<h3>foo-yc20</h3>
<p>The YC-20 is a divide-down combo organ designed in the late 60&#8242;s. The <a target="_blank" href="http://code.google.com/p/foo-yc20/">foo-yc20</a> emulation faithfully copies the features, sounds and flaws of the original organ.</p>
<div id="attachment_83" class="wp-caption alignnone" style="width: 640px"><a href="http://westkamper.files.wordpress.com/2012/03/foo-yc20.png"><img class="size-full wp-image-83" title="foo-yc20" src="http://westkamper.files.wordpress.com/2012/03/foo-yc20.png?w=584" alt=""   /></a><p class="wp-caption-text">Foo YC20</p></div>
<h3>Newtonator</h3>
<p>The <a target="_blank" href="http://newtonator.sourceforge.net/">Newtonator</a> is a LV2 soft synth that produces some unpredictable sounds.</p>
<div id="attachment_84" class="wp-caption alignnone" style="width: 640px"><a href="http://westkamper.files.wordpress.com/2012/03/newtonator.png"><img class="size-full wp-image-84" title="newtonator" src="http://westkamper.files.wordpress.com/2012/03/newtonator.png?w=584" alt=""   /></a><p class="wp-caption-text">Newtonator</p></div>
<h3>LinuxSampler</h3>
<p>The <a target="_blank" href="http://www.linuxsampler.org/">LinuxSampler</a> is a streaming capable open source pure software audio sampler with professional grade features.</p>
<p><a href="http://westkamper.files.wordpress.com/2012/03/linuxsampler-lv2.png"><img class="alignnone size-full wp-image-85" title="linuxsampler-lv2" src="http://westkamper.files.wordpress.com/2012/03/linuxsampler-lv2.png?w=584" alt=""   /></a></p>
<h3>Minaton</h3>
<p>The <a target="_blank" href="http://sourceforge.net/projects/minaton/">Minaton</a> is a fat sounding mono subtractive software synthesizer.</p>
<div id="attachment_86" class="wp-caption alignnone" style="width: 640px"><a href="http://westkamper.files.wordpress.com/2012/03/minaton-jan-2012.png"><img class="size-full wp-image-86" title="minaton-jan-2012" src="http://westkamper.files.wordpress.com/2012/03/minaton-jan-2012.png?w=584" alt=""   /></a><p class="wp-caption-text">Minaton</p></div>
<h3>ll-plugins</h3>
<p><a href="http://ll-plugins.nongnu.org/">ll-plugins</a> provides several synth and utility plugins and a GUI-capable host.</p>
<h3>Composite Sampler</h3>
<p><a target="_blank" href="http://gabe.is-a-geek.org/composite/plugins/sampler/1/">Composite Sampler</a> is a LV2 plugin that acts as a MIDI-controllable sampler.</p>
<h3>lv2-mdaEPiano</h3>
<p><a target="_blank" href="https://github.com/rekado/lv2-mdaEPiano">lv2-mdaEPiano</a> is a native LV2 port of the famous mdaEPiano VSTi.</p>
<h3>mda-lv2</h3>
<p><a href="http://drobilla.net/software/mda-lv2/">mda-lv2<a> is an LV2 port of the popular VST mda plugins.</p>
<h3>Russolo Suite</h3>
<p>The <a target="_blank" href="http://intonarumori.sourceforge.net/">Russolo Suite</a> consists of the CrazySynth Synthesizer and the &#8220;the do-it-all effect&#8221; Omnifono.</p>
<h3>So-synth-LV2</h3>
<p><a target="_blank" href="https://github.com/jeremysalwen/So-synth-LV2">So-synth-LV2</a> provides unofficial LV2 ports of 50m30n3&#8242;s synthesizers.</p>
<h3>Zyn</h3>
<p><a target="_blank" href="http://home.gna.org/zyn/">Zyn</a> provides an LV2 port of Zynaddsubfx.</p>
<h3>Qin</h3>
<p><a target="_blank" href="https://github.com/magnusjonsson/qin">Qin</a> is a LV2 synth plugin for plucking sounds</p>
<h3>Minicomputer-LV2</h3>
<p><a target="_blank" href="https://github.com/jeremysalwen/Minicomputer-LV2">Minicomputer-LV2</a> is a softsynth for creating experimental electronic sounds</p>
<h3>lv2_guitar</h3>
<p><a target="_blank" href="http://www.lms.lnt.de/research/activity/systems/topics/synth/index_lv2.shtml">lv2_guitar</a> is another String synth</p>
<p>This list has been assembled from the contents of the following two webpages:</p>
<ul>
<li><a target="_blank" href="http://wootangent.net/2011/06/lv2-synths-for-ardour-3-a-list">lv2 synths for ardour 3</a></li>
<li><a target="_blank" href="http://lv2plug.in/trac/wiki/Plugins">LV2 Plugins</a></li>
</ul>
<h2>Summary</h2>
<p>Here is also an overview of the used programming languages and GUI toolkits in each plugin:</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Languages</th>
<th>GUI</th>
<th>Remarks</th>
</tr>
</thead>
<tbody>
<tr>
<td><a target="_blank" href="http://calf.sourceforge.net/">Calf Plugins</a></td>
<td>C++</td>
<td>GTK+</td>
<td>UI is defined in XML, knobs are created from SVG files and rendered via Cairo</td>
</tr>
<tr>
<td><a target="_blank" href="http://code.google.com/p/foo-yc20/">foo-yc20</a></td>
<td>C/C++/Faust</td>
<td>GTK+</td>
<td><a href="http://faust.grame.fr/">Faust</a> is a functional language for DSP design</td>
</tr>
<tr>
<td><a target="_blank" href="http://newtonator.sourceforge.net/">Newtonator</a></td>
<td>C++</td>
<td>GTK+</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="http://www.linuxsampler.org/">LinuxSampler</a></td>
<td>C++</td>
<td>Qt4</td>
<td>Qt4 is only one GUI option, there is also a Java based UI</td>
</tr>
<tr>
<td><a target="_blank" href="http://sourceforge.net/projects/minaton/">Minaton</a></td>
<td>C++</td>
<td>FLTK</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="http://ll-plugins.nongnu.org/">ll-plugins</a></td>
<td>C++</td>
<td>GTK+</td>
<td>ported from DSSI plugins</td>
</tr>
<tr>
<td><a target="_blank" href="http://gabe.is-a-geek.org/composite/plugins/sampler/1/">Composite Sampler</a></td>
<td>C++</td>
<td>-</td>
<td>part of bigger Composite audio system effort</td>
</tr>
<tr>
<td><a target="_blank" href="https://github.com/rekado/lv2-mdaEPiano">lv2-mdaEPiano</a></td>
<td>C++</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="http://intonarumori.sourceforge.net/">Russolo Suite</a></td>
<td>C</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="https://github.com/jeremysalwen/So-synth-LV2">So-synth-LV2</a></td>
<td>C</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="http://home.gna.org/zyn/">Zyn</a></td>
<td>C/C++</td>
<td>-</td>
<td>extracted Synth engines from <a href="http://zynaddsubfx.sourceforge.net/">ZynAddSubFx</a></td>
</tr>
<tr>
<td><a target="_blank" href="https://github.com/magnusjonsson/qin">Qin</a></td>
<td>C</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="https://github.com/jeremysalwen/Minicomputer-LV2">Minicomputer-LV2</a></td>
<td>C</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><a target="_blank" href="http://www.lms.lnt.de/research/activity/systems/topics/synth/index_lv2.shtml">lv2_guitar</a></td>
<td>C</td>
<td>-</td>
<td>-</td>
</tr>
</tbody>
</table>
<p>From this overview can be seen that most of the GUI-less plugins have been written in C++, whereas the plugins with GUIs have been mostly written in C++. GTK+ is prefered over Qt and FLTK as a GUI toolkit.</p>
<h2>Popular Non-LV2 synths</h2>
<p>As the LV2 plugin is still quite new, there are lots of great established soft synth projects that are not available in LV2 format.</p>
<p>Here are some of the more popular options:</p>
<table>
<tr>
<td>Name</td>
<td>Languages</td>
<td>GUI</td>
<td>Remarks</td>
</tr>
<tr>
<td><a href="http://code.google.com/p/amsynth/">amSynth</a></td>
<td>C++</td>
<td>GTK++</td>
<td>Subtractive synth with 2 Oscillators</td>
</tr>
<tr>
<td><a href="http://sourceforge.net/projects/bristol/">Bristol Audio Synthesis</a></td>
<td>C</td>
<td>?</td>
<td>Emulation of various vintage keyboard synths</td>
</tr>
<tr>
<td><a href="http://qsynth.sourceforge.net/qsynth-index.html">Qsynth</a></td>
<td>C++</td>
<td>Qt4</td>
<td>Popular Qt based frontend for FluidSynth</td>
</tr>
<tr>
<td><a href="http://zynaddsubfx.sourceforge.net/">ZynAddSubFx</a></td>
<td>C++</td>
<td>FLTK</td>
<td>Very popular synth with three different synth engines</td>
</tr>
<tr>
<td><a href="http://www.hydrogen-music.org/hcms/">Hydrogen</a></td>
<td>C++</td>
<td>Qt4</td>
<td>Popular drum machine</td>
</tr>
<tr>
<td><a href="http://dssi.sourceforge.net/hexter.html">hexter</a></td>
<td>C</td>
<td>GTK+</td>
<td>very good Yamaha DX7 synth emulation</td>
</tr>
<tr>
<td><a href="http://smbolton.com/whysynth.html">WhySynth</a></td>
<td>C</td>
<td>GTK+</td>
<td>Versatile multi paradigm soft synth</td>
</tr>
</table>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/westkamper.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/westkamper.wordpress.com/67/" /></a> <img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=67&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://westkamper.wordpress.com/2012/03/03/soft-synth-plugins-for-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="https://2.gravatar.com/avatar/2a812bdd1b242988b293b218d02c881e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timowest</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/calf-monosynth-git-600x309.png" medium="image">
			<media:title type="html">calf-monosynth-git-600x309</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/calf-organ-git.png" medium="image">
			<media:title type="html">calf-organ-git</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/calf-fluidsynth.png" medium="image">
			<media:title type="html">calf-fluidsynth</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/foo-yc20.png" medium="image">
			<media:title type="html">foo-yc20</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/newtonator.png" medium="image">
			<media:title type="html">newtonator</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/linuxsampler-lv2.png" medium="image">
			<media:title type="html">linuxsampler-lv2</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2012/03/minaton-jan-2012.png" medium="image">
			<media:title type="html">minaton-jan-2012</media:title>
		</media:content>
	</item>
		<item>
		<title>Polyphonic Faust?</title>
		<link>https://westkamper.wordpress.com/2011/11/09/polyphonic-faust/</link>
		<comments>https://westkamper.wordpress.com/2011/11/09/polyphonic-faust/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 19:14:19 +0000</pubDate>
		<dc:creator>timowest</dc:creator>
				<category><![CDATA[faust]]></category>

		<guid isPermaLink="false">http://westkamper.wordpress.com/?p=22</guid>
		<description><![CDATA[After my Physical Modeling Flute Faust experience I decided to try to model a virtual analog synthesizer in Faust. I looked at several synth structures and came up with this fairly standard wiring : 2 LFOS, 2 Oscillators, Noise generation, &#8230; <a href="https://westkamper.wordpress.com/2011/11/09/polyphonic-faust/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=22&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>After my Physical Modeling Flute Faust experience I decided to try to model a virtual analog synthesizer in Faust. I looked at several synth structures and came up with this fairly standard wiring :</p>
<p><a href="http://westkamper.files.wordpress.com/2011/11/screenshot-at-2011-11-09-203739.png"><img class="alignnone size-full wp-image-25" title="Block diagram" src="http://westkamper.files.wordpress.com/2011/11/screenshot-at-2011-11-09-203739.png?w=584" alt=""   /></a></p>
<p>2 LFOS, 2 Oscillators, Noise generation, 2 Filters, 2 Amplifiers and 4 ADSR envelopes (integrated in Filters and Amplifiers).</p>
<p>Designing this in monophonic form was fairly easy, as no recursion in top level elements was needed like in many physical modeling designs. For oscillators, filters and envelopes standard components of the Faust libraries were used. Finishing a monophonic synth was easy.</p>
<p>Changing the monophonic synth into a polyphonic one was also quite straight forward. The single gate, gain and pitch controls for a single voice needed to be duplicated. I moved the original process declaration into a single voice with the following definition</p>
<pre>voice(gate, gain, pitch) = (lfo1, lfo2) &lt;: (_,_,osc1,osc2,noisegen)
  : (_,_,pre_filter_mix) // l1, l2, f1_in, f2_in
  // to filters
  &lt;: ((_,_,!,_), ((_,!,_,!) : filter1)) // l1, l2, f2_in, filter1, filter1_to_f2
  &lt;: ((_,!,!,_,!), (!,_,!,!,!), ((!,_,_,!,_) : (_,_+_) : filter2)) // l1,   f1_out, l2, f2_out
  // to amps
  : (amp1, amp2)
with {
    // ...
    // in : o11, o12, o21, o22, n1, n2
    // out : f1_in, f2_in
    pre_filter_mix = bus6 &lt;: (((_,!,_,!,_,!) : _+_+_), ((!,_,!,_,!,_) : _+_+_));
};
</pre>
<p>The new process looks like this</p>
<pre>process = par(i, 8, voice(i)) :&gt; (_,_,_,_) : effects :&gt; (main_out * _, main_out * _);</pre>
<p>8 voices are run in parallel and are then mixed into a 4 channel signal which is fed to the effects section and then fed to Stereo out.</p>
<p>A problem with this design is that all the 8 voices are always on. And the resulting Faust structure is quite large and takes a long time to compile. With several compiler level optimizations this design can be made runnable.</p>
<p>Other performance issues are on a lower level with select2 and select3 constructs, which are Faust&#8217;s if-else equivalents. Non-active branches can only be skipped in Faust if they have no memory. Memory, or state, is involved if you use any kind of delays, either explicitly or via usage of recursion. The &#8220;always on&#8221; philosophy needs to be taken into account on every level, if low CPU usage is a goal.</p>
<p>I defined a single multi-waveform oscillator like this</p>
<pre>
oscillator(type, freq, width) = select5(type,
    osc(freq),
    triangle(freq),
    sawtooth(freq),
    squarewave(freq, width),
    random);
</pre>
<p>As all of these components use state internally to keep track of the current phase all of them are always run.</p>
<p>One way to fix this is to separate the phase which is stateful and needs to be memorized from the wave shape generation. This is another oscillator design which has stateless functions in the wave selection :</p>
<pre>
oscillator(type, freq, width) = phase(freq) : phase_to_osc(type, width);

phase(freq) = (+(q) : mod1) ~ _
with {
    q = float(freq)/float(SR);
};

phase_to_osc(type, width) = _ &lt;: select5(type,
    sin(2*PI*_),
    tri,
    saw,
    square(width),
    osclib.noise);

square(w) = select2(_ &lt; w, -1.0, 1.0);

saw = bi;

tri = bi : fabs : bi;

bi = 2.0*_ - 1.0;

mod1 = fmod(_, 1.0);
</pre>
<p>phase is the phase generation and phase_to_osc is the wave shaper.</p>
<p>I will probably use this kind of phaseshaping oscillator structure also for my coming synth projects, Faust and non-Faust, because it is really flexible. More about this approach is explained in this paper : <a href="http://smcnetwork.org/files/proceedings/2010/15.pdf">Phaseshaping Oscillator Algorithms for Musical Sound Synthesis</a></p>
<p>With the multi-mode filter there is a similar issue. My current naive form looks like this</p>
<pre>
reson_filter(type, freq, res) = _ &lt;: select4(type,
    resonlp(freq, res, 1.0), // lowpass
    resonhp(freq, res, 1.0), // highpass
    resonbp(freq, res, 1.0), // bandpass
    resonbr(freq, res, 1.0)) // bandreject
with {
    resonbr(fc,Q,gain,x) = (gain * x) - resonbp(fc,Q,gain,x);
};
</pre>
<p>I have experienced a little bit with Moog ladder filter designs in Faust, but nothing really properly working has come out yet.</p>
<p>This synth is again wrapped as LV2 synth plugin with a GTK+ gui. I used Cairo to draw the knobs. Here is a screenshot :</p>
<p><a href="http://westkamper.files.wordpress.com/2011/11/screenshot-at-2011-11-09-2025231.png"><img class="alignnone size-full wp-image-24" title="Screenshot at 2011-11-09 20:25:23" src="http://westkamper.files.wordpress.com/2011/11/screenshot-at-2011-11-09-2025231.png?w=584" alt=""   /></a></p>
<p>The code is hosted at <a href="https://github.com/timowest/analogue">GitHub</a>, so take a look if you are interested. I do not plan to maintain this project much, as I don&#8217;t see Faust in it&#8217;s current form the right tool for virtual analog synth design. Things I intended but didn&#8217;t manage to do are listed in the <a href="https://github.com/timowest/analogue/issues?sort=created&amp;direction=desc&amp;state=open">Issues section</a>.</p>
<p>Polyphonic operation inside Faust is slow and I expect modulation matrices, alternative wirings and unison modes to be difficult to implement. Faust works quite well though for monophonic synths with a fairly static wiring, since the automatic SVG generation from Faust code makes such structures much more accessible than code.</p>
<p><a href="https://github.com/timowest/flauta">Flauta</a> is a project I am currently working on. It is a port of a <a href="https://ccrma.stanford.edu/software/stk/">STK</a> based Flute model by Patricio de la Cuadra to Faust. Flauta is monophonic, uses a complex but static structure and most of the elements are mandatory, so Faust is a great match. I will write more about Flauta when we get some proper releases done.</p>
<p>Have you tried similar things with Faust? I am interested to hear more about Synth projects with Faust.</p>
<p>Concerning Virtual Analog in Faust, there is also the <a href="http://code.google.com/p/foo-yc20/">foo-yc20</a> project by Sampo Savolainen, which is a virtual model of the Yamaha YC-20 organ. It also uses a polyphonic design on the Faust level and has a much nicer GUI than mine <img src='https://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/westkamper.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/westkamper.wordpress.com/22/" /></a> <img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=22&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://westkamper.wordpress.com/2011/11/09/polyphonic-faust/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="https://2.gravatar.com/avatar/2a812bdd1b242988b293b218d02c881e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timowest</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2011/11/screenshot-at-2011-11-09-203739.png" medium="image">
			<media:title type="html">Block diagram</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2011/11/screenshot-at-2011-11-09-2025231.png" medium="image">
			<media:title type="html">Screenshot at 2011-11-09 20:25:23</media:title>
		</media:content>
	</item>
		<item>
		<title>Flute synthesis with Faust</title>
		<link>https://westkamper.wordpress.com/2011/08/24/flute-synthesis-with-faust/</link>
		<comments>https://westkamper.wordpress.com/2011/08/24/flute-synthesis-with-faust/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 19:39:30 +0000</pubDate>
		<dc:creator>timowest</dc:creator>
				<category><![CDATA[faust]]></category>

		<guid isPermaLink="false">http://westkamper.wordpress.com/?p=9</guid>
		<description><![CDATA[A while ago I purchased an Akai EWI 4000s wind controller and as a Ubuntu user I tried to find suitable synthesizers to be used with my controller, since the built in sounds are fairly synthetic sounding. After having searched &#8230; <a href="https://westkamper.wordpress.com/2011/08/24/flute-synthesis-with-faust/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=9&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A while ago I purchased an <a href="http://www.akaipro.com/ewi4000s">Akai EWI 4000s</a> wind controller and as a Ubuntu user I tried to find suitable synthesizers to be used with my controller, since the built in sounds are fairly synthetic sounding.</p>
<p>After having searched for a while I decided that I could write my own. Java is my strongest programming language, but Java didn&#8217;t feel like a good tool to write a synthesizer, because of my fear that garbage collection cycles would cause lots of clicks and glitches in the audio output.</p>
<p>Now I delved a bit more into synth programming. I read some books on C and C++ programming and picked the <a href="http://lv2plug.in/trac/">LV2</a> audio plugin standard as the glue library between my DSP code and a synth host. LV2 is the successor to the <a href="http://www.ladspa.org/">LADSPA</a> standard, and as we are talking about Linux standards here, it is not the only one, and seems to be competing at least with VST for Linux and <a href="http://dssi.sourceforge.net/">DSSI</a>.</p>
<p>The C API for LV2 is fairly understandable, but I picked the object oriented way, because I found the excellent <a href="http://ll-plugins.nongnu.org/hacking.html">LV2 C++ tools</a> wrapper library. <a href="http://www.nongnu.org/ll-plugins/lv2pftci/">LV2 programming for the complete idiot</a> is a very good tutorial for this library. Also the study of the <a href="https://github.com/rekado/lv2-mdaEPiano">lv2-mdaEPiano</a> sources was helpful.</p>
<p>After I had mastered enough C++ and had picked the right libraries I was ready to get started. I was already before familiar with Physical modeling synthesis, and picked it as the synthesis paradigm. To be more exact, <a href="http://en.wikipedia.org/wiki/Digital_waveguide_synthesis">Waveguide synthesis</a>.</p>
<p>I picked the <a href="https://ccrma.stanford.edu/software/stk/">STK</a> library as another dependency, to get the proper building blocks for waveguide synthesis and some example models. While the STK source code is quite nice to read, the library is a little bit verbose and after some time I got frustrated and decided to replace the STK library with something more agile.</p>
<p>I searched around and found the <a href="http://code.google.com/p/stk-faust/">stk-faust</a> project, a port of the STK instruments to the <a href="http://faust.grame.fr/">Faust</a> programming language. Faust is a functional programming realtime audio signal processing. I read some tutorials on Faust and decided that the compact syntax, the block diagram auto-generation and benchmarks were convincing enough to try it out.</p>
<p>After that I studied the Faust based STK instrument ports and tried to integrate the flute model into LV2 context. This proved to be quite easy, all I had to was connecting the audio buffers and sync the control parameters. But I wanted to try a little bit more expressive model of the Flute. I picked an improved <a href="http://www.tml.tkk.fi/Research/DIVA/past/publications/NAM96/rjh/html/paper.htm">Waveguide model of a Flute</a> and began to port it into Faust.</p>
<p>This took some while as modeling feedback loops and crossing connections in Faust is well supported, but syntactically weird. Nevertheless I got it finished after some time and managed to play some Flute like sounds with it.</p>
<p>Here is the top level diagram for it :</p>
<p><a href="http://westkamper.files.wordpress.com/2011/08/screenshot.png"><img class="alignnone size-medium wp-image-10" title="Flute block diagram" src="http://westkamper.files.wordpress.com/2011/08/screenshot.png?w=600&#038;h=256" alt="" width="600" height="256" /></a></p>
<p>The sources are accessible from <a href="https://github.com/timowest/flute-lv2">GitHub</a></p>
<p>The model has several shortcomings though. I have not yet been able to model the involved lowpass filters properly, toneholes are not included in the model which makes pitch changes sound unnatural and the excitation is pure white noise.</p>
<p>Concerning using Faust for your DSP projects, I believe that it is a very good language for structurally unchanging models. If there lots of dynamic components in your model that can be added, removed and moved around than Faust is probably not the right tool. If your model is fairly static and C++ works for you as an integration language, then give it a try.</p>
<p>I was very convinced by the Faust syntax, block diagram generation, UI building approach and easy integration into various contexts.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/westkamper.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/westkamper.wordpress.com/9/" /></a> <img alt="" border="0" src="https://stats.wordpress.com/b.gif?host=westkamper.wordpress.com&#038;blog=25896824&#038;post=9&#038;subd=westkamper&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://westkamper.wordpress.com/2011/08/24/flute-synthesis-with-faust/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="https://2.gravatar.com/avatar/2a812bdd1b242988b293b218d02c881e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timowest</media:title>
		</media:content>

		<media:content url="http://westkamper.files.wordpress.com/2011/08/screenshot.png?w=300" medium="image">
			<media:title type="html">Flute block diagram</media:title>
		</media:content>
	</item>
	</channel>
</rss>
