[Csnd] pops/discontinuities in chorus opcode
Date | 2020-04-25 21:32 |
From | walker |
Subject | [Csnd] pops/discontinuities in chorus opcode |
hello all, I have been trying to build a chorus effect, but am hearing from discontinuities/pops. They seem to occur when the lfo starts a new cycle. It also seems more prevalent at certain delay values (ideloff + idepth), such as 0.03 - 0.35. I borrowed quite a bit of code from here (thanks mikelson!): http://www.csounds.com/mikelson/multifx.orc I've have adjusted the table size, even going up to 16777216; this reduces the discontinuity/pop, but sometimes it can still be heard. (that table size seems pretty large to me). I have also compared deltapi and deltap3 for writing to the delay buffer... Maybe this caused by an interpolation issue... Any advice/insight would be greatly appreciated, hope everyone is safe and healthy, cheers. CODE: ;irate - hz, positive number ;idepth - range 0 - 1, gets multiplied to 0.2 as chorus delay range is from 20 ms to 40 ms opcode chorus, aa, aaii ainL, ainR, irate, idepth xin idepth *= 0.02 imixch = 0.5 ; Mix of chorused signal imix = 1 - imixch ; Mix of direct signal ideloff = .02 ; Delay offset converted to msec. kamp linseg 0, .002, 1, p3-.004, 1, .002, 0 aosc1 oscil idepth, irate, 12 ; LFO for chorus aosc2 = aosc1 + ideloff ; Add delay offset atempL delayr idepth + ideloff adelL deltap3 aosc2 ; Variable delay tap delayw ainL aosc3 oscil idepth, irate, 12, .25 ; LFOs for chorus aosc4 = aosc3 + ideloff ; Add delay offset atempR delayr idepth + ideloff adelR deltap3 aosc4 ; Variable delay tap delayw ainR aoutL = (adelL * imixch + ainL * imix) * kamp; Mix direct and chorused signals aoutR = (adelR * imixch + ainR * imix) * kamp xout aoutL, aoutR endop f1 0 16777216 10 1 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 |
Date | 2020-04-27 08:28 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Hi, Maybe I'm mistaken, but it looks like you are using table 12 for the oscil, but f1 to define the table. Could there be an issue with the actual table being used for the oscil? lør. 25. apr. 2020 kl. 22:32 skrev walker <walkerdavismusic@gmail.com>: hello all, |
Date | 2020-04-27 17:49 |
From | walker davis |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Oeyvind, You are correct, that is definitely an error. That being said, this left over error was one of the many things I tried while looking for the fix. I have updated the code below, but I do not think that this resolves the discontinuity/popping/maybe interpolation error I described in my original inquiry... Thank you for the response though! opcode chorus, aa, aaii ainL, ainR, irate, idepth xin idepth *= 0.02 imixch = 0.5 ; Mix of chorused signal imix = 1 - imixch ; Mix of direct signal ideloff = .02 ; Delay offset converted to msec. kamp linseg 0, .002, 1, p3-.004, 1, .002, 0 aosc1 oscil idepth, irate, 1 ; LFO for chorus aosc2 = aosc1 + ideloff ; Add delay offset atempL delayr idepth + ideloff adelL deltap3 aosc2 ; Variable delay tap delayw ainL aosc3 oscil idepth, irate, 1, .25 ; LFOs for chorus aosc4 = aosc3 + ideloff ; Add delay offset atempR delayr idepth + ideloff adelR deltap3 aosc4 ; Variable delay tap delayw ainR aoutL = (adelL * imixch + ainL * imix) * kamp; Mix direct and chorused signals aoutR = (adelR * imixch + ainR * imix) * kamp xout aoutL, aoutR endop f1 0 16777216 10 1 On Mon, Apr 27, 2020 at 12:28 AM Oeyvind Brandtsegg <obrandts@gmail.com> wrote:
|
Date | 2020-04-27 19:08 |
From | 00000008a49663bc-dmarc-request@LISTSERV.HEANET.IE |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Hello, when writing a chorus/flanger I've found that it doesen't glitch with the vdelay3 opcode, if i use whatever opcode in a delayr/delayw delay line i have discontinuities. Don't know why but vdelay3 with a-rate modulator works (maybe better managing of slow rate tempo changes???). Ciao Stefano Il 27 aprile 2020 alle 18.49 walker davis <walkerdavismusic@GMAIL.COM> ha scritto:
|
Date | 2020-04-27 19:41 |
From | john |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Any chance of a runnable orchestra? And score? Makes it easier to try to hear the problem. On Mon, 27 Apr 2020, walker davis wrote: > Oeyvind, > > You are correct, that is definitely an error. That being said, this left over > error was one of the many things I tried while looking for the fix. I have > updated the code below, but I do not think that this resolves the > discontinuity/popping/maybe interpolation error I described in my original > inquiry... > > Thank you for the response though! > > > > opcode chorus, aa, aaii > ainL, ainR, irate, idepth xin > > idepth *= 0.02 > imixch = 0.5 ; Mix of chorused signal > imix = 1 - imixch ; Mix of direct signal > ideloff = .02 ; Delay offset converted to msec. > > kamp linseg 0, .002, 1, p3-.004, 1, .002, 0 > > aosc1 oscil idepth, irate, 1 ; LFO for chorus > aosc2 = aosc1 + ideloff ; Add delay offset > atempL delayr idepth + ideloff > adelL deltap3 aosc2 ; Variable delay tap > delayw ainL > > aosc3 oscil idepth, irate, 1, .25 ; LFOs for chorus > aosc4 = aosc3 + ideloff ; Add delay offset > atempR delayr idepth + ideloff > adelR deltap3 aosc4 ; Variable delay tap > delayw ainR > > aoutL = (adelL * imixch + ainL * imix) * kamp; Mix direct and > chorused signals > aoutR = (adelR * imixch + ainR * imix) * kamp > > xout aoutL, aoutR > endop > > f1 0 16777216 10 1 > > > -------------------------------- > Walker Davis > > > On Mon, Apr 27, 2020 at 12:28 AM Oeyvind Brandtsegg |
Date | 2020-04-27 19:58 |
From | walker davis |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Stefano - thanks will try substituting the vdelay3 opcode. John - here is a small score, you will need to supply the FILEPATH to an audio file for instrument 1, but everything else should work. I have been using some electric piano sustained chord sample to hear the chorus effect. I also lowered the table size here to make the clicking more apparent. Thanks guys <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 gasendL init 0 gasendR init 0 opcode chorus, aa, aaii ainL, ainR, irate, idepth xin idepth *= 0.01 imixch = 0.5 ; Mix of chorused signal imix = 1 - imixch ; Mix of direct signal ideloff = .02 ; Delay offset converted to msec. kamp linseg 0, .002, 1, p3-.004, 1, .002, 0 aosc1 oscil idepth, irate, 1 ; LFO for chorus aosc2 = aosc1 + ideloff ; Add delay offset atempL delayr idepth + ideloff adelL deltap3 aosc2 ; Variable delay tap delayw ainL aosc3 oscil idepth, irate, 1, .25 ; LFOs for chorus aosc4 = aosc3 + ideloff ; Add delay offset atempR delayr idepth + ideloff adelR deltap3 aosc4 ; Variable delay tap delayw ainR aoutL = (adelL * imixch + ainL * imix) * kamp; Mix direct and chorused signals aoutR = (adelR * imixch + ainR * imix) * kamp xout aoutL, aoutR endop instr 1 Sfilename = FILEPATH ichnls = filenchnls(Sfilename) ktrans linseg 1, p3,1 if (ichnls == 1) then asigL diskin2 Sfilename, ktrans asigR = asigL elseif (ichnls == 2) then asigL, asigR diskin2 Sfilename, ktrans else asigL = 0 asigR = 0 endif gasendL += asigL gasendR += asigR endin instr 10 aoutL, aoutR chorus gasendL, gasendR, 2, .5 outs aoutL, aoutR gasendL = 0 gasendR = 0 endin </CsInstruments> <CsScore> f1 0 65536 10 1 i 10 0 4.0 i 1 0 4.0 e </CsScore> </CsoundSynthesizer> On Mon, Apr 27, 2020 at 11:41 AM john <jpff@codemist.co.uk> wrote: Any chance of a runnable orchestra? And score? Makes it easier to try to |
Date | 2020-04-27 20:15 |
From | Guillermo Senna |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Hi, Anything with feedback shouldn't be done with vdelay3. So, chorus should be OK, but for a flanger you should use deltap3. Cheers. On 27/4/20 15:08, 00000008a49663bc-dmarc-request@LISTSERV.HEANET.IE wrote: > Hello, when writing a chorus/flanger I've found that it doesen't glitch with the vdelay3 opcode, if i use whatever opcode in a delayr/delayw delay line i have discontinuities. Don't know why but vdelay3 with a-rate modulator works (maybe better managing of slow rate tempo changes???). > > Ciao > > Stefano > > >> Il 27 aprile 2020 alle 18.49 walker davis |
Date | 2020-04-27 20:46 |
From | 00000008a49663bc-dmarc-request@LISTSERV.HEANET.IE |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Hi Gulliermo, for feedback do you think that something along these lines should work? afeed init 0 achor vdelay3 ain + afeed, amodulator, 100 afeed = achor * kfeedback > Il 27 aprile 2020 alle 21.15 Guillermo Senna |
Date | 2020-04-27 21:21 |
From | Guillermo Senna |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
The problem with vdelay (and also with delay) is that the feedback part is always from the previous cycle. So, in the impulse response each echo gets delayed by an additional kr period. And this has a cumulative effect. I also recently learned that if your delay time is constant you can just subtract ksmps/sr from it and that fixes the problem. But what happens when you want to modulate the delay time? Then it becomes much harder to know how much time to subtract. That's why I think that anything with feedback shouldn't be done with vdelay. deltapi and deltap3 should work fine. Of course, it could also be that my guess is wrong! On 27/4/20 16:46, 00000008a49663bc-dmarc-request@LISTSERV.HEANET.IE wrote: > Hi Gulliermo, > for feedback do you think that something along these lines should work? > > afeed init 0 > achor vdelay3 ain + afeed, amodulator, 100 > afeed = achor * kfeedback > > > >> Il 27 aprile 2020 alle 21.15 Guillermo Senna |
Date | 2020-04-27 21:49 |
From | john |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
i am having trouble hearing anything but lookinfg at the spectrograph and wave form see a series f notches 32 samples apart (which is ksmps). If I change ksmps t 10 te notches occur every 10 samples -- only in bursts from time to time. nOt sure if this is what you are hearing. 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 |
Date | 2020-04-27 22:18 |
From | Justin Smith |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
could those notches be related to the k rate envelopes in the instrument and opcode? On Mon, Apr 27, 2020 at 1:49 PM john |
Date | 2020-04-27 22:31 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
It is correct that the feedback will add ksmps number of samples extra delay, but I think this should happen likewise with any delay opcodes. It is built in to the way block based audio processing works. Use ksmps = 1 to avoid it. This can also be done locally inside a UDO so that you don't have to run your whole orc at that ksmps. I usually use vdelayx for these kinds of variable delay btw. Also, you might be hitting the max delay time of delayr exactly, and get an artifact, here: atempL delayr idepth + ideloff Try adding a small extra time to the delay buffer allocation. atempL delayr idepth + ideloff +.1 all best man. 27. apr. 2020 kl. 22:21 skrev Guillermo Senna <gsenna@gmail.com>: The problem with vdelay (and also with delay) is that the feedback part |
Date | 2020-04-27 22:55 |
From | Guillermo Senna |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Hi Oeyvind, I don't know if we are addressing the same thing. I've already posted this code to the dev list, so I apologize for the double post. But here is what I mean. This code produces -inf dBFS. |
Date | 2020-04-27 23:15 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
I would expect it to produce silence yes, since the delayr/w writes first then reads on the next k-cycle and then we get the extra ksmps delay time. But the exact same feedback path can be built with both techniques (as long as we adapt the delay time). Varying the delay time does not change this behaviour, so you can safely use the same method of adapting the delay time (n-ksmps) as you use here. Just beware that you don't ask for a negative delay time (for example zero minus ksmps) as that would be asking Csound to predict the future, which it can not do .... yet. :-) man. 27. apr. 2020 kl. 23:56 skrev Guillermo Senna <gsenna@gmail.com>: Hi Oeyvind, |
Date | 2020-04-27 23:33 |
From | Guillermo Senna |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Indeed, not yet... But I tried to replicate this same thing with deltap3 and vdelay3 and couldn't make it work unless I chose a constant time for the delay time (which kind of defeats the purpose of using vdelay). The problem seems to be that it is not possible to account for this problem of having to use the feedback from the previous cycle when you are constantly changing the delay time. So the impulse response from deltap3 was correct, but the one from vdelay3 got the echoes shifted in time. If I'm not mistaken the subtraction needed won't be by a constant but by something related to the modulation signal. Anyway, I think it's just easier to use deltap3 for something with feedback than having to worry about this issue. On 27/4/20 19:15, Oeyvind Brandtsegg wrote: > I would expect it to produce silence yes, since the delayr/w writes first > then reads on the next k-cycle and then we get the extra ksmps delay time. > But the exact same feedback path can be built with both techniques (as long > as we adapt the delay time). Varying the delay time does not change this > behaviour, so you can safely use the same method of adapting the delay time > (n-ksmps) as you use here. > Just beware that you don't ask for a negative delay time (for example zero > minus ksmps) as that would be asking Csound to predict the future, which it > can not do .... yet. :-) > > man. 27. apr. 2020 kl. 23:56 skrev Guillermo Senna |
Date | 2020-04-28 16:44 |
From | walker davis |
Subject | Re: [Csnd] pops/discontinuities in chorus opcode |
Oeyvend, Guillermo, John, Justin, Stefano, Enjoyed the discussion, definitely picked up on a few extra things just from following along. The chorus seems to be working pretty smoothly when an additional .1 is added the MaxDelay per Oeyvend's recommendation. On Mon, Apr 27, 2020 at 3:33 PM Guillermo Senna <gsenna@gmail.com> wrote: Indeed, not yet... |