[Csnd] API channel out
| Date | 2012-04-08 11:53 | 
| From | francesco  | 
| Subject | [Csnd] API channel out | 
Hello All,
i am play with the API, trying to get the value of audio samples from
Csound.
I'm using a Lua script that call CppSound.GetChannel.
If i use a krate signal all is right while using a-rate signal
i have always 0.
Here my simple examples:
CSD
gaOut		chnexport	"audio", 3
gaOut		init		0
gkOut		chnexport	"audio_k", 3
gkOut		init		0
		instr		2
audio		diskin2	"qohelet_001.wav", 1
;gaOut	=		gaOut + audio
gaOut		=		audio
kaudio	downsamp	audio
gkOut		=		kaudio
		outs		audio, audio
		endin
Script
local cs = luaCsnd.CppSound()
cs:load("esAPI_1.csd")
cs:setCommand("csound -odac -b512 test.orc test.sco")
cs:exportForPerformance()
res = cs:compile()
if res==0 then
	while cs:PerformKsmps()== 0 do
		va = cs:GetChannel("audio")
		vk = cs:GetChannel("audio_k")
		print(va, vk)
	end
end
What i'm doing wrong?
Thanks,
ciao,
francesco.
--
View this message in context: http://csound.1045644.n5.nabble.com/API-channel-out-tp5625795p5625795.html
Sent from the Csound - General mailing list archive at Nabble.com.
 | 
| Date | 2012-04-08 13:45 | 
| From | Victor Lazzarini  | 
| Subject | Re: [Csnd] API channel out | 
The cs::GetChannel(), if it is wrapping the Csound::GetChannel() C++ method, only works wtih i- and  k-rate channels (and String channels as well). So I think the
audio rate channel will not work. To access it, you will need to use csoundGetChannelPtr() or whatever it is in lua.
If the k-rate channel is not working, I would suggest using chnset instead of the chnexport connection to global variables, like this
chnset gkOut, "audio_k"
Regards
Victor
On 8 Apr 2012, at 11:53, francesco wrote:
> Hello All,
> i am play with the API, trying to get the value of audio samples from
> Csound.
> I'm using a Lua script that call CppSound.GetChannel.
> If i use a krate signal all is right while using a-rate signal
> i have always 0.
> Here my simple examples:
> 
> CSD
> 
> gaOut		chnexport	"audio", 3
> gaOut		init		0
> gkOut		chnexport	"audio_k", 3
> gkOut		init		0
> 
> 		instr		2
> 
> audio		diskin2	"qohelet_001.wav", 1
> ;gaOut	=		gaOut + audio
> gaOut		=		audio
> kaudio	downsamp	audio
> gkOut		=		kaudio
> 		outs		audio, audio
> 		endin
> 
> Script
> 
> local cs = luaCsnd.CppSound()
> 
> cs:load("esAPI_1.csd")
> cs:setCommand("csound -odac -b512 test.orc test.sco")
> cs:exportForPerformance()
> res = cs:compile()
> 
> if res==0 then
> 	while cs:PerformKsmps()== 0 do
> 		va = cs:GetChannel("audio")
> 		vk = cs:GetChannel("audio_k")
> 		print(va, vk)
> 	end
> end
> 
> What i'm doing wrong?
> 
> Thanks,
> ciao,
> francesco.
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/API-channel-out-tp5625795p5625795.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> 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-08 14:12 | 
| From | fra III  | 
| Subject | Re: [Csnd] API channel out | 
thanks Mr. Victor. The krate signal is ok, is working right. Thanks for explanations, i will also try csoundGetChannelPtr(). What is the difference for chnexport and chnset? ciao, francesco.  | 
| Date | 2012-04-08 14:20 | 
| From | Victor Lazzarini  | 
| Subject | Re: [Csnd] API channel out | 
Well, chnexport should tie a global variable to a channel. Chnset just places a value in a channel. On 8 Apr 2012, at 14:12, fra III wrote: > thanks Mr. Victor. > The krate signal is ok, is working right. > Thanks for explanations, i will also try csoundGetChannelPtr(). > > What is the difference for chnexport and chnset? > > ciao, > francesco. > > > > > > 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  |