CSound "live coding" via open sound control
Date | 2017-02-17 22:04 |
From | free coder |
Subject | CSound "live coding" via open sound control |
Hi, I am experimenting with CSound live coding, running it in a terminal with the option "-L stdin". It is cool, but s there a way to send live code via an OSC port and not just type code in the terminal window ? From what i understand now it is possible to live code from the terminal window (it works !), but I would like to 'live code' from other environments (processing, max, pd ...) sending OSC 'live code' messages. is this already possible ? how is it possible to listen to 'live coding' on an OSC port ? (something live "-L oscport 9999" ?) (note that i am not talking about the existing OSC possibilities in a .csd like initOSC etc ... as this is not live coding but parameter control via OSC) many thanks if someone has any hints ! |
Date | 2017-02-17 22:28 |
From | Ed Costello |
Subject | Re: CSound "live coding" via open sound control |
I don’t know about OSC but this can be achieved using web sockets so it may be helpful to you, for instance, from a web page you can send an instrument like in the following example, in this case sending a trigger flag value and instrument string when a button is clicked in the web page: var kvarSocket = new WebSocket("ws://127.0.0.1:8888", "kvar"); var stringSocket = new WebSocket("ws://127.0.0.1:8888", "Sstring"); var trigger = 1; stringButton.onclick = function() { stringSocket.send("\"instr 3\n a1 oscils p4/2, p5 / 2, 0 \n out a1 \nendin\""); kvarSocket.send(new Float64Array([trigger])); trigger = !trigger; } On the Csound side you can receive like this: <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> nchnls = 2 0dbfs = 1 ksmps = 256 sr = 44100 instr 1 iport init 8888 kvarChanged init 0 ktrigger init 0 kvar, Sstring websocket iport if kvarChanged != kvar then kvarChanged = kvar ktrigger = 1 Sscore sprintfk {{i 2 0 -1 %s}}, Sstring endif scoreline Sscore, ktrigger ktrigger = 0 endin instr 2 prints p4 Sstring = p4 ires compilestr Sstring scoreline_i "i 3 0 3 .2 415" turnoff endin </CsInstruments> <CsScore> i1 0 100 </CsScore> </CsoundSynthesizer> Maybe you can repurpose this example to use OSC instead, Cheers, Ed
|
Date | 2017-02-17 22:35 |
From | Dave Seidel |
Subject | Re: CSound "live coding" via open sound control |
Steven Yi wrote a nice Python program a few years ago that runs a CSD via the Csound API, and sets up a generic OSC server that allows the user to send score events, and to set channel values: https://github.com/kunstmusik/OSCsound On Fri, Feb 17, 2017 at 5:28 PM, Ed Costello <phasereset@gmail.com> wrote:
|
Date | 2017-02-17 22:40 |
From | Celso Machado |
Subject | Opcode to invert the phase of a signal |
Hi, is there an opcode to invert the phase of an audio signal? I’m working on a granular instrument and I’d like to try to alternate between a grain in phase and the next grain out of phase to hear the overall result. Best Regards Celso Machado
|
Date | 2017-02-17 22:41 |
From | Ed Costello |
Subject | Re: Opcode to invert the phase of a signal |
Can you not just multiply the audio signal by -1? Ed
|
Date | 2017-02-17 22:42 |
From | Steven Yi |
Subject | Re: CSound "live coding" via open sound control |
Wow, I forgot about that project, thanks for mentioning it! :) (It actually may be very useful for a project I had in mind for distributed sound generation...) I was about to write that I tend to do live code with Csound these days using UDP and csound's --port=10000 (or whatever port number you want to use) flag. Using that, you can send orchestra code to Csound via the port. The small Vim plugin I have: https://github.com/kunstmusik/csound-repl Shows how it uses python to send code to a running Csound via UDP. Regarding OSCsound, it'd probably be useful to update it to take in and /orc message with orchestra code. Since I need something like this anyways, I'll look at updating that Python script this weekend. On Fri, Feb 17, 2017 at 5:35 PM, Dave Seidel |
Date | 2017-02-17 22:48 |
From | Dave Seidel |
Subject | Re: CSound "live coding" via open sound control |
Steven, you may want to take a look at my fork. :-) I've added very little so far, just been restructuring to make it easier to reuse some of the code. My changes may or may not be to your taste (or match you plans), bur may as well take a look: https://github.com/DaveSeidel/OSCsound/tree/ds-refactor On Fri, Feb 17, 2017 at 5:42 PM, Steven Yi <stevenyi@gmail.com> wrote: Wow, I forgot about that project, thanks for mentioning it! :) (It |
Date | 2017-02-17 23:01 |
From | Steven Yi |
Subject | Re: CSound "live coding" via open sound control |
Neat! I'll study the code more carefully but on first glance it looks nice with the with() syntax support and other more modern Python practices. Perhaps it might even be better to base things on Felipe's ctcsound ctypes binding now too. I'll follow up here once I get somewhere with all of this. :) On Fri, Feb 17, 2017 at 5:48 PM, Dave Seidel |
Date | 2017-02-17 23:04 |
From | Dave Seidel |
Subject | Re: CSound "live coding" via open sound control |
Yes, ctcsound looks great, thanks for the reminder! On Fri, Feb 17, 2017 at 6:01 PM, Steven Yi <stevenyi@gmail.com> wrote: Neat! I'll study the code more carefully but on first glance it looks |
Date | 2017-02-17 23:05 |
From | Victor Lazzarini |
Subject | Re: CSound "live coding" via open sound control |
Francois Pinot's ctcsound... and Python3 and numpy. Great combination. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 17 Feb 2017, at 23:01, Steven Yi |
Date | 2017-02-17 23:06 |
From | Steven Yi |
Subject | Re: CSound "live coding" via open sound control |
Ah oops! Apologies, I meant Francois, not Felipe (who I both thank for their many contributions to the community! ;) ). On Fri, Feb 17, 2017 at 6:05 PM, Victor Lazzarini |
Date | 2017-02-17 23:08 |
From | Celso Machado |
Subject | Re: Opcode to invert the phase of a signal |
Ed, how didn’t I think that?! LOL Thank you! Celso
|
Date | 2017-02-17 23:25 |
From | free coder |
Subject | Re: CSound "live coding" via open sound control |
great !! many thanks for your answers, i will have a look at the different suggestions (i think websockets and UDP should work rather well from another environment) Saturday, 18 February 2017, 00:01 +0100 from Steven Yi <stevenyi@GMAIL.COM>:
|
Date | 2017-02-18 02:06 |
From | Hlöðver Sigurðsson |
Subject | Re: CSound "live coding" via open sound control |
Nice, emacs+csound <3 2017-02-18 0:25 GMT+01:00 free coder <zfreecoder@gmail.com>:
|
Date | 2017-02-18 17:16 |
From | "Dr. Richard Boulanger" |
Subject | Re: CSound "live coding" via open sound control |
Lovely Live Coding! Thanks for sharing. All these suggestions are very inspiring. -dB Sent from my iPhone
|