Csound Csound-dev Csound-tekno Search About

How do you csounders declick your bass?

Date2016-01-01 13:52
FromPeter Burgess
SubjectHow do you csounders declick your bass?
Hi there, I'm having a bass declicking drama, so I'm wondering how all
you folks go about declicking your bass patches.

I thought I'd solved it before, when I was using this:

"adclk linseg 0, 0.0005, ilvl, p3 - 0.0107, ilvl, 0.01, 0\n"

At 44100 sr, each sample is 0.000022676 seconds long, so i thought
0.0005 seconds should allow plenty of samples to remove the click in
at this sample rate and anything higher.

This worked wonderfully on my lead synths, which I assumed meant it
worked on everything. I discovered the other day that my basses were
still clicking though.

>From my messing around today, I've found bass seems to require a much
longer declick time. My first instinct as to why this might be is
because each cycle of the waveform is so much longer, and I guess if
you alter only the very first cycle of the waveform with a declick
envelope, then you end up with a single cycle with different harmonic
content and thus create the impulse we hear as a click.

So my next though was that I could use the fundamental frequency of
the note to decide the declick. I tried a few versions of this

p4 is hz of note played
ilvl is the level shift of the instrument

ispc = 1/p4
adclk linseg 0, ispc, ilvl, p3 - ispc * 2, ilvl, ispc, 0
adclk linseg 0, ispc, ilvl, p3 - ispc * 4, ilvl, ispc * 2, 0
adclk linseg 0, ispc * 0.5, ilvl, p3 - ispc * 2, ilvl, ispc, 0
...

and a whole load more with different ratios of ispc per
attack/sustain/release section, and different sized gaps at the end.

Two problems with this:
1 - to get a ratio that works consistently, I always end up with a
noticeable truncation of notes with the lower frequencies.
2 - with ratios on the cusp of working and not, some of the notes
still click and others don't. I think it was usually the higher notes
that clicked more (though not certain still) which would suggest that
my idea isn't totally solid.

So next I tried adding a constant attack/sustain/decay length to the
ispc ratios, a bit like this.

adclk linseg 0, ispc + 0.01, ilvl, p3 - (ispc * 2 + 0.02), ilvl, ispc + 0.01, 0
adclk linseg 0, ispc + 0.01, ilvl, p3 - (ispc * 3.5 + 0.02), ilvl,
ispc * 2 + 0.01, 0
...

I think it worked better, but the results still weren't ideal.

The declick UDO I found online does this:

aenv    linseg 0, 0.02, 1, p3 - 0.05, 1, 0.02, 0, 0.01, 0


That can be found here:

http://www.csounds.com/udo/displayOpcode.php?opcode_id=9

This works, but again truncates the notes a noticeable amount. Shorter
sections than 0.02 and 0.05 start to result in clicking.

I thought about using exponential and logarithmic segments instead.
expseg has aweful results, as you might expect. I don't think there's
a specific log version. I thought I'd seen an opcode before that
allowed you to set the curvature of each segment, but I might just be
thinking of the similar GEN routine.

So I am struggling to work out where to go from here. The best balance
of click reduction vs audible impact I've achieved so far is this:

"adclk linseg 0, 0.017, ilvl, p3 - 0.045, ilvl, 0.017, ilvl * 0.5, 0.008, 0\n"

But it's still not ideal.

So, I'm intrigued to know how you guys deal with it?

Hope the essay doesn't put too many of you off reading it ;)

Pete

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-01-01 15:21
Fromiron_attorney
SubjectRe: How do you csounders declick your bass?
I accidently posted this on the csound-dev list first. This was thorin's
reply:

I use something like this:

opcode declickr, a, ajjo

ain, irisetime, idectime, itype xin
irisetm = (irisetime == -1 ? 0.003 : irisetime)
idectm = (idectime == -1 ? 0.08 : idectime)
aenv    transegr 0, irisetm, itype, 1, 0, 0, 1, idectm, itype, 0
        xout ain * aenv         ; apply envelope and write output
endop


With bass I often find throwing in a highpass above 20hz helps. 

abass buthp abass, 20
abass declickr abass

....

Having tried that, I can highly recommend both the high pass at 20hz, and
using transeg to get a quick rise at the beggining of the note. I'm still
experimenting with what kind of curve to use for the end of the note. This
is now my current best solution:

;ilvl = final level adjustment

ahp   buthp   asig,  20

iattacktime = 0.005
iattackcurve = -2.5        ; quick rise
idecaytime = 0.005
idecaycurve = 0         ; flat decay
isustaintime = p3 - 0.015

adclk transeg 0,iattacktime, iattackcurve, ilvl, isustaintime, 0, ilvl,
idecaytime, idecaycurve, 0

atot = ahp * adclk

This alone seems to work great for basses with large spectral content, but
with simple basses with mainly deep partials, there is still a noticable
impluse at the beggining. I've found this can be almost entirely removed
with a high order lowpass at 5000hz, which doesn't colour the simple basses.
The cutoff could obviously be altered for more complex basses that still
suffer from a bit of a click.

icutoff = 5000
ipoles = 10
alp   clfilt   asig,    icutoff, 0, ipoles

Thanks to thorin for the help! I'd still be intrigued to know of any other
ideas people out there have.

Pete



--
View this message in context: http://csound.1045644.n5.nabble.com/Csnd-How-do-you-csounders-declick-your-bass-tp5745738p5745743.html
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

Date2016-01-01 17:25
Fromjpff
SubjectRe: How do you csounders declick your bass?
I thought dcblock and dcblock2 were highpass filters.  Is it just the 
wrong cutoff?
==John ff

On Fri, 1 Jan 2016, iron_attorney wrote:

> I accidently posted this on the csound-dev list first. This was thorin's
> reply:
>
> I use something like this:
>
> opcode declickr, a, ajjo
>
> ain, irisetime, idectime, itype xin
> irisetm = (irisetime == -1 ? 0.003 : irisetime)
> idectm = (idectime == -1 ? 0.08 : idectime)
> aenv    transegr 0, irisetm, itype, 1, 0, 0, 1, idectm, itype, 0
>        xout ain * aenv         ; apply envelope and write output
> endop
>
>
> With bass I often find throwing in a highpass above 20hz helps.
>
> abass buthp abass, 20
> abass declickr abass
>
> ....
>
> Having tried that, I can highly recommend both the high pass at 20hz, and
> using transeg to get a quick rise at the beggining of the note. I'm still
> experimenting with what kind of curve to use for the end of the note. This
> is now my current best solution:
>
> ;ilvl = final level adjustment
>
> ahp   buthp   asig,  20
>
> iattacktime = 0.005
> iattackcurve = -2.5        ; quick rise
> idecaytime = 0.005
> idecaycurve = 0         ; flat decay
> isustaintime = p3 - 0.015
>
> adclk transeg 0,iattacktime, iattackcurve, ilvl, isustaintime, 0, ilvl,
> idecaytime, idecaycurve, 0
>
> atot = ahp * adclk
>
> This alone seems to work great for basses with large spectral content, but
> with simple basses with mainly deep partials, there is still a noticable
> impluse at the beggining. I've found this can be almost entirely removed
> with a high order lowpass at 5000hz, which doesn't colour the simple basses.
> The cutoff could obviously be altered for more complex basses that still
> suffer from a bit of a click.
>
> icutoff = 5000
> ipoles = 10
> alp   clfilt   asig,    icutoff, 0, ipoles
>
> Thanks to thorin for the help! I'd still be intrigued to know of any other
> ideas people out there have.
>
> Pete
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Csnd-How-do-you-csounders-declick-your-bass-tp5745738p5745743.html
> 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

Date2016-01-02 16:01
FromPeter Burgess
SubjectRe: How do you csounders declick your bass?
I'm confused, thorin mentioned dcblock aswell. Is dcblock a suggestion
or am I missing something?

On Fri, Jan 1, 2016 at 5:25 PM, jpff  wrote:
> I thought dcblock and dcblock2 were highpass filters.  Is it just the wrong
> cutoff?
> ==John ff
>
>
> On Fri, 1 Jan 2016, iron_attorney wrote:
>
>> I accidently posted this on the csound-dev list first. This was thorin's
>> reply:
>>
>> I use something like this:
>>
>> opcode declickr, a, ajjo
>>
>> ain, irisetime, idectime, itype xin
>> irisetm = (irisetime == -1 ? 0.003 : irisetime)
>> idectm = (idectime == -1 ? 0.08 : idectime)
>> aenv    transegr 0, irisetm, itype, 1, 0, 0, 1, idectm, itype, 0
>>        xout ain * aenv         ; apply envelope and write output
>> endop
>>
>>
>> With bass I often find throwing in a highpass above 20hz helps.
>>
>> abass buthp abass, 20
>> abass declickr abass
>>
>> ....
>>
>> Having tried that, I can highly recommend both the high pass at 20hz, and
>> using transeg to get a quick rise at the beggining of the note. I'm still
>> experimenting with what kind of curve to use for the end of the note. This
>> is now my current best solution:
>>
>> ;ilvl = final level adjustment
>>
>> ahp   buthp   asig,  20
>>
>> iattacktime = 0.005
>> iattackcurve = -2.5        ; quick rise
>> idecaytime = 0.005
>> idecaycurve = 0         ; flat decay
>> isustaintime = p3 - 0.015
>>
>> adclk transeg 0,iattacktime, iattackcurve, ilvl, isustaintime, 0, ilvl,
>> idecaytime, idecaycurve, 0
>>
>> atot = ahp * adclk
>>
>> This alone seems to work great for basses with large spectral content, but
>> with simple basses with mainly deep partials, there is still a noticable
>> impluse at the beggining. I've found this can be almost entirely removed
>> with a high order lowpass at 5000hz, which doesn't colour the simple
>> basses.
>> The cutoff could obviously be altered for more complex basses that still
>> suffer from a bit of a click.
>>
>> icutoff = 5000
>> ipoles = 10
>> alp   clfilt   asig,    icutoff, 0, ipoles
>>
>> Thanks to thorin for the help! I'd still be intrigued to know of any other
>> ideas people out there have.
>>
>> Pete
>>
>>
>>
>> --
>> View this message in context:
>> http://csound.1045644.n5.nabble.com/Csnd-How-do-you-csounders-declick-your-bass-tp5745738p5745743.html
>> 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