[Csnd] Morse Code, Amen Breaks and Markov Chains
Date | 2012-04-14 18:09 |
From | Jacob Joaquin |
Subject | [Csnd] Morse Code, Amen Breaks and Markov Chains |
Hey everyone, Here's a quick progress report on the python score generator and processor I've been working on. I'm want to focus on some larger topics that python itself brings to the table in terms of algorithmic / generative composition. I have three examples, which are all different in nature. While all these examples are "possible" using Csound and Csound only, building these in Python I'm learning is magnitudes faster. I want to first show the morse code example, which translates a phrase into a series of dits and dahs. I've created a Csound morse code translater in the past, and I promise you this took a fraction of the time. And the python version is more complete as it translates letters directly into code while the Csound version translated hyphens and periods Csound csd @ github: https://github.com/jacobjoaquin/csd/blob/5d2d937f03c9f8f62d84b88905ffc7243d693ec2/demo/pysco/morse_code.csd Audio @ Soundcloud: http://soundcloud.com/jacobjoaquin/computer-music-quote Csound morse code example for comparison: http://www.thumbuki.com/csound/files/thumbuki20080102.csd The next is an algorithmic "Amen" based drum'n'bass generator. This whole example probably took about 3 hours of work, if. Had I tried to do this in Csound, it would have easily taken 3x as longer. Even then, I'm uncertain it's a fair comparison since I'm finding working with python to be much more fluid in the sense that it only takes a moment to make big changes while Csound by itself would require much more time consuming refactoring which takes a toll on the creative flow. In a nutshell, I created a drum pattern out of a python function random generates extra notes based on function parameter passed in by the user. With this single parameter, I'm able to create an A and B section in the score. Csound csd @ github: https://github.com/jacobjoaquin/csd/blob/5d2d937f03c9f8f62d84b88905ffc7243d693ec2/demo/pysco/drum3.csd Audio @ Soundcloud: http://soundcloud.com/jacobjoaquin/csound-python-generated-amen Last is a markov chain example. This is a reimplementation of a markov example I did in Csound awhile ago. Not only did this example take less time to put together, it's more legible, requires waaaay fewer lines of code, more flexible, and be can be easily modified for new pieces. In fact, the markov classes in the example can be consolidated into a python module in which others would be able to import and start using immediately by simply writing "from pyscolib import Marvov". One of my biggest personal issues with working with Csound code is that it requires a lot of work to import to port code from one piece into another. The idea of just writing "import foo" is a good start to addressing this issue. Csound csd @ github: https://github.com/jacobjoaquin/csd/blob/5d2d937f03c9f8f62d84b88905ffc7243d693ec2/demo/pysco/markov.csd Audio @ Soundcloud: http://soundcloud.com/jacobjoaquin/csound-python-markov Origina Csound Markov Experiment II: http://www.thumbuki.com/TheCsoundBlog/markov_experiment_2.csd The Markov Experiment II score: http://www.flickr.com/photos/thumbuki/4770351794/ Best, Jake -- codehop.com | #code #art #music |
Date | 2012-04-14 21:47 |
From | Shawn Richard |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
can you seen me or put up a link for your amen break i have so many On Sat, Apr 14, 2012 at 10:09 AM, Jacob Joaquin |
Date | 2012-04-14 21:56 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Took me a few minutes, but I found the one I used on the net: http://soundcloud.com/ethanhein/amen-break Also, I renamed it "Amenbreak.aif" for the example. On Sat, Apr 14, 2012 at 1:47 PM, Shawn Richard |
Date | 2012-04-15 20:29 |
From | Anthony Palomba |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Hey Jacob, Thanks for the update. I think this greatly improves csound score processing and opens many creative options. Very exciting stuff. So does this mean that the csound score processor now supports full python syntax? How is this being done? What version of python does it support? Anthony On Sat, Apr 14, 2012 at 3:56 PM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote: Took me a few minutes, but I found the one I used on the net: |
Date | 2012-04-15 21:01 |
From | J Clements |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Jacob, I followed installation instructions and tested using latest Csound, python 2.7.2 on intel mac os 10.6.8, and using your supplied demo, but I get the error: (while running drums3.csd) File "./pysco.py", line 6, in <module> import csd ImportError: No module named csd I am excited to try out your code, and I am sure I have just made a simple error in my environment...
Thank you much for any suggestions and help, John Clements On Sat, Apr 14, 2012 at 1:09 PM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote: Hey everyone, John Clements jclements77@gmail.com 401-835-6050 |
Date | 2012-04-15 21:46 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
I'm taking a look now. Can you confirm that you followed these steps in the terminal? $ git clone git://github.com/jacobjoaquin/csd.git $ cd csd $ python setup.py install If you don't have git installed, you can download the files here: https://github.com/jacobjoaquin/csd/zipball/master And then got to the csd folder and type "python setup.py install". I personally run everything from the command line in the pysco folder like this: $ csound -g -odac drum3.csd However, I've tested with QuteCsound and the examples work for me there as well. I'm running Python 2.7.1 on OS X 1.7.3. I'll test on my wife's machine later, who is running an earlier version of OS X. Rory. I just got a Facebook chat from Adam Puckett who said he was able to get the examples to run on windows by 'just removing the ./ from the "bin" file name.' I think you might have tried this already. If not, try that and let me know. I'm trying to find a cross-platform solution with bin. It would be nice if users of various operating systems didn't have to make modifications to the bin to run. Let me know how things go. I'll be around for most of the day. Best, Jake On Sun, Apr 15, 2012 at 1:01 PM, J Clements |
Date | 2012-04-16 14:46 |
From | Anthony Palomba |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
My questions again... So does this mean that the csound score processor now supports full python syntax? How is this being done? What version of python does it support? Anthony On Sun, Apr 15, 2012 at 3:46 PM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote: I'm taking a look now. Can you confirm that you followed these steps |
Date | 2012-04-16 15:00 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Sorry, I mistakenly believed this was answered by others. Yes. It supports Python, Perl, Ruby, and many other languages. This is done using the CsScore "bin" feature. For example: |
Date | 2012-04-16 15:41 |
From | Anthony Palomba |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Thanks for explicitly answering my questions. It would be great to start compiling a repository of examples that we can add to the distribution. -ap On Mon, Apr 16, 2012 at 9:00 AM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote: Sorry, I mistakenly believed this was answered by others. |
Date | 2012-04-16 18:30 |
From | Adam Puckett |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
+1 Maybe there should be an install option in with the Python options, or at least a link in the front ends section of the manual. On 4/16/12, Anthony Palomba |
Date | 2012-04-16 18:42 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Hey Everyone, I'm starting the push to promote Python Score outside the list. I'm using a blog to help me get my ideas on paper so-to-speak so when I get around to writing proper documentation, it'll be that much more clear. Introducing "Python Score" for Csound http://codehop.com/introducing-python-score-for-csound/ Python Score is probably only a temporary name. Especially since I have an idea for incorporating the orchestra side of things into the final product. Best, Jake On Mon, Apr 16, 2012 at 10:30 AM, Adam Puckett |
Date | 2012-04-16 19:32 |
From | Andres Cabrera |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
Hi, I've gathered some examples here: http://sourceforge.net/apps/mediawiki/csound/index.php?title=Score_Preprocessing It's a wiki, so feel free to add. You need to have a sourceforge login, and visit the wiki once, then ask John for write authorization. Cheers, Andrés On Mon, Apr 16, 2012 at 3:41 PM, Anthony Palomba |
Date | 2012-04-16 20:07 |
From | Adam Puckett |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
I just cooked up the shortest possible example of using the bin attribute. The CSD is as follows: |
Date | 2012-04-17 05:10 |
From | "Dr. Richard Boulanger" |
Subject | [Csnd] shortest possible example using the bin attribute |
Reading CSD failed ... stopping CoreMIDI real time MIDI plugin for Csound PortMIDI real time MIDI plugin for Csound PortAudio real-time audio module for Csound virtual_keyboard real time MIDI plugin for Csound 0dBFS level = 32768.0 Csound version 5.17 (double samples) Mar 21 2012 libsndfile-1.0.21 UnifiedCSD: /Users/db/Desktop/pythonTest/pythonTest.csd STARTING FILE Creating orchestra Creating score Creating /var/folders/xe/xe3N1-YlEl0mS0XLeBhKMk+++TI/-Tmp-//csound-zIrKEq.ext (0x7fff711cdff8) External generation failed On Apr 16, 2012, at 3:07 PM, Adam Puckett wrote: > I just cooked up the shortest possible example of using the bin > attribute. The CSD is as follows: > > |
Date | 2012-04-17 05:14 |
From | John Clements |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
dB, I had the same happen to me, haven't tried Jacob's suggestions yet (slightly too busy) but he did suggest a few things to try earlier on the list. This is really exciting development though! John Clements On Apr 17, 2012, at 12:10 AM, "Dr. Richard Boulanger" |
Date | 2012-04-17 05:17 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
I would love to get the csbeats to work and some of this python to work, but... no luck with either. -dB ___________________________________ Dr. Richard Boulanger, Ph.D. Professor of Electronic Production and Design Professional Writing and Music Technology Division Berklee College of Music 1140 Boylston Street Boston, MA 02215-3693 617-747-2485 (office) 774-488-9166 (cell) ____________________________________ ____________________________________ On Apr 17, 2012, at 12:14 AM, John Clements wrote:
|
Date | 2012-04-17 05:51 |
From | Jacob Joaquin |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
The one concern I have with CsScore bin is that how a bin is specified may not be cross-platform between windows and *nix machines. I'll post tests, and if people can run these csds, let me know if they work or not, and the operating system they're using, that would go a long way into figuring out a solution. bin_test_1.csd: https://raw.github.com/gist/2403507/9d56331ee94d16d9f1305a728fdac0c2a404ff0a/bin_test_1.csd Best, Jake On Mon, Apr 16, 2012 at 9:17 PM, Dr. Richard Boulanger |
Date | 2012-04-17 21:21 |
From | Andres Cabrera |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
Hi, Something that would be great is better error reporting with external binaries for the score. Would it be possible to print the output of stderr and stdout for the run of the programs? "External generator failed" is not very helpful.... Cheers, Andres On Tue, Apr 17, 2012 at 5:51 AM, Jacob Joaquin |
Date | 2012-04-17 21:37 |
From | Jacob Joaquin |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
It's definitely possible for external programs to generate their own error messages. In fact, I debug this way. This is something I wish to incorporate later in Python Score, as Python provides ways to make it easy to do, but it's one of those tasks that I'm pushing off until the polishing stage. On Tue, Apr 17, 2012 at 1:21 PM, Andres Cabrera |
Date | 2012-04-17 21:55 |
From | Andres Cabrera |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
Yes, that's a good idea, but I meant that Csound itself should be more helpful by reporting back from running the external program fro when things go wrong. It's just an idea, don't really know how easy it would be... Cheers, Andres On Tue, Apr 17, 2012 at 9:37 PM, Jacob Joaquin |
Date | 2012-04-18 00:35 |
From | Adam Puckett |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
Jacob's test works. I'm on Windows XP SP3, Csound version 5.16 (double samples) Feb 6 2012. This is wonderful! CsInstruments needs a bin feature too. ;) On 4/17/12, Andres Cabrera |
Date | 2012-04-18 14:38 |
From | Adam Puckett |
Subject | Re: [Csnd] shortest possible example using the bin attribute |
Something like this: |
Date | 2012-04-28 23:02 |
From | joachim heintz |
Subject | Re: [Csnd] Morse Code, Amen Breaks and Markov Chains |
thanks, andrés! this is very useful. all best - joachim Am 16.04.2012 20:32, schrieb Andres Cabrera: > Hi, > > I've gathered some examples here: > > http://sourceforge.net/apps/mediawiki/csound/index.php?title=Score_Preprocessing > > It's a wiki, so feel free to add. You need to have a sourceforge > login, and visit the wiki once, then ask John for write authorization. > > Cheers, > Andrés > > On Mon, Apr 16, 2012 at 3:41 PM, Anthony Palomba |