Csound Csound-dev Csound-tekno Search About

[Csnd] Negative Envelope Contour

Date2019-06-08 13:10
Frombrian@AMSYNTH.COM
Subject[Csnd] Negative Envelope Contour

Hi everyone,

does anyone know how to get an envelope (eg. linseg) to provide a negative contour rather than positive?

 

Thanks in advance!

Brian

 

Date2019-06-08 13:16
FromVictor Lazzarini
SubjectRe: [Csnd] Negative Envelope Contour
Use negative values (linear envs) or a simple arithmetic expression (exp envs, depending on how you want the curve)

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 8 Jun 2019, at 13:10, brian@AMSYNTH.COM <brian@amsynth.com> wrote:

Hi everyone,

does anyone know how to get an envelope (eg. linseg) to provide a negative contour rather than positive?

 

Thanks in advance!

Brian

 
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-06-08 13:17
From"Jeanette C."
SubjectRe: [Csnd] Negative Envelope Contour
Jun 8 2019, brian@AMSYNTH.COM has written:

>
>
> Hi everyone,
>
> does anyone know how to get an envelope (eg. linseg)
> to provide a negative contour rather than positive?
...
Negative in which way? Going from e.g. 0 to -1 or forming the opposite
of a "normal positive" curve?
1. You could just go from 0 to -1, I am not aware of a restraint there
or you could multiply the output of a positive env by -1.
2. You can subtract your positive contour from the maximum value. e.g.:
kpositive linseg 0, p3/3, 1.5, p3/3, 1.2, p3/3, 0
; Maximum is 1.5
kcomplement = 1.5 - kpositive

HTH, best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me <3
(Britney Spears)

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-06-08 13:20
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

Thanks Victor and Jeanette! I'll try your suggestions and see what I get. (Yes, something like going from 0 to -1 instead of 0 to +1)

I guess I could have experimented a bit myself first on this one.. but sometimes suggestions are better! :)

 

Brian

 

On Sat, 8 Jun 2019 14:17:29 +0200, Jeanette C. wrote:

Jun 8 2019, brian@AMSYNTH.COMhas written:
Hi everyone, does anyone know how to get an envelope (eg. linseg) to provide a negative contour rather than positive?
...
Negative in which way? Going from e.g. 0 to -1 or forming the opposite
of a "normal positive" curve?
1. You could just go from 0 to -1, I am not aware of a restraint there
or you could multiply the output of a positive env by -1.
2. You can subtract your positive contour from the maximum value. e.g.:
kpositive linseg 0, p3/3, 1.5, p3/3, 1.2, p3/3, 0
; Maximum is 1.5
kcomplement = 1.5 - kpositive

HTH, best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me 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-06-08 13:37
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

Still the same problem, but this time using madsr. The Csound Manual says that madsr range is 0 to 1, but I don't see any way to make this a negative amount..

 

On Sat, 8 Jun 2019 14:17:29 +0200, Jeanette C. wrote:

Jun 8 2019, brian@AMSYNTH.COMhas written:
Hi everyone, does anyone know how to get an envelope (eg. linseg) to provide a negative contour rather than positive?
...
Negative in which way? Going from e.g. 0 to -1 or forming the opposite
of a "normal positive" curve?
1. You could just go from 0 to -1, I am not aware of a restraint there
or you could multiply the output of a positive env by -1.
2. You can subtract your positive contour from the maximum value. e.g.:
kpositive linseg 0, p3/3, 1.5, p3/3, 1.2, p3/3, 0
; Maximum is 1.5
kcomplement = 1.5 - kpositive

HTH, best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me 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-06-08 13:47
From"Jeanette C."
SubjectRe: [Csnd] Negative Envelope Contour
Jun 8 2019, brian@AMSYNTH.COM has written:

>
>
> Still the same problem, but this time using madsr. The Csound
> Manual says that madsr range is 0 to 1, but I don't see any way to make
> this a negative amount..
...
Multiply the result by -1.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me <3
(Britney Spears)

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-06-08 14:01
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

Doesn't seem to work.  I am trying:  filterfreq * (filtermadsr*(-1))    but no sound.

 

On Sat, 8 Jun 2019 14:47:50 +0200, Jeanette C. wrote:

Jun 8 2019, brian@AMSYNTH.COMhas written:
Still the same problem, but this time using madsr. The Csound Manual says that madsr range is 0 to 1, but I don't see any way to make this a negative amount..
...
Multiply the result by -1.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me 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-06-08 14:11
From"Jeanette C."
SubjectRe: [Csnd] Negative Envelope Contour
Jun 8 2019, brian@AMSYNTH.COM has written:

>
>
> Doesn't seem to work. I am trying: filterfreq * (filtermadsr*(-1))
> but no sound.
...
Hm, I'm not too sure about the filters, but this would result in a
negative filter frequency and that might not work.
Try:
kinvadsr = 1 - kadsr
kfilterfreq * kinvadsr
This would result in a filter frequency between 0 and kfilterfreq. Most
likely, you'd be better off with something like:
kbasefilterfreq = minimum
kmaxamount = some_value
kfilterfreq = kbasefilterfreq + kmaxamount * kinvadsr
Because of the 1 - kmadsr you'll get the reverse shape of the adsr. You
could also multiply the adsr output by -1 and use the above version with
kbasefilterfreq ad kmaxamount, but then your filterfrequency would bo
from kbasefilterfreq - kmaxamount to kbasefilterfreq. That means you
should keep kmaxmount less than kbasefilterfreq.

If you'd want to set the modulation amount dynamically, you could use
limit or some other opcode to make sure that the actual filterfrequency
never goes below 0.

HTH, best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me <3
(Britney Spears)

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-06-08 15:15
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

I'm trying 1-madsr and getting some results, but sometimes notes don't sound. It's like something needs to "finish" before another note can sound. It's very irregular though.. sometimes it works for a bit, othertimes no.

 

On Sat, 8 Jun 2019 15:11:00 +0200, Jeanette C. wrote:

Jun 8 2019, brian@AMSYNTH.COMhas written:
Doesn't seem to work. I am trying: filterfreq * (filtermadsr*(-1)) but no sound.
...
Hm, I'm not too sure about the filters, but this would result in a
negative filter frequency and that might not work.
Try:
kinvadsr = 1 - kadsr
kfilterfreq * kinvadsr
This would result in a filter frequency between 0 and kfilterfreq. Most
likely, you'd be better off with something like:
kbasefilterfreq = minimum
kmaxamount = some_value
kfilterfreq = kbasefilterfreq + kmaxamount * kinvadsr
Because of the 1 - kmadsr you'll get the reverse shape of the adsr. You
could also multiply the adsr output by -1 and use the above version with
kbasefilterfreq ad kmaxamount, but then your filterfrequency would bo
from kbasefilterfreq - kmaxamount to kbasefilterfreq. That means you
should keep kmaxmount less than kbasefilterfreq.

If you'd want to set the modulation amount dynamically, you could use
limit or some other opcode to make sure that the actual filterfrequency
never goes below 0.

HTH, best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me 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-06-08 15:29
From"Jeanette C."
SubjectRe: [Csnd] Negative Envelope Contour
Jun 8 2019, brian@AMSYNTH.COM has written:

>
>
> I'm trying 1-madsr and getting some results, but sometimes notes
> don't sound. It's like something needs to "finish" before another note
> can sound. It's very irregular though.. sometimes it works for a bit,
> othertimes no.
Can you send example code?

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me <3
(Britney Spears)

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-06-08 15:30
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

Sure:

 

<CsoundSynthesizer>
<CsOptions>

-odac -+rtaudio=jack -Ma -dm0
</CsOptions>
<CsInstruments>

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

;panel
FLcolor    182, 182, 182, 247, 3, 1
FLpanel  "ZSynth-MVCLPF1",1010,550,300,100,4,-1,1
FLvkeybd    "keyboard.map",960,90,20,430
gkonoff,ihb2    FLbutton "On/Off",0,1,2,100,30,20,20,0,1,0,0
gk3,ihb4        FLbutton "Exit",1,0,21,100,30,20,70,0,2,0,0

;display for Flsliders-DetuneKnob
ihval1    FLvalue    "",65,30,520,20
ihval2    FLvalue "",65,30,520,70
ihval3    FLvalue "",65,30,520,120
ihval3b    FLvalue "",65,30,520,160
ihval4    FLvalue "",65,30,520,120+80
ihval5    FLvalue "",65,30,520,120+130
ihval6    FLvalue "",65,30,520,120+180
ihval7    FLvalue "",65,30,520,120+230
ihval8    FLvalue "",65,30,20,120+80
ihval9    FLvalue "",65,30,20,120+130
ihval10    FLvalue "",65,30,20,120+180
ihval11    FLvalue "",65,30,20,120+230
ihval12    FLvalue "",65,30,120,120
ihval13    FLvalue "",60,30,780,20


;kout,ihandle    Flslider  "",imin,imax,  iexp, itype,  idisp, iwidth, iheight,  ix, iy

gkfreq,gih1 FLslider    "Cutoff", 220, (sr)/2, 0, 25, ihval1, 355, 25, 143, 20
gkreso,gih2 FLslider    "Resonance", 0.001, 1, 0, 25, ihval2, 355, 25, 143, 70
gklfo,gih3 FLslider    "LFO-level", 0, 80, 0, 25, ihval3, 155, 25, 343, 120
gkrate,gih3b FLslider    "LFO-rate", 0, 8, 0, 25, ihval3b, 155, 25, 343, 160
gkBendRange,ihBendRange    FLcount  "Bend Range", -48, 48, 1, 1, 2, 100, 25, 210, 120, -1
gkdet,gihdet    FLknob "Detune", 0, 4.0, 0, 1, ihval12, 60, 40, 110

;adsr volume
gkatt,gih4    FLslider    "(Amp) Attack",0.001, 8, 0, 25, ihval8, 155, 30, 143, 200
gkdec,gih5    FLslider    "Decay",0, 8, 0, 25, ihval9, 155, 30, 143, 250
gksus,gih6    FLslider    "Sustain",0.001, 1, 0, 25, ihval10, 155, 30, 143, 300
gkrel,gih7    FLslider    "Release",0, 8, 0, 25, ihval11, 155, 30, 143, 350

;adsr moog filter
gkatt2,gih8    FLslider    "(Filter) Attack",0.001, 8, 0, 25, ihval4, 155, 30, 343, 200
gkdec2,gih9    FLslider    "Decay",0, 8, 0, 25, ihval5, 155, 30, 343, 250
gksus2,gih10    FLslider    "Sustain",0.001, 1, 0, 25, ihval6, 155, 30, 343, 300
gkrel2,gih11    FLslider    "Release",0, 8, 0, 25, ihval7, 155, 30, 343, 350
gkamp,gih13    FLslider    "Volume", 0, 0.5, 0, 25, ihval13, 155, 30, 600, 20

FLpanel_end
FLrun

;initial values
FLsetVal_i    8459,gih1    ;init Filter Cutoff value
FLsetVal_i    0.22,gih2    ;init Resonance
FLsetVal_i    1.1,gih3    ;init LFO level
FLsetVal_i    3.75,gih3b    ;init LFO rate
FLsetVal_i    2.01,gihdet    ;init Detune
FLsetVal_i    0.01580,gih4    ;init value attack(amp)
FLsetVal_i    4.0889,gih5    ;init value decay
FLsetVal_i    0.001,gih6    ;init value sustain
FLsetVal_i    0.448,gih7    ;init value release
FLsetVal_i    0.01580,gih8    ;init value attack(filt)
FLsetVal_i    1.4667,gih9    ;init value decay
FLsetVal_i    0.2526,gih10    ;init value sustain
FLsetVal_i    2.19,gih11    ;init value release
FLsetVal_i    2,ihBendRange    ;init Pitch Bend value
FLsetVal_i    0.14,gih13    ;init value Volume

instr 1

if gkonoff    =    1    then
turnoff
endif

iamp    ampmidi    .5
ifilt    ampmidi .2
ifreq    cpsmidi

;print    ifilt

kamp = iamp
kmax = 10
kmin = 0
imin = 0
imax = 1
ichan = 1
ictlno = 1

kdest    ctrl7    ichan, ictlno, kmin, kmax

k1    ctrl7    1,1,220,(sr)/2
ktrig    changed    k1
FLsetVal    ktrig,k1,gih1

k2    ctrl7    1,7,0,0.5
ktrig    changed    k2
FLsetVal    ktrig,k2,gih13


kbend    pchbend    imin,imax
kbend = kbend*gkBendRange
kbend = semitone(kbend)

klfo    lfo    gklfo,gkrate,1
klfo    +=  gklfo
avco1 vco2    (iamp*k2),(ifreq*kbend)+(klfo*(ifreq/127)),0
avco2 vco2    (iamp*k2),(ifreq*kbend*gkdet)+(klfo*(ifreq/127)),8
asum    sum    avco1,avco2
kadsrfilt    madsr    i(gkatt2),i(gkdec2),i(gksus2),i(gkrel2)
afilt    mvclpf1    asum,(gkfreq*(1-kadsrfilt))*ifilt,gkreso
kadsr        madsr    i(gkatt),i(gkdec),i(gksus),i(gkrel),0,1
outs    afilt*kadsr,afilt*kadsr

endin

instr 2
exitnow
endin


</CsInstruments>
<CsScore>

f1    0    16384    10    1    

f0    [3600*24]

</CsScore>
</CsoundSynthesizer>

 

 

 

 

 

On Sat, 8 Jun 2019 16:29:17 +0200, Jeanette C. wrote:

Jun 8 2019, brian@AMSYNTH.COMhas written:
I'm trying 1-madsr and getting some results, but sometimes notes don't sound. It's like something needs to "finish" before another note can sound. It's very irregular though.. sometimes it works for a bit, othertimes no.
Can you send example code?

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me 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-06-08 15:48
From"Jeanette C."
SubjectRe: [Csnd] Negative Envelope Contour
Jun 8 2019, brian@AMSYNTH.COM has written:
...
> afilt mvclpf1
> asum,(gkfreq*(1-kadsrfilt))*ifilt,gkreso
...
(gkfreq*(1-kadsrfilt))*ifilt
This still only multiplies the values and the moment kadsrfilt reaches
1, the product is 0. Best work with addition. Set either gkfreq or ifilt
as the basic filter frequency and then add the "modulation amount" *
(1-kadsrfilt) to that.

I'm sorry, I wouldn't be able to run your example, being blind and
having difficulties with the FLTK interface and I never bothered to read
the manual for the opcodes to create "fixed" instruments from that with
all values within reach of the UI.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me <3
(Britney Spears)

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-06-08 17:36
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

Jeanette, I think *I* was the one who couldn't see what the problem was! ;)

Your suggestion was right; using "1.001 - kadsrfilt" prevents reaching 0, and it appears that there is a nice range between 1.001 and 1.999. I added a slider to access this depth in realtime, and just to see the final product.  The filter frequency is hardwired to the Modulation Wheel, and adjusting that and resonance gives nice results.

Here below is the final code, with settings done in such a way that the filter release stage gives a nice "up" effect.

Thanks for your help Jeanette!

Brian

 

<CsoundSynthesizer>
<CsOptions>

-odac -+rtaudio=jack -Ma -dm0
</CsOptions>
<CsInstruments>

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

;panel
FLcolor    182, 182, 182, 255, 0, 0
FLpanel        "ZSynth-MVCLPF1",1010,550,300,100,4,-1,1
FLvkeybd    "keyboard.map",960,90,20,430
gkonoff,ihb2    FLbutton "On/Off",0,1,2,100,30,20,20,0,1,0,0
gk3,ihb4    FLbutton "Exit",1,0,21,100,30,20,70,0,2,0,0

;display for Flsliders-DetuneKnob
ihval1    FLvalue    "",65,30,520,20
ihval2    FLvalue "",65,30,520,70
ihval3    FLvalue "",65,30,520,120
ihval3b    FLvalue "",65,30,520,160
ihval4    FLvalue "",65,30,520,120+80
ihval5    FLvalue "",65,30,520,120+130
ihval6    FLvalue "",65,30,520,120+180
ihval7    FLvalue "",65,30,520,120+230
ihval8    FLvalue "",65,30,20,120+80
ihval9    FLvalue "",65,30,20,120+130
ihval10    FLvalue "",65,30,20,120+180
ihval11    FLvalue "",65,30,20,120+230
ihval12    FLvalue "",65,30,120,120
ihval13    FLvalue "",60,30,780,20
ihval14    FLvalue "",60,30,780,70


;kout,ihandle    Flslider  "",imin,imax,  iexp, itype,  idisp, iwidth, iheight,  ix, iy

gkfreq,gih1 FLslider    "Cutoff", 220, (sr)/2, 0, 25, ihval1, 355, 25, 143, 20
gkreso,gih2 FLslider    "Resonance", 0.001, 1, 0, 25, ihval2, 355, 25, 143, 70
gklfo,gih3 FLslider    "LFO-level", 0, 80, 0, 25, ihval3, 155, 25, 343, 120
gkrate,gih3b FLslider    "LFO-rate", 0, 8, 0, 25, ihval3b, 155, 25, 343, 160
gkBendRange,ihBendRange    FLcount  "Bend Range", -48, 48, 1, 1, 2, 100, 25, 210, 120, -1
gkdet,gihdet    FLknob "Detune", 0, 4.0, 0, 1, ihval12, 60, 40, 110

;adsr volume
gkatt,gih4    FLslider    "(Amp) Attack",0.001, 8, 0, 25, ihval8, 155, 30, 143, 200
gkdec,gih5    FLslider    "Decay",0, 8, 0, 25, ihval9, 155, 30, 143, 250
gksus,gih6    FLslider    "Sustain",0.001, 1, 0, 25, ihval10, 155, 30, 143, 300
gkrel,gih7    FLslider    "Release",0, 8, 0, 25, ihval11, 155, 30, 143, 350

;adsr moog filter
gkatt2,gih8    FLslider    "(Filter) Attack",0.001, 8, 0, 25, ihval4, 155, 30, 343, 200
gkdec2,gih9    FLslider    "Decay",0, 8, 0, 25, ihval5, 155, 30, 343, 250
gksus2,gih10    FLslider    "Sustain",0.001, 1, 0, 25, ihval6, 155, 30, 343, 300
gkrel2,gih11    FLslider    "Release",0, 8, 0, 25, ihval7, 155, 30, 343, 350
gkamp,gih13    FLslider    "Volume", 0, 0.5, 0, 25, ihval13, 155, 30, 600, 20
gkcont,gih14    FLslider    "Contour", 1.001, 1.999, 0, 25, ihval14, 155, 30, 600, 70

FLpanel_end
FLrun

;initial values
FLsetVal_i    9207.5,gih1    ;init Filter Cutoff value
FLsetVal_i    0.22,gih2    ;init Resonance
FLsetVal_i    1.1,gih3    ;init LFO level
FLsetVal_i    3.75,gih3b    ;init LFO rate
FLsetVal_i    2.01,gihdet    ;init Detune
FLsetVal_i    0.01580,gih4    ;init value attack(AMP)
FLsetVal_i    4.09,gih5    ;init value decay
FLsetVal_i    0.84,gih6    ;init value sustain
FLsetVal_i    0.72,gih7    ;init value release
FLsetVal_i    0.54,gih8    ;init value attack(FILTER)
FLsetVal_i    1.02,gih9    ;init value decay
FLsetVal_i    0.99,gih10    ;init value sustain
FLsetVal_i    0.36,gih11    ;init value release
FLsetVal_i    2,ihBendRange    ;init Pitch Bend value
FLsetVal_i    0.14,gih13    ;init value Volume
FLsetVal_i    1.4,gih14    ;init value Contour

instr 1

if gkonoff    =    1    then
turnoff
endif

iamp    ampmidi    .6
ifilt    ampmidi .8
ifreq    cpsmidi

;print    ifilt

kamp = iamp
kmax = 10
kmin = 0
imin = 0
imax = 1
ichan = 1
ictlno = 1

kdest    ctrl7    ichan, ictlno, kmin, kmax

k1    ctrl7    1,1,220,(sr)/2
ktrig    changed    k1
FLsetVal    ktrig,k1,gih1

k2    ctrl7    1,7,0,0.5
ktrig    changed    k2
FLsetVal    ktrig,k2,gih13


kbend    pchbend    imin,imax
kbend = kbend*gkBendRange
kbend = semitone(kbend)

klfo    lfo    gklfo,gkrate,1
klfo    +=  gklfo
avco1 vco2    (iamp*k2),(ifreq*kbend)+(klfo*(ifreq/127)),0
avco2 vco2    (iamp*k2),(ifreq*kbend*gkdet)+(klfo*(ifreq/127)),8
asum    sum    avco1,avco2
kadsrfilt    madsr    i(gkatt2),i(gkdec2),i(gksus2),i(gkrel2)
afilt    mvclpf1    asum,(gkfreq*(gkcont-kadsrfilt))*ifilt,gkreso  ;filtenv depth max=1.001
kadsr        madsr    i(gkatt),i(gkdec),i(gksus),i(gkrel),0,1
outs    afilt*kadsr,afilt*kadsr

endin

instr 2
exitnow
endin


</CsInstruments>
<CsScore>

f1    0    16384    10    1    

f0    [3600*24]

</CsScore>
</CsoundSynthesizer>

 

 

 

On Sat, 8 Jun 2019 16:48:40 +0200, Jeanette C. wrote:

Jun 8 2019, brian@AMSYNTH.COMhas written:
...
afilt mvclpf1 asum,(gkfreq*(1-kadsrfilt))*ifilt,gkreso
...
(gkfreq*(1-kadsrfilt))*ifilt
This still only multiplies the values and the moment kadsrfilt reaches
1, the product is 0. Best work with addition. Set either gkfreq or ifilt
as the basic filter frequency and then add the "modulation amount" *
(1-kadsrfilt) to that.

I'm sorry, I wouldn't be able to run your example, being blind and
having difficulties with the FLTK interface and I never bothered to read
the manual for the opcodes to create "fixed" instruments from that with
all values within reach of the UI.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

With you I get so high
Lost in the crystal sky
You are this melody
That's where you take me 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-06-08 18:05
From"Jeanette C."
SubjectRe: [Csnd] Negative Envelope Contour
Hey hey Brian,
I'm glad you got some working code for a live, performance oriented 
instrument. Enjoy tweaking your parameters. :)

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

I believe
We all have one true love
Somewhere in this world <3
(Britney Spears)

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-06-08 18:41
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] Negative Envelope Contour

A "gift"! :)  This is a brass/trumpet preset I just made, using contour (normal, not inverted). Tweak the cutoff to get it to taste.  Enjoy! :)

 

<CsoundSynthesizer>
<CsOptions>

-odac -+rtaudio=jack -Ma -dm0
</CsOptions>
<CsInstruments>

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

;panel
FLcolor    182, 182, 182, 255, 0, 0
FLpanel  "Brass-01",1010,550,300,100,4,-1,1
FLvkeybd    "keyboard.map",960,90,20,430
gkonoff,ihb2    FLbutton "On/Off",0,1,2,100,30,20,20,0,1,0,0
gk3,ihb4        FLbutton "Exit",1,0,21,100,30,20,70,0,2,0,0

;display for Flsliders-DetuneKnob
ihval1    FLvalue    "",65,30,520,20
ihval2    FLvalue "",65,30,520,70
ihval3    FLvalue "",65,30,520,120
ihval3b    FLvalue "",65,30,520,160
ihval4    FLvalue "",65,30,520,120+80
ihval5    FLvalue "",65,30,520,120+130
ihval6    FLvalue "",65,30,520,120+180
ihval7    FLvalue "",65,30,520,120+230
ihval8    FLvalue "",65,30,20,120+80
ihval9    FLvalue "",65,30,20,120+130
ihval10    FLvalue "",65,30,20,120+180
ihval11    FLvalue "",65,30,20,120+230
ihval12    FLvalue "",65,30,120,120
ihval13    FLvalue "",60,30,780,20
ihval14    FLvalue "",60,30,780,70


;kout,ihandle    Flslider  "",imin,imax,  iexp, itype,  idisp, iwidth, iheight,  ix, iy

gkfreq,gih1 FLslider    "Cutoff", 220, (sr)/2, 0, 25, ihval1, 355, 25, 143, 20
gkreso,gih2 FLslider    "Resonance", 0.001, 1, 0, 25, ihval2, 355, 25, 143, 70
gklfo,gih3 FLslider    "LFO-level", 0, 80, 0, 25, ihval3, 155, 25, 343, 120
gkrate,gih3b FLslider    "LFO-rate", 0, 20, 0, 25, ihval3b, 155, 25, 343, 160
gkBendRange,ihBendRange    FLcount  "Bend Range", -48, 48, 1, 1, 2, 100, 25, 210, 120, -1
gkdet,gihdet    FLknob "Detune", 0, 4.0, 0, 1, ihval12, 60, 40, 110

;adsr volume
gkatt,gih4    FLslider    "(Amp) Attack",0.001, 8, 0, 25, ihval8, 155, 30, 143, 200
gkdec,gih5    FLslider    "Decay",0, 8, 0, 25, ihval9, 155, 30, 143, 250
gksus,gih6    FLslider    "Sustain",0.001, 1, 0, 25, ihval10, 155, 30, 143, 300
gkrel,gih7    FLslider    "Release",0, 8, 0, 25, ihval11, 155, 30, 143, 350

;adsr moog filter
gkatt2,gih8    FLslider    "(Filter) Attack",0.001, 8, 0, 25, ihval4, 155, 30, 343, 200
gkdec2,gih9    FLslider    "Decay",0, 8, 0, 25, ihval5, 155, 30, 343, 250
gksus2,gih10    FLslider    "Sustain",0.001, 1, 0, 25, ihval6, 155, 30, 343, 300
gkrel2,gih11    FLslider    "Release",0, 8, 0, 25, ihval7, 155, 30, 343, 350
gkamp,gih13    FLslider    "Volume", 0, 0.5, 0, 25, ihval13, 155, 30, 600, 20
gkcont,gih14    FLslider    "Contour", 0.001, 0.999, 0, 25, ihval14, 155, 30, 600, 70

FLpanel_end
FLrun

;initial values
FLsetVal_i    14263,gih1    ;init Filter Cutoff value
FLsetVal_i    0.22,gih2    ;init Resonance
FLsetVal_i    1.1,gih3    ;init LFO level
FLsetVal_i    5.75,gih3b    ;init LFO rate
FLsetVal_i    0.999,gihdet    ;init Detune
FLsetVal_i    0.001,gih4    ;init value attack(AMP)
FLsetVal_i    4.0889,gih5    ;init value decay
FLsetVal_i    0.001,gih6    ;init value sustain
FLsetVal_i    0,gih7        ;init value release
FLsetVal_i    0.06114,gih8    ;init value attack(FILT)
FLsetVal_i    1.4667,gih9    ;init value decay
FLsetVal_i    0.2526,gih10    ;init value sustain
FLsetVal_i    2.19,gih11    ;init value release
FLsetVal_i    2,ihBendRange    ;init Pitch Bend value
FLsetVal_i    0.14,gih13    ;init value Volume
FLsetVal_i    0.001,gih14    ;init value Contour

instr 1

if gkonoff    =    1    then
turnoff
endif

iamp    ampmidi    .6
ifilt    ampmidi .8
ifreq    cpsmidi

;print    ifilt

kamp = iamp
kmax = 10
kmin = 0
imin = 0
imax = 1
ichan = 1
ictlno = 1

kdest    ctrl7    ichan, ictlno, kmin, kmax

k1    ctrl7    1,1,220,(sr)/2
ktrig    changed    k1
FLsetVal    ktrig,k1,gih1

k2    ctrl7    1,7,0,0.5
ktrig    changed    k2
FLsetVal    ktrig,k2,gih13


kbend    pchbend    imin,imax
kbend = kbend*gkBendRange
kbend = semitone(kbend)

klfo    lfo    gklfo,gkrate,1
klfo    +=  gklfo
avco1 vco2    (iamp*k2),(ifreq*kbend)+(klfo*(ifreq/127)),0
avco2 vco2    (iamp*k2),(ifreq*kbend*gkdet)+(klfo*(ifreq/127)),8
asum    sum    avco1,avco2
kadsrfilt    madsr    i(gkatt2),i(gkdec2),i(gksus2),i(gkrel2),0,1
afilt    mvclpf1    asum,(gkfreq*(gkcont+kadsrfilt))*ifilt,gkreso
kadsr        madsr    i(gkatt),i(gkdec),i(gksus),i(gkrel),0,1
outs    afilt*kadsr,afilt*kadsr

endin

instr 2
exitnow
endin


</CsInstruments>
<CsScore>

f1    0    16384    10    1    

f0    [3600*24]

</CsScore>
</CsoundSynthesizer>

 

 

 

On Sat, 8 Jun 2019 19:05:11 +0200, Jeanette C. wrote:

Hey hey Brian,
I'm glad you got some working code for a live, performance oriented 
instrument. Enjoy tweaking your parameters. :)

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

I believe
We all have one true love
Somewhere in this world 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