[Csnd] A slider to control the phase shift
Date | 2024-03-11 20:25 |
From | Ital Rolando |
Subject | [Csnd] A slider to control the phase shift |
Hello to everyone, a newbie 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
With this code I'm trying to control the phase of a sine with a slider, but I'm stuck why it doesn't update when Csound runs: <CsoundSynthesizer> <CsOptions> ;-odac8 -B1024 -b1024 </CsOptions> <CsInstruments> sr = 44100 ksmps = 64 nchnls = 2 0dbfs = 1 giSine ftgen 1, 0, 2^14, 10, 1 instr 1 kAmpLeft init 0.5 kAmpRight init 0.5 kFreqLeft invalue "freqmodLeft" kFreqRight invalue "freqmodRight" kPhaseLeft invalue "phaseLeft" kMix invalue "mixPhase"
print i(kPhaseLeft) aLeft oscili kAmpLeft, kFreqLeft, 1, i(kPhaseLeft) aRight oscili kAmpRight, kFreqRight, 1, 0
outs aLeft + aRight * kMix, aLeft * kMix + aRight endin </CsInstruments> <CsScore> i1 0 1000 e </CsScore> </CsoundSynthesizer> Ital -- mob: +39 329 12 67 087 |
Date | 2024-03-11 20:59 |
From | ST Music |
Subject | Re: [Csnd] A slider to control the phase shift |
Hi Ital, I could be wrong but I think that as oscili will read the phase at i rate this won't work. You can instead read directly from the ftable using a table/tablei opcode. Here's an example, in this case the phase of the right output is being modulated. <CsoundSynthesizer> <CsOptions> -odac ; -o phase_mod.wav </CsOptions> <CsInstruments> sr = 48000 ksmps = 32 nchnls = 2 0dbfs = 1 giSine = ftgen(1, 0, 2^14, 10, 1) instr 1 kPhs = line(0, p3, 1) ; phase mod. aIdx = phasor(220) aL = tablei:a(aIdx, 1, 1, 0, 1) aR = tablei:a(aIdx + kPhs, 1, 1, 0, 1) iAmp = .8 outs aL * iAmp, aR * iAmp endin </CsInstruments> <CsScore> i1 0 16 </CsScore> </CsoundSynthesizer> Best, Scott On Mon, Mar 11, 2024, 4:25 p.m. Ital Rolando <ital.rolando@gmail.com> wrote:
|
Date | 2024-03-11 21:03 |
From | ST Music |
Subject | Re: [Csnd] A slider to control the phase shift |
I should have noted that the phasor value will determine the frequency of the oscillator. It can be varied at k or a rate. On Mon, Mar 11, 2024, 4:59 p.m. ST Music <stunes6556@gmail.com> wrote:
|
Date | 2024-03-12 11:53 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] A slider to control the phase shift |
This is because oscillator phase can’t be changed by a control signal. Try this kph invalue “phase” aph phasor ifreq ; oscillator phase asig tablei aph + kph, -1, 1, 0, 1 ; oscillator output asig *= iamp ; amplitude scaling to replace asig oscilli iamp, ifreq ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 11 Mar 2024, at 20:25, Ital Rolando |
Date | 2024-03-12 19:10 |
From | Ital Rolando |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] A slider to control the phase shift |
Thanks a lot Scott, what a great opportunity to learn more. Really appreciated. Ital -- mob: +39 329 12 67 087 Il giorno mar 12 mar 2024 alle ore 12:53 Victor Lazzarini <Victor.Lazzarini@mu.ie> ha scritto: This is because oscillator phase can’t be changed by a control signal. Try this |