Syncing to Jack Transport
Date | 2017-02-06 16:44 |
From | Guillermo Senna |
Subject | Syncing to Jack Transport |
Hi, Has anyone been able to sync the score to Jack Transport? It would be great to have something like that. Cheers! Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-02-06 16:50 |
From | phil jones |
Subject | Re: Syncing to Jack Transport |
+1 On 6 February 2017 at 16:44, Guillermo Senna |
Date | 2017-02-06 17:30 |
From | Michael Gogins |
Subject | Re: Syncing to Jack Transport |
Csound has two distinct systems for connecting to Jack: the command line options, and the Jacko opcodes. The Jacko family of opcodes features the JackoTransport opcode. The Jacko opcodes do not depend on command line options, but manage Jack's audio, MIDI, and transport features from opcodes in the orchestra. These opcodes are a plugin. See: https://gogins.github.io/csound/html/JackoOpcodes.html https://gogins.github.io/csound/html/JackoTransport.html For the Jack input and output command line options, there is the similar jacktransport opcode. This opcode is a builtin. See: https://gogins.github.io/csound/html/jacktransport.html The command line options are: -+jack_client=[client_name] The client name used by Csound, defaults to 'csound5'. If multiple instances of Csound connect to the JACK server, different client names need to be used to avoid name conflicts. (Linux and Mac OS X only) -+jack_inportname=[input port name prefix], -+jack_outportname=[output port name prefix] Name prefix of Csound JACK input/output ports; the default is 'input' and 'output'. The actual port name is the channel number appended to the name prefix. (Linux and Mac OS X only) Example: with the above default settings, a stereo orchestra will create these ports in full duplex operation: csound5:input1 (record left) csound5:input2 (record right) csound5:output1 (playback left) csound5:output2 (playback right) Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Mon, Feb 6, 2017 at 11:50 AM, phil jones |
Date | 2017-02-06 17:45 |
From | Guillermo Senna |
Subject | Re: Syncing to Jack Transport |
Hi Michael, Thanks for replying! I've seen the opcodes from the Jacko family. I couldn't make them work here in Ubuntu Studio, but in the end I just stopped trying because if I'm not mistaken JackoTransport sends the commands to the Jack Server without "enslaving" Csound's own clock to the Jack Transport clock. Am I right? On 06/02/17 14:30, Michael Gogins wrote: > Csound has two distinct systems for connecting to Jack: the command > line options, and the Jacko opcodes. > > The Jacko family of opcodes features the JackoTransport opcode. The > Jacko opcodes do not depend on command line options, but manage Jack's > audio, MIDI, and transport features from opcodes in the orchestra. > These opcodes are a plugin. See: > > https://gogins.github.io/csound/html/JackoOpcodes.html > https://gogins.github.io/csound/html/JackoTransport.html > > For the Jack input and output command line options, there is the > similar jacktransport opcode. This opcode is a builtin. See: > > https://gogins.github.io/csound/html/jacktransport.html > > The command line options are: > > -+jack_client=[client_name] > The client name used by Csound, defaults to 'csound5'. If multiple > instances of Csound connect to the JACK server, different client names > need to be used to avoid name conflicts. (Linux and Mac OS X only) > > -+jack_inportname=[input port name prefix], -+jack_outportname=[output > port name prefix] > Name prefix of Csound JACK input/output ports; the default is 'input' > and 'output'. The actual port name is the channel number appended to > the name prefix. (Linux and Mac OS X only) > > Example: with the above default settings, a stereo orchestra will > create these ports in full duplex operation: > > csound5:input1 (record left) > csound5:input2 (record right) > csound5:output1 (playback left) > csound5:output2 (playback right) > > Regards, > Mike > > ----------------------------------------------------- > Michael Gogins > Irreducible Productions > http://michaelgogins.tumblr.com > Michael dot Gogins at gmail dot com > > > On Mon, Feb 6, 2017 at 11:50 AM, phil jones |
Date | 2017-02-06 17:59 |
From | Michael Gogins |
Subject | Re: Syncing to Jack Transport |
Send me a CSD or sketch for one that slaves to Jack and I will try to get it to work. Regards, Mike On Feb 6, 2017 12:45 PM, "Guillermo Senna" <gsenna@gmail.com> wrote: Hi Michael, |
Date | 2017-02-06 18:04 |
From | Menno Knevel |
Subject | Re: Syncing to Jack Transport |
as a matter of fact, we are using Jacktransport opcode a lot, because we have connected 2 computers where Blue/Csound is the master and the second computer is slave. I wrote an article on this: https://github.com/kunstmusik/blue/wiki/The-Blue-Connection so far i was unable to run the Jacko Transport opcode, all i got were crashes, but http://csound.github.io/docs/manual/jacktransport.html works fine. -- View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Syncing-to-Jack-Transport-tp5754309p5754315.html Sent from the Csound - General mailing list archive at Nabble.com. Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-02-06 18:17 |
From | Guillermo Senna |
Subject | Re: Syncing to Jack Transport |
Hi Menno, I've read your article! Those kind of short writings scattered over the internet had been a tremendous help in learning Csound. Please keep writing them. As a matter of fact I was also trying to use NetJack2 and had the same problem you had with the transport option, it's because the stable version has commented out the -t command line option in the code for activating the transport. I can't use jacktransport because I was trying to build a VST with Cabbage and so I can't use -+rtaudio=jack. But actually it's the same problem anyway, isn't it? A pure Csound file with jacktransport won't reposition Csound's own internal clock, which is what I'm after. On 06/02/17 15:04, Menno Knevel wrote: > as a matter of fact, we are using Jacktransport opcode a lot, because we have > connected 2 computers where Blue/Csound is the master and the second > computer is slave. > I wrote an article on this: > https://github.com/kunstmusik/blue/wiki/The-Blue-Connection > > so far i was unable to run the Jacko Transport opcode, all i got were > crashes, but http://csound.github.io/docs/manual/jacktransport.html works > fine. > > > > -- > View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Syncing-to-Jack-Transport-tp5754309p5754315.html > Sent from the Csound - General mailing list archive at Nabble.com. > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-02-06 18:24 |
From | Guillermo Senna |
Subject | Re: Syncing to Jack Transport |
Attachments | line.csd |
Well, as an example, the attached file is the line opcode example taken from the manual. I've added some Jacko code. What I'm trying to achieve is: 6 seconds after the performance started I want to stop Csound's clock from running by calling instr 1. I'm pretty sure this is not possible to do and I'm probably not explaining myself very well. Anyway, right now this .csd doesn't produce any sound at all and all I can see in the console is: Created Jack client "csound" for Jack server "default". Activated Jack client "csound". orch now loaded audio buffered in 256 sample-frame blocks ALSA: -B 1024 not allowed on this device; using 2048 instead ALSA: -b 256 not allowed on this device; using 1024 instead ALSA output: total buffer size: 2048, period size: 1024 writing 512 sample blks of 64-bit floats to dac SECTION 1: new alloc for instr 2: BEGAN JackoState::close()... ENDED JackoState::close(). After that I've to sigkill Csound. On 06/02/17 14:59, Michael Gogins wrote: > Send me a CSD or sketch for one that slaves to Jack and I will try to get > it to work. > > Regards, > Mike > > On Feb 6, 2017 12:45 PM, "Guillermo Senna" |
Date | 2017-02-06 18:24 |
From | Menno Knevel |
Subject | Re: Syncing to Jack Transport |
yes, we are using JackTransport only to guide the slave from location to location; idea is to have soundclusters ready on the slave machine, using VSTs. That way we can hop between these different soundclusters, combined with "normal" Csound code running from Blue. A somewhat different setting... -- View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Syncing-to-Jack-Transport-tp5754309p5754317.html Sent from the Csound - General mailing list archive at Nabble.com. Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-02-06 18:28 |
From | Guillermo Senna |
Subject | Re: Syncing to Jack Transport |
Right, but in your setup it's actually Blue the one being controlled by jack transport. I was trying to achieve it from inside any VST host with Cabbage plugins. If my own C++ code doesn't end up working, I'll might have to consider using Blue. On 06/02/17 15:24, Menno Knevel wrote: > yes, we are using JackTransport only to guide the slave from location to > location; idea is to have soundclusters ready on the slave machine, using > VSTs. That way we can hop between these different soundclusters, combined > with "normal" Csound code running from Blue. > A somewhat different setting... > > > > -- > View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Syncing-to-Jack-Transport-tp5754309p5754317.html > Sent from the Csound - General mailing list archive at Nabble.com. > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-02-06 18:30 |
From | Michael Gogins |
Subject | Re: Syncing to Jack Transport |
Your problem is probably that the kperiod has to match Jack's buffers. I will investigate. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Mon, Feb 6, 2017 at 1:28 PM, Guillermo Senna |
Date | 2017-02-06 18:35 |
From | Menno Knevel |
Subject | Re: Syncing to Jack Transport |
No - Blue, in this case, is just a timeline that holds 2 Objects containing each the same JackTransport opcode. One time for start, one time later in the compostion for stop. So i run Blue, that spits out the this Csound code on the timeline, but Blue itself is not guided by JackTransport. The second computer, the slave, is being controlled by Csound's JackTransport opcode. -- View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Syncing-to-Jack-Transport-tp5754309p5754322.html Sent from the Csound - General mailing list archive at Nabble.com. Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2017-02-06 20:25 |
From | Michael Gogins |
Subject | Re: Syncing to Jack Transport |
Attachments | line.csd |
As I said in my earlier email, the Jack command line options and the Jacko opcodes are two independent systems. In fact, you can't combine them. The problems with your example were: -- Your example may have had the wrong name for the Jack server (e.g., "(default)" is not the same as "default"). -- Your example did not connect to the Jack server. -- Your example may not have not set sr and ksmps to Jack's sr and buffer size. -- Your example did not turn Jack "on." But that shouldn't matter because "on" is the default. -- Your example did not actually send any audio to the Jack server. I fixed these problems, and the modified example ran just fine (it is attached). It turned the Jack transport off when it was supposed to, also. Of course, as you noted, this does not affect Csound's score position. You could, however, write a user-defined opcode that would reset the Csound score position and the Jack transport position at the same time, perhaps like this: opcode transport ioperation, itime xin JackoTransport ioperation, itime Sevent sprintf "a 0 %f\n", itime scoreline_i Sevent endop Then you could use some sort of MIDI message from Jack to control both the Jack server transport and the Csound score time. Currently, the Jacko opcodes do not listen to the Jack transport and adjust Csound's score time accordingly. If that is what you need, let me know and I will see how hard it would be to implement. It looks like it's not that hard and should only require a callback in the Jacko opcodes for the transport position and state. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Mon, Feb 6, 2017 at 1:24 PM, Guillermo Senna |
Date | 2017-02-07 00:45 |
From | Guillermo Senna |
Subject | Re: Syncing to Jack Transport |
Thanks for taking the time to debug it Michael! The only problems I had from that list were that I was not connecting the ports and was not sending the audio to Jack. Also what I've learned is that you can't use -odac with the Jacko opcodes. As a side note, Ctrl-C still doesn't work. I need to build an audio player synced to Jack Transport's timeline. Last month I wrote a jackQuery opcode that would output the transport position, but I abandoned the idea as I couldn't figure out how to use that with the opcodes that read audio files. The closest I got was to use lposilsa2 and feed the kloop parameter with the jackQuery output. It still wasn't sample-accurate and in retrospect I think the thing didn't work because ksmps didn't match Jack's buffer size at that time. I might give it a shot again, or just try to reposition Csound's clock with a- statements as you've showed me. It won't be sample accurate, of course, but it might suffice. Thanks again! On 06/02/17 17:25, Michael Gogins wrote: > As I said in my earlier email, the Jack command line options and the > Jacko opcodes are two independent systems. In fact, you can't combine > them. > > The problems with your example were: > > -- Your example may have had the wrong name for the Jack server (e.g., > "(default)" is not the same as "default"). > -- Your example did not connect to the Jack server. > -- Your example may not have not set sr and ksmps to Jack's sr and buffer size. > -- Your example did not turn Jack "on." But that shouldn't matter > because "on" is the default. > -- Your example did not actually send any audio to the Jack server. > > I fixed these problems, and the modified example ran just fine (it is > attached). It turned the Jack transport off when it was supposed to, > also. Of course, as you noted, this does not affect Csound's score > position. You could, however, write a user-defined opcode that would > reset the Csound score position and the Jack transport position at the > same time, perhaps like this: > > opcode transport > ioperation, itime xin > JackoTransport ioperation, itime > Sevent sprintf "a 0 %f\n", itime > scoreline_i Sevent > endop > > Then you could use some sort of MIDI message from Jack to control both > the Jack server transport and the Csound score time. > > Currently, the Jacko opcodes do not listen to the Jack transport and > adjust Csound's score time accordingly. If that is what you need, let > me know and I will see how hard it would be to implement. It looks > like it's not that hard and should only require a callback in the > Jacko opcodes for the transport position and state. > > Regards, > Mike > > ----------------------------------------------------- > Michael Gogins > Irreducible Productions > http://michaelgogins.tumblr.com > Michael dot Gogins at gmail dot com > > > On Mon, Feb 6, 2017 at 1:24 PM, Guillermo Senna |
Date | 2017-02-07 00:59 |
From | Guillermo Senna |
Subject | Re: Syncing to Jack Transport |
I've read your article again and I see what you mean. I've already forgotten how you were syncing and that there was a Master/Slave thing (besides NetJack). But isn't it possible to sync Blue's timeline with Jack Transport when working with just one computer? I'm sorry I haven't had the chance to explore Blue yet so I'm not sure what it can and cannot do. On 06/02/17 15:35, Menno Knevel wrote: > No - Blue, in this case, is just a timeline that holds 2 Objects containing > each the same JackTransport opcode. One time for start, one time later in > the compostion for stop. > So i run Blue, that spits out the this Csound code on the timeline, but Blue > itself is not guided by JackTransport. > > The second computer, the slave, is being controlled by Csound's > JackTransport opcode. > > > > -- > View this message in context: http://csound.1045644.n5.nabble.com/Csnd-Syncing-to-Jack-Transport-tp5754309p5754322.html > Sent from the Csound - General mailing list archive at Nabble.com. > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |