Csound Csound-dev Csound-tekno Search About

[Cs-dev] Csound and Jack

Date2005-12-01 20:37
FromDavid Akbari
Subject[Cs-dev] Csound and Jack
Hi devel-list,

I was wondering if it is possible at present time to use only the Jack 
server and Csound to route several instances of Csound through each 
other via Jack.

When I tried using this technique Csound errors out saying

ftable 1:
OSC listener #0 started on port 47110
orch now loaded
audio buffered in 1024 sample-frame blocks
could not attach as client
  *** JACK: jackConnectServer(): could not connect to JACK server
Failed to initialise real time audio input

Here's the source code i used, assume the input is just a sine wave 
from another Csound process. What's weird is that they both work, 
separately but not simultaneously. Is this because of an identical 
process name conflict ??





sr		=	44100
kr		=	44100
ksmps	=	1
nchnls	=	2

itmp	ftgen	1, 0, 16384, 20, 9, 1

/*--- ---*/

		instr	1

ainl, ainr	ins

kscl	ctrl7	1, 1, -12, 12
kscl	=	(2^(kscl/12))
fl	pvsanal	ainl, 8192, 8192/4, 8192, -1
fr	pvsanal	ainr, 8192, 8192/4, 8192, -1
fscl	pvscale	fl, kscl
fscr	pvscale	fr, kscl
a0l	pvsynth	fscl
a0r	pvsynth	fscr

	outs	a0l, a0r

		endin

/*--- ---*/


i1	0	1000

e

; # EOF



-David



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-12-02 08:35
FromIstvan Varga
SubjectRe: [Cs-dev] Csound and Jack
AttachmentsNone  

Date2005-12-02 15:01
FromDavid Akbari
SubjectRe: [Cs-dev] Csound and Jack
On Dec 2, 2005, at 3:35 AM, Istvan Varga wrote:

> If you want to connect multiple instances of Csound to the Jack server,
> then each should have an unique client name which can be set with the
> -+jack_client option. By default, the client name is 'csound5'.
> For more information on Jack options, see also this page:
>   http://www.csounds.com/manual/html/ch07.html#csound5jack

Thank you, Istvan. This is exactly the information I needed.

For list verbosity and for the purposes of the various archives and 
Nabble.com and elsewhere, here is the complete implementation, with 
Csound files and commandline options.


Example 1 commandline used:
[localhost:~] user% /Users/you/CVS/csound5/csound -odac -iadc -d -M0 
-+rtaudio=Jack -+jack_client=csound5-1 ~/Desktop/glovescale.csd



;//  Example 1 - Signal generator
;//    called "csound5-1" for the Jack server.

sr		=	44100
kr		=	44100
ksmps	=	1
nchnls	=	2

itmp	ftgen	1, 0, 16384, 10, 1

;//  This header contains references to all UDOs on the repository
#include	"_udo.h"
;//    http://www.csounds.com/udo

/*--- ---*/

		instr	1

/*  substitute with midi control if you do not have a p5 glove ! */
ka, kb, kc, kf1, kf2, kf3, kf4, kf5, kx, ky, kz		p5glove
;//  scale raw input in range 0-1
kavg	=	(((kf1+kf2+kf3+kf4+kf5)/5)/63)
kzee	=	((kz+400)/800)
/*                                                                */

;//  rescale to desired range
kscl		scale	kavg, 4.0, 12.0
kscl2	scale	kzee, 0, 8

;//  volume control
kamp	ctrl7	1, 7, 0, 150
kvol	gainslider	kamp

;//  sound synthesis
aosc	oscil	12000, cpspch(kscl), 1
aset	waveset	aosc, kscl2-1
aout	=	aset*kvol

aclp	clip	aout, 2, 32767

;	printk2	kscl ; for debugging
	outs	aclp, aclp

		endin

/*--- ---*/


;//  fun !
i1	0	1000

e

; # EOF




Example 2 commandline used:
[localhost:~] user% /Users/you/CVS/csound5/csound -odac -iadc -d -M0 
-+rtaudio=Jack -+jack_client=csound5-2 ~/Desktop/glovescale.csd



;//  Example 2 - Process the previous input using the mod wheel
;//    to alter pitch

sr		=	44100
kr		=	44100
ksmps	=	1
nchnls	=	2

itmp	ftgen	1, 0, 16384, 20, 9, 1

/*--- ---*/

		instr	1

ainl, ainr	ins

kscl	ctrl7	1, 1, -12, 12
kscl	=	(2^(kscl/12))
fl	pvsanal	ainl, 8192, 8192/4, 8192, -1
fr	pvsanal	ainr, 8192, 8192/4, 8192, -1
fscl	pvscale	fl, kscl
fscr	pvscale	fr, kscl
a0l	pvsynth	fscl
a0r	pvsynth	fscr

acll	clip	a0l, 2, 32767
aclr	clip	a0r, 2, 32767

	outs	acll, aclr

		endin

/*--- ---*/


i1	0	1000

e

; #EOF



Thanks again, Istvan, for this valuable addition to the language !


-David



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net