Csound Csound-dev Csound-tekno Search About

[Csnd] change iphs dinamically

Date2019-10-17 13:47
FromItal
Subject[Csnd] change iphs dinamically
I'm sorry, I'm not an expert of csound yet. I'm stuck on trying to change dynamically the phase of an oscili opcode through a spinbox.

sr = 44100

ksmps = 32
nchnls = 1
0dbfs = 1

; Instrument #1 - a basic oscillator.
instr 1
ktrig init 1
kamp = .5
kcps invalue "spinbox1"
kphs invalue "spinbox2"
ifn = 1

cyclestart:
iphs = i(kphs)/360
rireturn

print iphs; [, iarg1] [, iarg2] [...]

a1 oscili kamp, kcps, ifn, 0
a2 oscili kamp, kcps, ifn, iphs

;printk 1, kphs; [, iarg1] [, iarg2] [...]

out a1 + a2

endin


thanks a lot

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

Date2019-10-17 14:26
FromRory Walsh
SubjectRe: [Csnd] change iphs dinamically
You can do this with reinit, but note that it will result in clicks in the audio...note that I changed the invalue to a chnget so I could test it with Cabbage..

ksmps = 32
nchnls = 1
0dbfs = 1

; Instrument #1 - a basic oscillator.
instr 1
ktrig init 1
kamp = .5
kcps = 300; invalue "spinbox1"
kphs chnget "spinbox2"
ifn = 1

if changed(kphs) == 1 then
    reinit resetPhase
endif

resetPhase:
iphs = i(kphs)/360

print iphs; [, iarg1] [, iarg2] [...]
a1 oscili kamp, kcps, ifn, 0
a2 oscili kamp, kcps, ifn, iphs
out a1 + a2

endin

On Thu, 17 Oct 2019 at 13:48, Ital <ital.rolando@gmail.com> wrote:
I'm sorry, I'm not an expert of csound yet. I'm stuck on trying to change dynamically the phase of an oscili opcode through a spinbox.

sr = 44100

ksmps = 32
nchnls = 1
0dbfs = 1

; Instrument #1 - a basic oscillator.
instr 1
ktrig init 1
kamp = .5
kcps invalue "spinbox1"
kphs invalue "spinbox2"
ifn = 1

cyclestart:
iphs = i(kphs)/360
rireturn

print iphs; [, iarg1] [, iarg2] [...]

a1 oscili kamp, kcps, ifn, 0
a2 oscili kamp, kcps, ifn, iphs

;printk 1, kphs; [, iarg1] [, iarg2] [...]

out a1 + a2

endin


thanks a lot

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

Date2019-10-17 16:01
FromItal
SubjectRe: [Csnd] change iphs dinamically
these error occurred

instr 1 error: illegal opcod from expr anal, line 20:
if changed(kphs) == 1 then
error: input arg '#k0' used before defined, line 20:
if changed(kphs) == 1 then
2 syntax errors in orchestra. compilation invalid



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

Date2019-10-17 16:38
Fromjohn
SubjectRe: [Csnd] change iphs dinamically
Looks like a parsing thing, with attempt to use afunctional form in a 
Boolean expression.  I never tried that.a


On Thu, 17 Oct 2019, Ital wrote:

> these error occurred
> 
> instr 1 error: illegal opcod from expr anal, line 20:
> if changed(kphs) == 1 then
> error: input arg '#k0' used before defined, line 20:
> if changed(kphs) == 1 then
> 2 syntax errors in orchestra. compilation invalid
> 
> 
> ______________________________________________________________________________
> 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

Date2019-10-17 17:13
FromRory Walsh
SubjectRe: [Csnd] change iphs dinamically
I think I'm using 6.14, and it works for me?

On Thu 17 Oct 2019, 17:39 john, <jpff@codemist.co.uk> wrote:
Looks like a parsing thing, with attempt to use afunctional form in a
Boolean expression.  I never tried that.a


On Thu, 17 Oct 2019, Ital wrote:

> these error occurred
>
> instr 1 error: illegal opcod from expr anal, line 20:
> if changed(kphs) == 1 then
> error: input arg '#k0' used before defined, line 20:
> if changed(kphs) == 1 then
> 2 syntax errors in orchestra. compilation invalid
>
>
> ______________________________________________________________________________
> 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
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

Date2019-10-19 20:27
FromItal
SubjectRe: [Csnd] change iphs dinamically
Yes your version works. Thnks a lot


sr = 48000
ksmps = 32
nchnls = 2
0dbfs = 1

; Instrument #1 - a basic oscillator.
instr 1
ktrig init 1
kamp = .5
kcps1 invalue "spinboxf1"
kcps2 invalue "spinboxf2"
kphs invalue "spinbox2"
ifn = 1

if changed(kphs) == 1 then
reinit resetPhase
endif

resetPhase:
iphs = i(kphs)/360

print iphs; [, iarg1] [, iarg2] [...]


a1 oscili kamp, kcps1, ifn, 0
a2 oscili kamp, kcps2, ifn, iphs


outs (a1+a2)*.5, (a1+a2)*.5

endin



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