[Csnd] Score Generation and Processing with Blocks Nested in Time
Date | 2012-04-01 03:57 |
From | Jacob Joaquin |
Subject | [Csnd] Score Generation and Processing with Blocks Nested in Time |
Hello everyone. Continuing with the discussion about score generation and processing with scripting languages, I've come up with another example that showcases the score() function and a nested structure for organizing events in time. "with cue(x):". (This was previously seen as "with t(x):" in earlier examples) The score() function is simple. Any string passed to score() gets written to the final score. Everything you know about the traditional Csound score applies here. Well, almost everything. Combined with the "with cue():" structure, it is possible to translate blocks of score code in time. Let's look at a simple block of score code without cue(). score(''' i 1 0 1 0.707 8.00 i 1 1 2 0.707 8.04 i 1 3 1 0.707 8.07 i 1 3.5 1 0.707 9.00 ''') In this case, the block of code would be written to the final score exactly as it is presented with the call to score: i 1 0 1 0.707 8.00 i 1 1 2 0.707 8.04 i 1 3 1 0.707 8.07 i 1 3.5 1 0.707 9.00 Now let's image a scenario in which you would like that exact phrase to play again on measure 3, which starts on beat 8 (assuming 4/4). Typically, you would copy the code, and then manually make changes to pfield column 2. It would look like this: i 1 8 1 0.707 8.00 i 1 9 2 0.707 8.04 i 1 11 1 0.707 8.07 i 1 11.5 1 0.707 9.00 Simple enough to do with only 4 lines, but there is a better way, a way that scales as the number of events grow. This example uses the cue() to translate the original phrase by 8 beats; the score() function is aware of the current stacked value of the cue(). with cue(8): score(''' i 1 0 1 0.707 8.00 i 1 1 2 0.707 8.04 i 1 3 1 0.707 8.07 i 1 3.5 1 0.707 9.00 ''') The advantage for users is that it allows the start time of each new measure to reset to 0. Users can think in beats localized to the measure rather than the absolute score time in beats. There is also a visual aspect to this structure. The indention of each measure is a visual cue to users, which will aid them in scanning a score much more efficiently. I've created an example using an except from Bach's Invention No. 1. https://github.com/jacobjoaquin/csd/blob/master/demo/pysco/test10.csd There are other advantages that I'll get to later. Though I wonder if this is something that makes sense through reading an explanation, or if this is something that has to be used to truly understand the benefits. Best, Jake -- codehop.com | #code #art #music |
Date | 2012-04-01 18:55 |
From | Jacob Joaquin |
Subject | [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Time in Measures The cue() object uses beats as its native unit of time. Looking back at the Bach excerpt, you'll see that each new measure is a multiple of 4, as 4 beats equals 1 measure. with cue(0): score('''...''') with cue(4): score('''...''') with cue(8): score('''...''') with cue(12): score('''...''') etc... https://github.com/jacobjoaquin/csd/blob/master/demo/pysco/test10.csd Beat time is good and all, but is often perceived as a roadblock to new Csounders since many composers think in measures. Removing this roadblock with "pysco" (still need a new name for this) is straight forward. First, one creates a new function that translates time in measures to time in beats, and returns the cue() object with the translated value. This requires 3 lines of code. def measure(t): global cue return cue((t - 1) * 4.0) Second, use measure() instead of score. with measure(1): score('''...''') with measure(2): score('''...''') with measure(3): score('''...''') with measure(4): score('''...''') etc... That's it. I've duplicated the Bach excerpt to using the new measure() function so you can see it in context. https://github.com/jacobjoaquin/csd/blob/master/demo/pysco/test11.csd There is one obvious drawback to the provided example. Measures are stuck in 4/4 without a way to change the meter. While I won't provide an example right now, mixed meter if very possible with the right function. Also, I hope people don't mind too much I'm spamming the list with all of this. I find that explaining things to an audience is great way for me to figure out the problems and challenges of designing a system like the one at hand. Comments and suggestions would also be a big boon if anyone has any. Best, Jake On Sat, Mar 31, 2012 at 7:57 PM, Jacob Joaquin |
Date | 2012-04-01 19:09 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Please continue to spam! I don't use Python but I'm still following this thread with great interest. It's always interesting to see different ways to use Csound. I think that the diversity of approaches people take when using Csound is one thing that sets it apart from other audio software. It might not be the most accessible of audio tools but it will take you anywhere you want to go, and even places you had never ever thought of. Rory. On 1 April 2012 18:55, Jacob Joaquin |
Date | 2012-04-01 19:26 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
+1 although Csound may not be "for everyone", the beauty of Csound is... that there really is "something" ... there really is... "a place"... for "everyone" in Csound! ___________________________________ 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 1, 2012, at 2:09 PM, Rory Walsh wrote:
|
Date | 2012-04-01 20:15 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
I'm just trying this now Jacob but I'm having one or two issues in getting set up. I have pysco.py in the same dir as my csd file but when I run the csd file I get an error saying: '.' is not recognized as an internal or external command, operable program or batch file. External generation failed Reading CSD failed ... stopping If I try to run pysco with python from the command line I get a 'no module named csd' error. Any ideas? On 1 April 2012 19:26, Dr. Richard Boulanger |
Date | 2012-04-01 20:24 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
A couple of questions. What OS are you using? I've only tested on OS X. My assumption is that it should work in most *nix environments, but I have my doubts that it'll work in windows this way. Regardless, I need to know so others don't run into this issue in the future. Did you install the csd python framework? Best, Jake On Sun, Apr 1, 2012 at 12:15 PM, Rory Walsh |
Date | 2012-04-01 20:37 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Dived in a little deeper on this. First, a new question. How are you running the file? From within a terminal or from an editor like CsoundQT? Based on the module csd error you gave, I would guess that the csd python framework isn't installed. If you are on a *nix system, you can install it this way. (first go to an appropriate folder) $ git clone git://github.com/jacobjoaquin/csd.git $ cd csd $ python setup.py install If you don't have git installed, you can download an archive directly here, and decompress it, then follow these commands. $ cd PATH_TO_PROJECT/csd $ python setup.py install You might have to try running the csd file from within the same directory your in. On Sun, Apr 1, 2012 at 12:24 PM, Jacob Joaquin |
Date | 2012-04-01 20:46 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Forgot to add the link to the download: https://github.com/jacobjoaquin/csd/zipball/master Also. Just tested running the examples in the pysco folder using QuteCsound-0.6.1-OSX-incQt. Seems to work for me here. On Sun, Apr 1, 2012 at 12:37 PM, Jacob Joaquin |
Date | 2012-04-01 20:49 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
So I installed csd. When I try to run from WinXound I get the same Csound error as before: '.' is not recognized as an internal or external command, operable program or batch file. External generation failed Reading CSD failed ... stopping When I try to run pysco.py from the command line with python I get the following error: C:\Documents and Settings\Rory\Desktop>python pysco.py Traceback (most recent call last): File "pysco.py", line 115, in |
Date | 2012-04-01 20:58 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
The first error ('.' not recognized) is most likely due to the fact that paths are different on *nix machines and windows. Try replace "./pysco.py" with the a Windows formatted path. Possibly this? |
Date | 2012-04-01 21:23 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
And here's a way to test if the pysco script is working. Copy this into a file called foo.csd: def measure(t): global cue return cue((t - 1) * 4.0) score('t 0 210') with measure(1): score(''' i 1 0.5 0.5 0.5 8.00 i 1 + . . 8.02 i 1 + . . 8.04 i 1 + . . 8.05 i 1 + . . 8.02 i 1 + . . 8.04 i 1 + . . 8.00 ''') Then try: $ python pysco.py foo.csd bar.csd Then check the contents of bar.csd. Warning, if you have something named bar.csd in that folder, it will be replaced. On Sun, Apr 1, 2012 at 12:58 PM, Jacob Joaquin |
Date | 2012-04-02 00:19 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
When I run your code I get a score file that looks like this: t 0 210 i 1 0.5 0.5 0.5 8.00 i 1 + . . 8.02 i 1 + . . 8.04 i 1 + . . 8.05 i 1 + . . 8.02 i 1 + . . 8.04 i 1 + . . 8.00 When I put python "C:/Documents and Settings/Rory/Desktop/pysco.py" into the CsScore bin tag I get the following error: Traceback (most recent call last): File "C:\DOCUME~1\Rory\LOCALS~1\Temp\cs27.ext", line 4, in |
Date | 2012-04-02 01:00 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
What version of python are you running? You can find out by doing this in the command-line: $ python -V That said, it is at least partially working since it created a valid score file. Now we just have to figure out why score() is working when executed from the prompt, but not from csScore bin. I'll start researching this in about an hour. On Sun, Apr 1, 2012 at 4:19 PM, Rory Walsh |
Date | 2012-04-02 01:56 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Well, I'm absolutely perplexed by this. And to make matters worse, since I don't have a Windows machine, I can't debug this myself. I'll continuing digging around on the net to see what I find. Is there anyone out there with Windows and a knowledge of Python willing to take a look? It appears that this line: execfile(argv[1], globals()) in pysco.py isn't using names defined in the global namespace. Best, Jake On Sun, Apr 1, 2012 at 5:00 PM, Jacob Joaquin |
Date | 2012-04-02 19:28 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Sorry for the delay in getting back to you on this. I'm using python 2.6. I'm just going to try it from another PC now to make sure that's it not some bogus path variables on my laptop that is messing things up. I'll let you know. On 2 April 2012 02:56, Jacob Joaquin |
Date | 2012-04-02 19:32 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Thanks. I'm running from python 2.7.1 myself, though I'm uncertain if that'll make a difference. I'll try to obtain access to a windows machine tonight. In the long run, I consider it absolutely vital that this script is as easy as possible to get up and running. So thanks for helping me out on this! On Mon, Apr 2, 2012 at 11:28 AM, Rory Walsh |
Date | 2012-04-02 20:02 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Just tried here on a fresh machine. Same problems as yesterday I'm afraid. I did try running python pysco.py test10.csd whatever.csd and I got the following: C:\Users\juleturm\Desktop\Rory\jacob\demo\pysco>python pysco.py test10.csd foo.c sd Traceback (most recent call last): File "pysco.py", line 120, in |
Date | 2012-04-03 00:56 |
From | Steven Yi |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Hi Jake, I get the same error here on OSX, running from commandline. If the csd contents are just python code (as in the example you posted here in email), it runs as python code and all is well. If you try to use a real CSD, then it's not valid python code, which I believe is why the error is reporting Syntax Error. With execfile that makes sense. I think what Rory is trying (and correct me if I'm wrong) is to run pysco with the CSD as an argument, which in reality, it should be that csound runs with the CSD, extracts the CsScore and runs pysco with just the contents of that and not the entire CSD. I can run the CSD's in demo/pysco using "csound test1.csd". On windows, I'd probably try changing the bin="./pysco.py" to be "python ./pysco.py" and be sure to run that within the demo/csd folder. Rory, could you try that? steven On Mon, Apr 2, 2012 at 8:02 PM, Rory Walsh |
Date | 2012-04-03 01:06 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
I had never considered that it might be because of trying to run "python pysco.py foo.csd" instead of "csound foo.csd". The proper form is definitely "csound foo.csd. Thanks for taking a look! This helps big time. On Mon, Apr 2, 2012 at 4:56 PM, Steven Yi |
Date | 2012-04-03 04:20 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Finally had a chance to take a closer look. Experimenting with these suggestions, I've verified the two following CsScore bin args work on OS X. bin="python pysco.py" bin="python ./pysco.py" In the end, I'm hoping for a simple solution that will work across the major platforms. I'm guessing the former might do the trick. Best, Jake On Mon, Apr 2, 2012 at 5:06 PM, Jacob Joaquin |
Date | 2012-04-03 07:10 |
From | "Dr. Richard Boulanger" |
Subject | [Csnd] csGrain for iPad2/3 available @ the App Store |
Boulanger Labs is proud to introduce our first iPad app based on Csound5 - "csGrain". Built for the iPad2/3 and built on the new "Csound for iOS" SDK by Steven Yi and Victor Lazzarini, the app was approved by the App Store at Apple last week and has been receving extremely positive reviews. (It was one of the top 10 iPad Music Apps for the first three days after it's release! Somebody is loving Csound out there.) You can find out more about the app, watch the demo videos, listen to some of the demo audio, read the manual, and check out the single .csd that is running under the hood @ Currently, we are now putting the finishing touches on our flagship app - "Csound Touch" which is essentially "all of Csound5" running on the iPad. It's like a mini, but quite complete, version of CsoundQt with a set of fixed graphical interface elements (Knobs, Sliders, XY pads, and an on-screen piano keyboard), a full-feature text editor, the manuals, chapters from The Csound Book, and a huge collection of text-based instruments, MIDI instruments, real-time DSP instruments. (Essentially, the new and expanded Csound Catalog.) You can find out more about Csound Touch @ We hope to have Csound Touch approved and available in the next month or so. Also, in the works, and almost ready to submit for review is "csSpectral" - a companion app for csGrain featuring an expanded set of time-based signal processors, a bank of reverbs to choose from, spectral displays, and a collection of real-time processing effects based on Csound's streaming spectral opcodes. (Depending on the "approval" timeline at Apple, this one might make it to the App store first. It's pretty great and I think that people will love it.) Following these three, we will be bringing out: csFuzz – a rack of guitar effects. csVoice – a vocal synthesizer, harmonizer, and suite of traditional and exotic vocal processors. csGen – algorithmic, probabilistic, and generative composition systems. csModel – a collection of Physical and Physically-Inspired Models. csClassics – a collection of synths based on the classic techniques (FM/AM/RM/WaveShaping/Granular/Additive/Etc.) The main app developer is the totally brilliant Thomas Hass, and the main interface designer is gifted and elegant Matthew Centrella - two of Berklee's top Electronic Production and Design students - and monster Csounders. Joining us as lead sound designer is the totally amazing Giorgio Zucco. In the next 6 months, we also plan to release a complete line of Audio Unit plugins based on Csound as well. We are already using them in Logic Pro on our Macintosh Laptops. Are you interested in joining us? Hope so. You can reach us through boulangerlabs.com. ___________________________________ 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) ____________________________________ ____________________________________ |
Date | 2012-04-03 08:13 |
From | Gmail |
Subject | Re: [Csnd] csGrain for iPad2/3 available @ the App Store |
Fantastic ! !! but where is it possible to get "Csound for IOS" SDK ??? thanks stf Le 3 avr. 2012 à 08:10, Dr. Richard Boulanger a écrit :
|
Date | 2012-04-03 11:11 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
I think I've tried everything at this stage? I had tried csound foo.csd too but that gives me the same errors as i get when trying it with WinXound or CsoundQT. On windows one seems to have to supply the full path to pysco.py as in: |
Date | 2012-04-03 11:38 |
From | Andres Cabrera |
Subject | Re: [Csnd] csGrain for iPad2/3 available @ the App Store |
Hi, Congratulations! Looks and sound great! Cheers, Andres On Tue, Apr 3, 2012 at 8:13 AM, Gmail |
Date | 2012-04-03 14:24 |
From | Richard Dobson |
Subject | Re: [Csnd] csGrain for iPad2/3 available @ the App Store |
On 03/04/2012 07:10, Dr. Richard Boulanger wrote: .. > Also, in the works, and almost ready to submit for review is > "csSpectral" - a companion app for csGrain featuring an expanded set of > time-based signal processors, a bank of reverbs to choose from, spectral > displays, and a collection of real-time processing effects based on > Csound's streaming spectral opcodes. What's the performance like on say the iPad 2? Can it support a stereo pvs effect? Richard Dobson |
Date | 2012-04-03 15:08 |
From | Victor Lazzarini |
Subject | Re: [Csnd] csGrain for iPad2/3 available @ the App Store |
ipad 1 can support stereo PVS easily. There is a harmoniser effect in the examples that works perfectly. For that matter, an old iphone I have here can also run this, but at a reduced SR. On Android, I heard the harmoniser work on Steven's phone, and it does not have any trouble on my galaxy tab. The computing power of these devices is quite good. Victor On 3 Apr 2012, at 14:24, Richard Dobson wrote: > On 03/04/2012 07:10, Dr. Richard Boulanger wrote: > .. >> Also, in the works, and almost ready to submit for review is >> "csSpectral" - a companion app for csGrain featuring an expanded set of >> time-based signal processors, a bank of reverbs to choose from, spectral >> displays, and a collection of real-time processing effects based on >> Csound's streaming spectral opcodes. > > What's the performance like on say the iPad 2? Can it support a stereo pvs effect? > > Richard Dobson > > > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2012-04-03 15:18 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Thanks Rory, much appreciated. > Traceback (most recent call last): > File "C:\Users\juleturm\AppData\Local\Temp\cs10.ext", line 4, in |
Date | 2012-04-03 18:31 |
From | Rory Walsh |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
No problem Jacob, take your time! On 3 April 2012 16:18, Jacob Joaquin |
Date | 2012-04-04 05:22 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Re: Score Generation and Processing with Blocks Nested in Time |
Still no access to a windows machine, but I do have a new example: Creating reusable phrases of music with functions. Repetition is a common pattern found in music. Especially in electronic music. A common method for repeating sections or phrases using the traditional score involves copy, pasting and manually translating the start times. Which is neither fluid nor flexible. Since we the cue object at our disposal in Python, reusing a piece of music is much easier and saves times as we can easily store a note, phrase, section, and/or an entire composition into a function: def phrase(): score(''' i 1 0 1 0.5 8.07 i 1 + . . 9.00 i 1 + 0.25 . 8.11 i 1 + 0.25 . 8.09 i 1 + 0.5 . 8.11 i 1 + . . 9.00 ''') This function definition does not yet add the music to the final score, and must first be called. The following four lines of code does that, repeating the same phrase 4 times. with cue(0): phrase() with cue(4): phrase() with cue(8): phrase() with cue(12): phrase() Here is a working example in context: https://github.com/jacobjoaquin/csd/blob/master/demo/pysco/test4.csd Best, Jake On Tue, Apr 3, 2012 at 10:31 AM, Rory Walsh |
Date | 2012-07-17 21:21 |
From | matt ingalls |
Subject | Re: [Csnd] csGrain for iPad2/3 available @ the App Store |
where can i download the source for the csGrain app? |