Csound Csound-dev Csound-tekno Search About

oscil(i) not initialised

Date2016-04-04 14:01
FromFfanci Silvain
Subjectoscil(i) not initialised
Hey hey everyone,
got a problem with some code here. The issue appears to be a conditional execution of an oscil or oscili opcode inside a UDO. Depending on which statement has to be used, I find, if it is in the "if" part, it's successful, if it's in the else-branch I get a complaint about one uninitialised oscil opsocde.

This is running on Csound Csound 6.0.7 Beta (19.02.2016) from the git repository.

Any ideas anyone? Code is below:

*** ws.csd ***


-o blp.wav -W



sr	=	48000
ksmps	=	10
nchnls	=	2

opcode waveshape, a, kkkiii
 	kamp,kf,kndx,isin,itf,igf  xin

 	if kndx != 0 then
 		asin oscil 0.5*kndx,kf,isin ; Problem here and...
 		awsh tablei asin,itf,1,0.5
 		kscl tablei kndx,igf,1
 		aout = awsh*kamp*kscl
 		goto Output
 	else
 		aout oscil kamp, kf, isin ; here
 		goto Output
 	endif

Output:
 	xout aout
endop

opcode saw, a, kkkiii
 	kamp,kf,kndx,isin,itf,igf  xin

 	amod oscili  1,kf,isin, 0.25
 	asq waveshape kamp*0.5,kf,kndx,isin,itf,igf
 	xout  asq*(amod + 1)
endop
instr 1
 	knd line 0, p3, 1
 	ar saw 15000, p4, p5, 1, 2, 3
 	outs ar, ar
endin



f1 0 32768 10 1
f2 0 16385 "tanh" -157 157
f3 0  8193 4  2 1
; p5 changes the relevant parameter from 0 to 1
i1 0 5 110 0
i1 + . 110 0.25
i1 . . 110 1
i1 . . 220 0
i1 . . 220 0.25
i1 . . 220 1
i1 . . 440 0
i1 . . 440 0.25
i1 . . 440 1
e


*** ws.csd ***

Ta-ta
----
Ffanci
* Homepage: https://freeshell.de/~silvain
* Twitter:  http://twitter.com/ffanci_silvain
* GitHub:   https://github.com/fsilvain

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

Date2016-04-04 15:58
FromVictor Lazzarini
SubjectRe: oscil(i) not initialised
The problem is the first of  your 

goto Output

line. It’s executed at i- and perf-time, and so the second oscillator does not
get initialised (it is jumped at i-time).

You don’t need any of these goto lines, the if-then-endif will do what you want.

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 4 Apr 2016, at 14:01, Ffanci Silvain  wrote:
> 
> Hey hey everyone,
> got a problem with some code here. The issue appears to be a conditional execution of an oscil or oscili opcode inside a UDO. Depending on which statement has to be used, I find, if it is in the "if" part, it's successful, if it's in the else-branch I get a complaint about one uninitialised oscil opsocde.
> 
> This is running on Csound Csound 6.0.7 Beta (19.02.2016) from the git repository.
> 
> Any ideas anyone? Code is below:
> 
> *** ws.csd ***
> 
> 
> -o blp.wav -W
> 
> 
> 
> sr	=	48000
> ksmps	=	10
> nchnls	=	2
> 
> opcode waveshape, a, kkkiii
> 	kamp,kf,kndx,isin,itf,igf  xin
> 
> 	if kndx != 0 then
> 		asin oscil 0.5*kndx,kf,isin ; Problem here and...
> 		awsh tablei asin,itf,1,0.5
> 		kscl tablei kndx,igf,1
> 		aout = awsh*kamp*kscl
> 		goto Output
> 	else
> 		aout oscil kamp, kf, isin ; here
> 		goto Output
> 	endif
> 
> Output:
> 	xout aout
> endop
> 
> opcode saw, a, kkkiii
> 	kamp,kf,kndx,isin,itf,igf  xin
> 
> 	amod oscili  1,kf,isin, 0.25
> 	asq waveshape kamp*0.5,kf,kndx,isin,itf,igf
> 	xout  asq*(amod + 1)
> endop
> instr 1
> 	knd line 0, p3, 1
> 	ar saw 15000, p4, p5, 1, 2, 3
> 	outs ar, ar
> endin
> 
> 
> 
> f1 0 32768 10 1
> f2 0 16385 "tanh" -157 157
> f3 0  8193 4  2 1
> ; p5 changes the relevant parameter from 0 to 1
> i1 0 5 110 0
> i1 + . 110 0.25
> i1 . . 110 1
> i1 . . 220 0
> i1 . . 220 0.25
> i1 . . 220 1
> i1 . . 440 0
> i1 . . 440 0.25
> i1 . . 440 1
> e
> 
> 
> *** ws.csd ***
> 
> Ta-ta
> ----
> Ffanci
> * Homepage: https://freeshell.de/~silvain
> * Twitter:  http://twitter.com/ffanci_silvain
> * GitHub:   https://github.com/fsilvain
> 
> 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

Date2016-04-04 16:18
FromFfanci Silvain
SubjectRe: oscil(i) not initialised
Victor Lazzarini, Apr 4 2016:

> The problem is the first of  your
>
> goto Output
>
> line. It?s executed at i- and perf-time, and so the second oscillator does not
> get initialised (it is jumped at i-time).
Thanks, that did it. Stupid of me!
...

Ta-ta
----
Ffanci
* Homepage: https://freeshell.de/~silvain
* Twitter:  http://twitter.com/ffanci_silvain
* GitHub:   https://github.com/fsilvain

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