<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by devartis on Medium]]></title>
        <description><![CDATA[Stories by devartis on Medium]]></description>
        <link>https://medium.com/@devartis?source=rss-f5a88b8396ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*s0_06fMEeffCuBbW.png</url>
            <title>Stories by devartis on Medium</title>
            <link>https://medium.com/@devartis?source=rss-f5a88b8396ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:19:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devartis/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A first glance over Wolfram|Alpha’s Webservice API]]></title>
            <link>https://medium.com/devartis/a-first-glance-over-wolfram-alphas-webservice-api-cac49888d247?source=rss-f5a88b8396ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/cac49888d247</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[devartis]]></dc:creator>
            <pubDate>Wed, 21 Oct 2009 22:51:58 GMT</pubDate>
            <atom:updated>2018-06-18T13:45:01.392Z</atom:updated>
            <content:encoded><![CDATA[<p>A few days ago <a href="http://blog.wolframalpha.com/2009/10/15/the-wolframalpha-api-has-arrived/">Wolfram|Alpha announced the release of their Webservice API</a> to allow the usage of their computational knowledge engine on user’s applications. The API allows clients to submit free-form queries which return information in a variety of formats.</p><p>As you might know, Wolfram|Alpha is not a search engine, but an answer engine that answers free-form queries and computational requests by computing answers using structured data. This contrasts from traditional search engines that return as an answer a list of documents or web pages that might or not contain the answer the user is looking for. Wolfram|Alpha also is capable of processing and answering natural language queries (as it’s predecessor <a href="http://start.csail.mit.edu/">START</a>) such as <a href="http://www.wolframalpha.com/input/?i=What+is+the+second+largest+southamerican+country+by+area%3F">What is the second largest southamerican country by area?</a></p><p>In order to be able to use the API you must first <a href="http://products.wolframalpha.com/api/pricing.html">apply for an Application ID</a>, which is a string that identifies an application that uses the API, and it must be supplied in all calls to the API. There is no free of charge API availability as of today: Wolfram|Alpha offers <a href="http://products.wolframalpha.com/api/pricing.html">three different licensing plans</a> each having different pricing and request limits.</p><p>The request, apart from the query text, can be configured with a rich variety of options that are out of scope of this post entry. These options allow users to control timeouts for the queries, to control which result components (pods) will be processed and also to specify which ones should be to be retrieved asynchronously. The API request can be geo-localized as users can feed the engine with a location description such as “Buenos Aires, Argentina”, a latitude-longitude pair (-34.61,-58.37) or an IP address if you wish to propagate the IP of the user interacting with your application to the engine.</p><p>The REST-style API provides structured XML output formatted as image, text, audio or styled HTML. These output formats are known as Visual Representations. The main information unit in the response is the <em>pod</em>, which is corresponds to a result category and contains one or more <em>subpods</em> which is the unit that contains the actual information. A simplified xml response looks like:</p><pre>&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39;?&gt;<br>&lt;queryresult success=&#39;true&#39; error=&#39;false&#39; numpods=&#39;5&#39;<br> datatypes=&#39;DNAString&#39; timedout=&#39;&#39; timing=&#39;0.914&#39; parsetiming=&#39;0.167&#39;&gt;<br>  &lt;pod title=&#39;Input interpretation&#39; scanner=&#39;Identity&#39; position=&#39;100&#39; error=&#39;false&#39; numsubpods=&#39;1&#39;&gt;<br>   &lt;subpod title=&#39;&#39;&gt;<br>     &lt;plaintext&gt;GATTACACCAGGATAAC (genome sequence)&lt;/plaintext&gt;<br>   &lt;/subpod&gt;<br>  &lt;/pod&gt;<br>… pods deleted for brevity …<br>&lt;/queryresult&gt;</pre><p>Several <a href="http://products.wolframalpha.com/api/languagebindings.html">language bindings</a> for the API are available and others are being developed. The python binding is composed by a <em>WolframAlphaEngine</em> object that allows creating a <em>WolframAlphaQuery</em> which can be processed by the engine to obtain a <em>WolframAlphaQueryResult</em>. This result object is composed by <em>Pod</em> objects that can be iterated to get the desired information. Some examples of the python binding in action are included in the API distribution:</p><pre>import wap</pre><pre>appid = &#39;XXXX&#39; # Use your app id<br>waeo = wap.WolframAlphaEngine(appid)<br>waeq = wap.WolframAlphaQuery(&#39;who are you?&#39;, appid)<br>waeq.ScanTimeout = &#39;3.0&#39;<br>waeq.Async = False<br>waeq.ToURL() # After configuring the waeq must call ToURL()</pre><pre>result = waeo.PerformQuery(waeq.Query) # result is in xml format<br>waeqr = wap.WolframAlphaQueryResult(result)</pre><pre>for pod in waeqr.Pods():<br>  waep = wap.Pod(pod)<br>  print &#39;\n%s: (%d subpods)&#39; % (waep.Title(), waep.NumSubpods())<br></pre><p>After a quick overview the API looks very promising for commercial applications that can take advantage of Wolfram|Alpha’s advanced computation capabilities. Nevertheless it would be great to see what would happen if guys at Wolfram provide free-of-cost access for free software applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*erHNKR2Lz_4yeIsyCcDDog.png" /><figcaption><a href="http://www.devartis.com/">Visit Us!</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cac49888d247" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devartis/a-first-glance-over-wolfram-alphas-webservice-api-cac49888d247">A first glance over Wolfram|Alpha’s Webservice API</a> was originally published in <a href="https://medium.com/devartis">devartis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Musikalisches Würfelspiel — Hacking music composition]]></title>
            <link>https://medium.com/devartis/musikalisches-w%C3%BCrfelspiel-hacking-music-composition-fe7a31fec16a?source=rss-f5a88b8396ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe7a31fec16a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[devartis]]></dc:creator>
            <pubDate>Fri, 25 Sep 2009 03:09:22 GMT</pubDate>
            <atom:updated>2018-06-18T13:45:40.698Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been playing music instruments for a long time in my life, never seriously though. Lately I’ve been taking piano lessons and also decided to get a little further in music theory and composition.</p><p>So I started reading whatever books and lessons I could find. The book <a href="http://www.amazon.com/Harmony-Fifth-Walter-Piston/dp/0393954803/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1253482021&amp;sr=8-1">Harmony</a> by <a href="http://en.wikipedia.org/wiki/Walter_Piston">Walter Piston</a> is very easy to read if you are in a beginning level of music theory and want to learn about harmony. Something caught my attention in this book. At the beginning of chapter III (Mayor mode harmonic progressions) there’s a table that says:</p><p><em>The following table is based in the observation of common uses of the compositors.</em></p><ul><li><em>The I degree is followed by the IV or V, sometimes the VI, and less frequently the I or III.</em></li><li><em>The II degree is followed by the V, sometimes the IV or the VI, and less frequently the I or III.</em></li><li><em>The III degree is followed by the VI, sometimes the IV, and less frequently the I, the II or the V.</em></li><li>…</li></ul><p>A <a href="http://en.wikipedia.org/wiki/Chord_progression">chord progression</a> is a series of musical chords based on a root chord (I) establishing a tonality. The degrees of the progression represent the distance to the root chord in the scale. i.e. If the root chord is C the IV degree is F and the V is G. So this table sets a pattern for building chord progressions based on common uses by the compositors.</p><p>Being a software developer is hard not to see this table as a set of business rules. So when I read this I wondered: What if I could program this almost accurate business rules and randomly generate mayor chord progressions? And what if, based on the generated chord progression, I could randomly generate a melody over it? What if I don’t? This would be fun to try anyway, I would be learning music and programming at the same time, so no loss.</p><p>Before going to the computer I decided to prove the concept in a simpler way, I picked my guitar and a six-sided dice and wrote on a paper the following table:</p><ul><li><strong>1, 2, 3:</strong> use general rule</li><li><strong>4, 5:</strong> use “sometimes” rule</li><li><strong>6</strong>: use “less frecuently” rule</li></ul><p>And when I had to choose between various options I threw the dice again. The first random generated progression I got was: <em>C — F — G — F</em>. Not bad at all. Actually it shouldn’t be a surprise that the progression sounded nice to the ear since what this rules tend to do is to have a <em>C — F — G — C</em> progression as ideal. You will find thousands of hits that made it with this (I-IV-V) progression, Twist and shout by <a href="http://www.lastfm.es/music/The%2520Beatles">The Beatles</a>, Beverly Hills by <a href="http://www.lastfm.es/music/Weezer">Weezer</a>, Wild Thing by <a href="http://www.lastfm.es/music/The+Troggs">The Troggs</a>, Auto Rojo by <a href="http://www.lastfm.es/music/Vilma%2BPalma%2B%2526%2BVampiros">Vilma Palma</a>, etc.</p><p>I decided to use an array of arrays for the progression rules, having the current chord as an index the elements inside that position will give me the candidates for the next chord. For the frecuency I repeated the most frequent elements.</p><pre>C_SCALE = [&#39;C&#39;, &#39;D&#39;, &#39;E&#39;, &#39;F&#39;, &#39;G&#39;, &#39;A&#39;, &#39;B&#39;]<br>F_PROG = [<br>  [5, 5, 5, 4, 4, 4, 6, 6, 1, 3],<br>  [5, 5, 5, 4, 4, 6, 6, 1, 3],<br>  [6, 6, 6, 4, 4, 1, 2, 5],<br>  [5, 5, 5, 1, 1, 2, 2, 3, 6],<br>  [1, 1, 1, 4, 4, 6, 6, 2, 3],<br>  [2, 2, 2, 5, 5, 3, 3, 4, 4, 1],<br>  [1, 1, 1, 3, 3, 3, 6, 6, 2, 4]<br>]</pre><pre>def get_next_chord(chord):<br>  index = C_SCALE.index(chord)<br>    candidates = F_PROG[index]<br>    return C_SCALE[random.choice(candidates) - 1]</pre><p>So now that I had a working concept I started looking for python libraries to make sounds with the computer. However I decided to go with midi libraries since using the speaker would make my songs sound like a <a href="http://en.wikipedia.org/wiki/Golden_Axe">golden axe</a> weapon.</p><p>The library I used is <a href="http://pypi.python.org/pypi/PMIDI/1.1">PMIDI</a> no particular reason but that it works and its easy.</p><p>For the melody I decided to use my basic knowledge about improvisation. The rules are, use any note of the scale of the root chord, but it’s always beter to use notes of the chord. Also, we dont want to “jump” too much between notes, say from C to A and then back to D, etc. So I added a rule to make it unlikely for this to happen and try to stay in a 3-note range.</p><p>You can <a href="http://ia311042.us.archive.org/0/items/PykovskyDemo/pykovsky2.mp3">listen here</a>, what you’ve been waiting for, an example of the results. I hope you like it! And if you do you can see the source code in <a href="https://github.com/fara/pykovsky">here</a>.</p><p>So what does Musikalisches Würfelspiel mean? Actually when I did a little research I found this concept is not new, this name was given to a <a href="http://en.wikipedia.org/wiki/Musikalisches_W%C3%BCrfelspiel">music dice game</a> to generate random minuets in the 18th century. Also Wolfram made a very interesting online version of this kind of program which is called <a href="http://tones.wolfram.com/about/">Wolfram Tones</a> so you can check out the not-so-interesting-as-my songs in their site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*erHNKR2Lz_4yeIsyCcDDog.png" /><figcaption><a href="http://www.devartis.com/">Visit us!</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe7a31fec16a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devartis/musikalisches-w%C3%BCrfelspiel-hacking-music-composition-fe7a31fec16a">Musikalisches Würfelspiel — Hacking music composition</a> was originally published in <a href="https://medium.com/devartis">devartis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome!]]></title>
            <link>https://medium.com/devartis/welcome-ba97a76ee47e?source=rss-f5a88b8396ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba97a76ee47e</guid>
            <dc:creator><![CDATA[devartis]]></dc:creator>
            <pubDate>Wed, 16 Sep 2009 15:47:54 GMT</pubDate>
            <atom:updated>2017-04-04T16:34:07.007Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog people working at devartis will be posting our experiences, company news and events and also development stuff and hacks we want to share. We are restless and curious and we want to keep the doors of our company open so here you’ll find what are we on to.<br>You will find posts of some of the technologies devartis is working with such as Python, Ruby, iPhone apps, etc.<br>We expect to update this blog every two weeks so stay tuned or <a href="http://www.devartis.com/blog/feed/">subscribe</a> to the RSS. You may also <a href="http://www.twitter.com/devartis">follow us</a> on twitter and we will let you know when we post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba97a76ee47e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devartis/welcome-ba97a76ee47e">Welcome!</a> was originally published in <a href="https://medium.com/devartis">devartis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>