Csound Csound-dev Csound-tekno Search About

ihold and graceful turnoff of fractional instruments

Date2017-03-27 14:22
FromForrest Curo
Subjectihold and graceful turnoff of fractional instruments
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego


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

Date2017-03-27 15:24
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego



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

Date2017-03-27 16:44
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Or: Is it better to just use negative p3 throughout,

no ihold in the first place,
turnoff when envelope -->0 ?

On Mon, Mar 27, 2017 at 7:24 AM, Forrest Curo <treegestalt@gmail.com> wrote:
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego




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

Date2017-03-29 07:26
FromOeyvind Brandtsegg
SubjectRe: ihold and graceful turnoff of fractional instruments
If you use negative p3, 
and then turn off when a note off is received, 
and use a release stage envelope,
(you probably do all of the above already?),
*and* make the envelope start from the value it previously left off at (see below),
then you should get smooth transition between notes.

The one thing you won't get is overlapping instances if it is retriggered before it has completed the release.
But the new instance will pick up smoothly and take over from the releasing segment.

If you really want overlapping instances upon re-trig, you will need to use a counter in addition to the note number to find your fractional instr numbers. 
For example: instr num 2, note number 69, would in your care be p1= 2.069 (right?),
then you could use an additional counter looping from 0 to 9,
so the first time the instr is triggered you have p1 = 2.0690, the second time it will be 2.0691, then 2.0692 etc.
It will be a bit of a pain to ensure you turn off the correct instance at all times, as far as I remember, having done this some time in the past (don't have the details in front of me any longer, sorry)

In the simpler case, if you are content with making a smooth take-over when the note is re-triggered, you can write the current value if the envelope to a chn channel, and then read this value at init, starting the envelope from that value.
(code untested, just writing off the top of my head, beware of typos)

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

Instead of the simple name "amp" you would need to use a channel name indicating the instance (fractional instr num).
Something like:
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname

Oeyvind


2017-03-27 8:44 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Or: Is it better to just use negative p3 throughout,

no ihold in the first place,
turnoff when envelope -->0 ?

On Mon, Mar 27, 2017 at 7:24 AM, Forrest Curo <treegestalt@gmail.com> wrote:
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego




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

Date2017-03-29 13:41
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Thanks!

I maybe shouldn't have waited for an answer,but yours covers it quite thoroughly.
(I'd been temporarily overwhelmed with this poem busting loose, internet fuss&bother, emotional overwhelm.)

Forrest

On Tue, Mar 28, 2017 at 11:26 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
If you use negative p3, 
and then turn off when a note off is received, 
and use a release stage envelope,
(you probably do all of the above already?),
*and* make the envelope start from the value it previously left off at (see below),
then you should get smooth transition between notes.

The one thing you won't get is overlapping instances if it is retriggered before it has completed the release.
But the new instance will pick up smoothly and take over from the releasing segment.

If you really want overlapping instances upon re-trig, you will need to use a counter in addition to the note number to find your fractional instr numbers. 
For example: instr num 2, note number 69, would in your care be p1= 2.069 (right?),
then you could use an additional counter looping from 0 to 9,
so the first time the instr is triggered you have p1 = 2.0690, the second time it will be 2.0691, then 2.0692 etc.
It will be a bit of a pain to ensure you turn off the correct instance at all times, as far as I remember, having done this some time in the past (don't have the details in front of me any longer, sorry)

In the simpler case, if you are content with making a smooth take-over when the note is re-triggered, you can write the current value if the envelope to a chn channel, and then read this value at init, starting the envelope from that value.
(code untested, just writing off the top of my head, beware of typos)

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

Instead of the simple name "amp" you would need to use a channel name indicating the instance (fractional instr num).
Something like:
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname

Oeyvind


2017-03-27 8:44 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Or: Is it better to just use negative p3 throughout,

no ihold in the first place,
turnoff when envelope -->0 ?

On Mon, Mar 27, 2017 at 7:24 AM, Forrest Curo <treegestalt@gmail.com> wrote:
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego




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

Date2017-03-29 22:18
FromAndrea Strappa
SubjectRe: ihold and graceful turnoff of fractional instruments

This is a question to be explored for me, not trivial.

For now, testing EXAMPLE 07B01_MidiInstrTrigger.csd of floss manual, I discovered today that for good performance it is needed this McCurdy indication (in 3_monoSynth.csd):

    instr 128

;*** dummy instr to catch the annoyning default midi routing
;*** if this is not here, instr 130 gets turned on and off by the keyboard
;*** Once Istvan's new massign 0,0 fix is in CsoundAV we can get rid of this, yay!

    endin

Best

A.S.


Il 29/03/2017 14:41, Forrest Curo ha scritto:
Thanks!

I maybe shouldn't have waited for an answer,but yours covers it quite thoroughly.
(I'd been temporarily overwhelmed with this poem busting loose, internet fuss&bother, emotional overwhelm.)

Forrest

On Tue, Mar 28, 2017 at 11:26 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
If you use negative p3, 
and then turn off when a note off is received, 
and use a release stage envelope,
(you probably do all of the above already?),
*and* make the envelope start from the value it previously left off at (see below),
then you should get smooth transition between notes.

The one thing you won't get is overlapping instances if it is retriggered before it has completed the release.
But the new instance will pick up smoothly and take over from the releasing segment.

If you really want overlapping instances upon re-trig, you will need to use a counter in addition to the note number to find your fractional instr numbers. 
For example: instr num 2, note number 69, would in your care be p1= 2.069 (right?),
then you could use an additional counter looping from 0 to 9,
so the first time the instr is triggered you have p1 = 2.0690, the second time it will be 2.0691, then 2.0692 etc.
It will be a bit of a pain to ensure you turn off the correct instance at all times, as far as I remember, having done this some time in the past (don't have the details in front of me any longer, sorry)

In the simpler case, if you are content with making a smooth take-over when the note is re-triggered, you can write the current value if the envelope to a chn channel, and then read this value at init, starting the envelope from that value.
(code untested, just writing off the top of my head, beware of typos)

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

Instead of the simple name "amp" you would need to use a channel name indicating the instance (fractional instr num).
Something like:
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname

Oeyvind


2017-03-27 8:44 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Or: Is it better to just use negative p3 throughout,

no ihold in the first place,
turnoff when envelope -->0 ?

On Mon, Mar 27, 2017 at 7:24 AM, Forrest Curo <treegestalt@gmail.com> wrote:
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego




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


Date2017-03-31 23:30
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Like this (_no_ iholds)?
-------------

tigoto secondtime
kmp init 0
; here initialize any other variables needed for first note

secondtime:
initmp = kmp
if (p4 == 0) kgoto endit
kmp linseg initmp, .05, 1
kgoto makenoise

endit:
kmp linseq initmp, .01, 0

makenoise:
; [here put whatever code produces the note sans envelope]
; [aoutl, aoutr being its audio outputs]

if (kmp != 0) kgoto outmit;
turnoff
outmit:
outs kmp*aoutl, kmp*aoutr

Forrest Curo
San Diego

On Wed, Mar 29, 2017 at 2:18 PM, Andrea Strappa <a_strappa@tin.it> wrote:

This is a question to be explored for me, not trivial.

For now, testing EXAMPLE 07B01_MidiInstrTrigger.csd of floss manual, I discovered today that for good performance it is needed this McCurdy indication (in 3_monoSynth.csd):

    instr 128

;*** dummy instr to catch the annoyning default midi routing
;*** if this is not here, instr 130 gets turned on and off by the keyboard
;*** Once Istvan's new massign 0,0 fix is in CsoundAV we can get rid of this, yay!

    endin

Best

A.S.


Il 29/03/2017 14:41, Forrest Curo ha scritto:
Thanks!

I maybe shouldn't have waited for an answer,but yours covers it quite thoroughly.
(I'd been temporarily overwhelmed with this poem busting loose, internet fuss&bother, emotional overwhelm.)

Forrest

On Tue, Mar 28, 2017 at 11:26 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
If you use negative p3, 
and then turn off when a note off is received, 
and use a release stage envelope,
(you probably do all of the above already?),
*and* make the envelope start from the value it previously left off at (see below),
then you should get smooth transition between notes.

The one thing you won't get is overlapping instances if it is retriggered before it has completed the release.
But the new instance will pick up smoothly and take over from the releasing segment.

If you really want overlapping instances upon re-trig, you will need to use a counter in addition to the note number to find your fractional instr numbers. 
For example: instr num 2, note number 69, would in your care be p1= 2.069 (right?),
then you could use an additional counter looping from 0 to 9,
so the first time the instr is triggered you have p1 = 2.0690, the second time it will be 2.0691, then 2.0692 etc.
It will be a bit of a pain to ensure you turn off the correct instance at all times, as far as I remember, having done this some time in the past (don't have the details in front of me any longer, sorry)

In the simpler case, if you are content with making a smooth take-over when the note is re-triggered, you can write the current value if the envelope to a chn channel, and then read this value at init, starting the envelope from that value.
(code untested, just writing off the top of my head, beware of typos)

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

Instead of the simple name "amp" you would need to use a channel name indicating the instance (fractional instr num).
Something like:
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname

Oeyvind


2017-03-27 8:44 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Or: Is it better to just use negative p3 throughout,

no ihold in the first place,
turnoff when envelope -->0 ?

On Mon, Mar 27, 2017 at 7:24 AM, Forrest Curo <treegestalt@gmail.com> wrote:
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego




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

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

Date2017-03-31 23:41
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Ow! Is linseg's first output its starting value? -- or does it begin with the next point along the line?

(If kmp starts at zero, this thing will always begin by shutting itself off.)

On Fri, Mar 31, 2017 at 3:30 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Like this (_no_ iholds)?
-------------

tigoto secondtime
kmp init 0
; here initialize any other variables needed for first note

secondtime:
initmp = kmp
if (p4 == 0) kgoto endit
kmp linseg initmp, .05, 1
kgoto makenoise

endit:
kmp linseq initmp, .01, 0

makenoise:
; [here put whatever code produces the note sans envelope]
; [aoutl, aoutr being its audio outputs]

if (kmp != 0) kgoto outmit;
turnoff
outmit:
outs kmp*aoutl, kmp*aoutr

Forrest Curo
San Diego

On Wed, Mar 29, 2017 at 2:18 PM, Andrea Strappa <a_strappa@tin.it> wrote:

This is a question to be explored for me, not trivial.

For now, testing EXAMPLE 07B01_MidiInstrTrigger.csd of floss manual, I discovered today that for good performance it is needed this McCurdy indication (in 3_monoSynth.csd):

    instr 128

;*** dummy instr to catch the annoyning default midi routing
;*** if this is not here, instr 130 gets turned on and off by the keyboard
;*** Once Istvan's new massign 0,0 fix is in CsoundAV we can get rid of this, yay!

    endin

Best

A.S.


Il 29/03/2017 14:41, Forrest Curo ha scritto:
Thanks!

I maybe shouldn't have waited for an answer,but yours covers it quite thoroughly.
(I'd been temporarily overwhelmed with this poem busting loose, internet fuss&bother, emotional overwhelm.)

Forrest

On Tue, Mar 28, 2017 at 11:26 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
If you use negative p3, 
and then turn off when a note off is received, 
and use a release stage envelope,
(you probably do all of the above already?),
*and* make the envelope start from the value it previously left off at (see below),
then you should get smooth transition between notes.

The one thing you won't get is overlapping instances if it is retriggered before it has completed the release.
But the new instance will pick up smoothly and take over from the releasing segment.

If you really want overlapping instances upon re-trig, you will need to use a counter in addition to the note number to find your fractional instr numbers. 
For example: instr num 2, note number 69, would in your care be p1= 2.069 (right?),
then you could use an additional counter looping from 0 to 9,
so the first time the instr is triggered you have p1 = 2.0690, the second time it will be 2.0691, then 2.0692 etc.
It will be a bit of a pain to ensure you turn off the correct instance at all times, as far as I remember, having done this some time in the past (don't have the details in front of me any longer, sorry)

In the simpler case, if you are content with making a smooth take-over when the note is re-triggered, you can write the current value if the envelope to a chn channel, and then read this value at init, starting the envelope from that value.
(code untested, just writing off the top of my head, beware of typos)

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

Instead of the simple name "amp" you would need to use a channel name indicating the instance (fractional instr num).
Something like:
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname

Oeyvind


2017-03-27 8:44 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Or: Is it better to just use negative p3 throughout,

no ihold in the first place,
turnoff when envelope -->0 ?

On Mon, Mar 27, 2017 at 7:24 AM, Forrest Curo <treegestalt@gmail.com> wrote:
Better question:

How do tigoto and tival apply to notes sustained by ihold?

On Mon, Mar 27, 2017 at 6:22 AM, Forrest Curo <treegestalt@gmail.com> wrote:
I'm using fractional instrument numbers, and ihold for instances triggered by different midi-keyboard notes

I want to gently ramp each instance down as its key is released -- turnoff at zero amplitude.

no problem unless I hit that same key before the note has quite reached bottom.

And then? -- The new note replaces the one that's been decaying?

Can I let the two instances briefly co-exist?

Forrest Curo
San Diego




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

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

Date2017-04-01 13:06
FromAndrea Strappa
SubjectRe: ihold and graceful turnoff of fractional instruments
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
> initmp = kmp

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

Date2017-04-01 14:02
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

Date2017-04-01 19:58
FromOeyvind Brandtsegg
SubjectRe: ihold and graceful turnoff of fractional instruments
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

Date2017-04-01 21:05
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

Date2017-04-01 21:48
FromOeyvind Brandtsegg
SubjectRe: ihold and graceful turnoff of fractional instruments
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

Date2017-04-01 23:38
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

Date2017-04-02 12:44
FromAndrea Strappa
SubjectRe: ihold and graceful turnoff of fractional instruments

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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


Date2017-04-02 22:59
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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

Date2017-04-03 05:49
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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

Date2017-04-03 20:49
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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

Date2017-04-03 21:51
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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

Date2017-04-03 22:14
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Fixed: (This triggers the release segment of the envelope from Oeyvind's envelope example, even though the sound-generating opcode it's applied to doesn't know anything's changed.):

kvel = p4
if(kvel != 0) goto leaveon
turnoff2 p1, 5, 1
leaveon:

On Mon, Apr 3, 2017 at 1:51 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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

Date2017-04-03 22:32
FromAndrea Strappa
SubjectRe: ihold and graceful turnoff of fractional instruments
Attachmentsrelease_with_sustain_03.csd  

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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


Date2017-04-04 00:07
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Andrea, I've been getting the csd I had to work, not yet up to making one someone else could use. [Sorry! I'm not that good at this! Will try.]

An instrument with volume controlled by Oeyvind's envelope should do it if you add a reasonable oscillator. (Mine was unreasonable. Let's see, hope this works):
----------------
Starting with someone else's example... from Floss manual [then adding another instrument to use that]:

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
midinoteonkey ikey, ivelocity
; we need velocity to detect note-offs
; and the key to call fractional numbered instrument
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
event "i", instrum, 0, -ivelocity, ikey, iCps, iAmp

turnoff
endin
instr 2
iCps = p5 ; (was set by instrument 1 from midi note)
iAmp = p6

;NOW OEYVIND's CODE FOR ENVELOPE
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linesegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)


;back to original example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
outs aOut, aOut ;write it to the output endin

</CsInstruments> <CsScore> </CsScore> </CsoundSynthesizer>
------------
?
I have not yet tested this...



On Mon, Apr 3, 2017 at 2:32 PM, Andrea Strappa <a_strappa@tin.it> wrote:

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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

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

Date2017-04-04 00:14
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
linsegr -- NOT "linesegr"

On Mon, Apr 3, 2017 at 4:07 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Andrea, I've been getting the csd I had to work, not yet up to making one someone else could use. [Sorry! I'm not that good at this! Will try.]

An instrument with volume controlled by Oeyvind's envelope should do it if you add a reasonable oscillator. (Mine was unreasonable. Let's see, hope this works):
----------------
Starting with someone else's example... from Floss manual [then adding another instrument to use that]:

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
midinoteonkey ikey, ivelocity
; we need velocity to detect note-offs
; and the key to call fractional numbered instrument
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
event "i", instrum, 0, -ivelocity, ikey, iCps, iAmp

turnoff
endin
instr 2
iCps = p5 ; (was set by instrument 1 from midi note)
iAmp = p6

;NOW OEYVIND's CODE FOR ENVELOPE
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linesegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)


;back to original example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
outs aOut, aOut ;write it to the output endin

</CsInstruments> <CsScore> </CsScore> </CsoundSynthesizer>
------------
?
I have not yet tested this...



On Mon, Apr 3, 2017 at 2:32 PM, Andrea Strappa <a_strappa@tin.it> wrote:

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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


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

Date2017-04-04 01:09
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
That will NOT work, even when debugged -- if your keyboard sends a real "note off" message instead of the old "note on with velocity zero" equivalent.

What I kludged to deal with that -- should work (and does, in a limited way) but I'm losing notes with this.

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;from Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
kplay init 1
ikey =0
ivelocity = 0
midinoteonkey ikey, ivelocity
; we need velocity to detect note-offs

; and the key to call fractional numbered instrument

iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
if (kplay == 0) kgoto playednote
event "i", instrum, 0, -1, ivelocity, ikey, iCps, iAmp
printf "velocity is %i \n", 1, ivelocity
kplay =0
playednote:
krel release
  if (krel != 1) kgoto keepon ;if in release-stage stay in release section
event "i", instrum, 0, -1, 0, ikey, iCps, iAmp
turnoff
keepon:
endin

instr 2
iCps = p6; (was set by instrument 1 from midi note)
iAmp = p7

;NOW OEYVIND's CODE FOR ENVELOPE

i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)

bypass:
kvel = p4
if(kvel != 0) goto leaveon
turnoff2 p1, 5, 1
kvel =1
leaveon:

;back to original example except using the envelope

aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin



</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

On Mon, Apr 3, 2017 at 4:14 PM, Forrest Curo <treegestalt@gmail.com> wrote:
linsegr -- NOT "linesegr"

On Mon, Apr 3, 2017 at 4:07 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Andrea, I've been getting the csd I had to work, not yet up to making one someone else could use. [Sorry! I'm not that good at this! Will try.]

An instrument with volume controlled by Oeyvind's envelope should do it if you add a reasonable oscillator. (Mine was unreasonable. Let's see, hope this works):
----------------
Starting with someone else's example... from Floss manual [then adding another instrument to use that]:

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
midinoteonkey ikey, ivelocity
; we need velocity to detect note-offs
; and the key to call fractional numbered instrument
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
event "i", instrum, 0, -ivelocity, ikey, iCps, iAmp

turnoff
endin
instr 2
iCps = p5 ; (was set by instrument 1 from midi note)
iAmp = p6

;NOW OEYVIND's CODE FOR ENVELOPE
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linesegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)


;back to original example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
outs aOut, aOut ;write it to the output endin

</CsInstruments> <CsScore> </CsScore> </CsoundSynthesizer>
------------
?
I have not yet tested this...



On Mon, Apr 3, 2017 at 2:32 PM, Andrea Strappa <a_strappa@tin.it> wrote:

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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



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

Date2017-04-04 08:41
FromAndrea Strappa
SubjectRe: ihold and graceful turnoff of fractional instruments

I'll test it in the next few days. Soon, I hope. I have some task now.

A. S.


Il 04/04/2017 01:14, Forrest Curo ha scritto:
linsegr -- NOT "linesegr"

On Mon, Apr 3, 2017 at 4:07 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Andrea, I've been getting the csd I had to work, not yet up to making one someone else could use. [Sorry! I'm not that good at this! Will try.]

An instrument with volume controlled by Oeyvind's envelope should do it if you add a reasonable oscillator. (Mine was unreasonable. Let's see, hope this works):
----------------
Starting with someone else's example... from Floss manual [then adding another instrument to use that]:

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
midinoteonkey ikey, ivelocity 
; we need velocity to detect note-offs
; and the key to call fractional numbered instrument
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
event "i", instrum, 0, -ivelocity, ikey, iCps, iAmp

turnoff
endin
instr 2
iCps = p5 ; (was set by instrument 1 from midi note)
iAmp = p6

;NOW OEYVIND's CODE FOR ENVELOPE
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linesegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)


;back to original example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin



</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
------------
?
I have not yet tested this...



On Mon, Apr 3, 2017 at 2:32 PM, Andrea Strappa <a_strappa@tin.it> wrote:

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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


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


Date2017-04-04 08:50
FromAndrea Strappa
SubjectRe: ihold and graceful turnoff of fractional instruments

I remember that in McCurdy arpeggiator.csd there's a device for this. Here:


instr    ScanMIDI
    insno     nstrnum "NoteLayer"
    kstatus, kchan, kdata1, kdata2  midiin; read in midi
    if kstatus==144 then
     if kdata2>0 then                    ;IF VELOCITY IS GREATER THAN 0 (I.E. FOR SOME KEYBOARDS VELOCITY ZERO IS A NOTE OFF)
      kAlreadyActiveStatus    table    kdata1,ginoteactive    ;CHECK IF THIS NOTE IS ALREADY ACTIVE (POSSIBLE IF HOLD IS ON).
      if kAlreadyActiveStatus==0 then            ;IF THIS NOTE IS NOT ALREADY ACTIVE...
       event "i",insno+(kdata1*0.001),0,3600,kdata1    ;
      endif
     else
      if gkhold==0 then
       turnoff2    1+(kdata1*0.001),4,1
      endif
     endif
    elseif kstatus==128&&gkhold==0 then        ;IF MIDI KEYBOARD USES NOTE OFF STATUS BYTE
     turnoff2    1+(kdata1*0.001),4,1
    endif
   
endin

You can try it. I can't today. Perhaps someone of csound gurus will help us...

A. S.




Il 04/04/2017 02:09, Forrest Curo ha scritto:
That will NOT work, even when debugged -- if your keyboard sends a real "note off" message instead of the old "note on with velocity zero" equivalent.

What I kludged to deal with that -- should work (and does, in a limited way) but I'm losing notes with this.

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;from Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
kplay init 1
ikey =0
ivelocity = 0
midinoteonkey ikey, ivelocity
; we need velocity to detect note-offs

; and the key to call fractional numbered instrument

iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
if (kplay == 0) kgoto playednote
event "i", instrum, 0, -1, ivelocity, ikey, iCps, iAmp
printf "velocity is %i \n", 1, ivelocity
kplay =0
playednote:
krel release
  if (krel != 1) kgoto keepon ;if in release-stage stay in release section
event "i", instrum, 0, -1, 0, ikey, iCps, iAmp
turnoff
keepon:
endin

instr 2
iCps = p6; (was set by instrument 1 from midi note)
iAmp = p7

;NOW OEYVIND's CODE FOR ENVELOPE

i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)

bypass:
kvel = p4
if(kvel != 0) goto leaveon
turnoff2 p1, 5, 1
kvel =1
leaveon:

;back to original example except using the envelope

aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin



</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

On Mon, Apr 3, 2017 at 4:14 PM, Forrest Curo <treegestalt@gmail.com> wrote:
linsegr -- NOT "linesegr"

On Mon, Apr 3, 2017 at 4:07 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Andrea, I've been getting the csd I had to work, not yet up to making one someone else could use. [Sorry! I'm not that good at this! Will try.]

An instrument with volume controlled by Oeyvind's envelope should do it if you add a reasonable oscillator. (Mine was unreasonable. Let's see, hope this works):
----------------
Starting with someone else's example... from Floss manual [then adding another instrument to use that]:

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
midinoteonkey ikey, ivelocity 
; we need velocity to detect note-offs
; and the key to call fractional numbered instrument
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
event "i", instrum, 0, -ivelocity, ikey, iCps, iAmp

turnoff
endin
instr 2
iCps = p5 ; (was set by instrument 1 from midi note)
iAmp = p6

;NOW OEYVIND's CODE FOR ENVELOPE
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linesegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)


;back to original example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin



</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
------------
?
I have not yet tested this...



On Mon, Apr 3, 2017 at 2:32 PM, Andrea Strappa <a_strappa@tin.it> wrote:

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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



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


Date2017-04-04 14:17
FromForrest Curo
SubjectRe: ihold and graceful turnoff of fractional instruments
Oeyvind took a look and fixed it "(but it is late, so I might be wrong)"

and now I've fixed what he'd missed while tired
and the result now works correctly!
-------------
<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;from Example by Andrés Cabrera

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

massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
ikey =0
ivelocity = 0
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

; we'll need this to call fractional numbered instrument
midinoteonkey ikey, ivelocity
instrum = (2000 + ikey)/1000

event_i "i", instrum, 0, -1, iAmp , iCps
xtratim 1/kr
krelease release
if krelease > 0 then
event "i", -instrum, 0, 0.1, iAmp , iCps
endif
endin

instr 2
iAmp = p4; (was set by instrument 1 from midi note)
iCps = p5

;NOW OEYVIND's CODE FOR ENVELOPE

i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)

;back to original midi example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

On Tue, Apr 4, 2017 at 12:50 AM, Andrea Strappa <a_strappa@tin.it> wrote:

I remember that in McCurdy arpeggiator.csd there's a device for this. Here:


instr    ScanMIDI
    insno     nstrnum "NoteLayer"
    kstatus, kchan, kdata1, kdata2  midiin; read in midi
    if kstatus==144 then
     if kdata2>0 then                    ;IF VELOCITY IS GREATER THAN 0 (I.E. FOR SOME KEYBOARDS VELOCITY ZERO IS A NOTE OFF)
      kAlreadyActiveStatus    table    kdata1,ginoteactive    ;CHECK IF THIS NOTE IS ALREADY ACTIVE (POSSIBLE IF HOLD IS ON).
      if kAlreadyActiveStatus==0 then            ;IF THIS NOTE IS NOT ALREADY ACTIVE...
       event "i",insno+(kdata1*0.001),0,3600,kdata1    ;
      endif
     else
      if gkhold==0 then
       turnoff2    1+(kdata1*0.001),4,1
      endif
     endif
    elseif kstatus==128&&gkhold==0 then        ;IF MIDI KEYBOARD USES NOTE OFF STATUS BYTE
     turnoff2    1+(kdata1*0.001),4,1
    endif
   
endin

You can try it. I can't today. Perhaps someone of csound gurus will help us...

A. S.




Il 04/04/2017 02:09, Forrest Curo ha scritto:
That will NOT work, even when debugged -- if your keyboard sends a real "note off" message instead of the old "note on with velocity zero" equivalent.

What I kludged to deal with that -- should work (and does, in a limited way) but I'm losing notes with this.

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;from Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
kplay init 1
ikey =0
ivelocity = 0
midinoteonkey ikey, ivelocity
; we need velocity to detect note-offs

; and the key to call fractional numbered instrument

iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
if (kplay == 0) kgoto playednote
event "i", instrum, 0, -1, ivelocity, ikey, iCps, iAmp
printf "velocity is %i \n", 1, ivelocity
kplay =0
playednote:
krel release
  if (krel != 1) kgoto keepon ;if in release-stage stay in release section
event "i", instrum, 0, -1, 0, ikey, iCps, iAmp
turnoff
keepon:
endin

instr 2
iCps = p6; (was set by instrument 1 from midi note)
iAmp = p7

;NOW OEYVIND's CODE FOR ENVELOPE

i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)

bypass:
kvel = p4
if(kvel != 0) goto leaveon
turnoff2 p1, 5, 1
kvel =1
leaveon:

;back to original example except using the envelope

aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin



</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

On Mon, Apr 3, 2017 at 4:14 PM, Forrest Curo <treegestalt@gmail.com> wrote:
linsegr -- NOT "linesegr"

On Mon, Apr 3, 2017 at 4:07 PM, Forrest Curo <treegestalt@gmail.com> wrote:
Andrea, I've been getting the csd I had to work, not yet up to making one someone else could use. [Sorry! I'm not that good at this! Will try.]

An instrument with volume controlled by Oeyvind's envelope should do it if you add a reasonable oscillator. (Mine was unreasonable. Let's see, hope this works):
----------------
Starting with someone else's example... from Floss manual [then adding another instrument to use that]:

<CsoundSynthesizer>
<CsOptions>
-+rtmidi=portmidi -Ma -odac
</CsOptions>
<CsInstruments>
;Example by Andrés Cabrera

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

        massign   0, 1 ;assign all MIDI channels to instrument 1

instr 1
;NOW I'M ADDING A TIED NOTE INSTRUMENT:
midinoteonkey ikey, ivelocity 
; we need velocity to detect note-offs
; and the key to call fractional numbered instrument
iCps    cpsmidi   ;get the frequency from the key pressed
iAmp    ampmidi   0dbfs * 0.3 ;get the amplitude

instrum = (2000 + ikey)/1000
event "i", instrum, 0, -ivelocity, ikey, iCps, iAmp

turnoff
endin
instr 2
iCps = p5 ; (was set by instrument 1 from midi note)
iAmp = p6

;NOW OEYVIND's CODE FOR ENVELOPE
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp_%i", i_nstance
istart chnget Sname ; (is 0 until chnset inserts a value)
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linesegr istart, iattacktime, 1.0, idectime, isustainlevel,   ireleasetime, 0
chnset kenv, "amp"; (send new value back for next note of same number)


;back to original example except using the envelope
aOut    poscil    iAmp, iCps ;generate a sine tone
aOut = aOut* kenv
        outs      aOut, aOut ;write it to the output
endin



</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
------------
?
I have not yet tested this...



On Mon, Apr 3, 2017 at 2:32 PM, Andrea Strappa <a_strappa@tin.it> wrote:

I send my solution to avoid click on repercussion same note with sustain pedal, adapting Victor Lazzarini and Joachim Heintz example (thank you!).

At last it appears the message: "WARNING: MIDI note overlaps with key ... on same channel" (I hope it is not serious).

About your example, Forrest, I not addressed yet to API connections.

Or you adapt it to a canonical  csound front end, or you send me same instruction for api connection, because i'm willing to study it.

A. S.



Il 03/04/2017 22:51, Forrest Curo ha scritto:
Yes, I eliminate the click -- but also the noteoff, alas
by putting
"
tigoto bypass
...
bypass:
"
around the sfplay and its irate inputs..

The envelope, if I'm sending noteon/note-offs via Csound API, doesn't know it's been released.

On Mon, Apr 3, 2017 at 12:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
sfplay opcode in my example is probably the problem;

I expect it would reinitialize when the noteoff-or-velocity=0 note tried to tie in.

Forrest Curo
San Diego

On Sun, Apr 2, 2017 at 9:49 PM, Forrest Curo <treegestalt@gmail.com> wrote:
It really does need to use
i_nstance = int(frac(p1)*1000)
Sname sprintf "amp%i", i_nstance


to set the channel name to something it can dependably recognize when the triggering key is raised.

On Sun, Apr 2, 2017 at 2:59 PM, Forrest Curo <treegestalt@gmail.com> wrote:
My use of Oeyvind's example is working, and thus I've got a working chunk of csd for Andrea S

(You will need to put in your own midi configuration [or Csound API program, as I'm using] to call instr 3 with fractional p1 

and may well want a less eccentric choice for a sound-generating opcode)

but

There's an unexpected faint click upon release sometimes. What do I need to fix that?
----------
instr 3; p4 velocity, p5 frequency, p6 preset #
; Call this one with p3 == -1 for all notes
i_nstance = p1; Oeyvind had int(frac(p1)*1000)
Sname sprintf "amp%f", i_nstance
istart chnget Sname
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1,  ireleasetime
chnset kenv, Sname

ivel = p4
kimp = ivel *.000001 ;This value is 'VOLUME CONTROL'
impy = 65;
inote = 60
kifr = p5
ipre = p6

aoutl,aoutr    sfplay3 impy,inote, kimp,kifr,ipre, 1

outs kenv*aoutl, kenv*aoutr

endin

On Sun, Apr 2, 2017 at 4:44 AM, Andrea Strappa <a_strappa@tin.it> wrote:

Yesterday I found this solution:

;----------------sustain pedal - solution for beat again notes (different invocations of instrument) ------------------------------------
gk1        times
gk1        = abs(gk1*100)    ;take hundredth of a second
printk .1, gk1
if gk1 >= 1000 then
gk1        =        gk1 / 1000 ;reset every 1000 secs. (16,66 mins.) to not invade the space number for notes
endif
gk1        =        gk1/1000000000 ;reduce to fractional number, under the space of notes
;-------------------------------------------------------------------------------------------------

You have to insert this snippet in EXAMPLE    07B04_MidiMultiTrigg.csd (Floss manual, example    by    Joachim    Heintz,    using    code    of    Victor    Lazzarini ).

Probably there are better solutions (with loop_lt or phasor...).  I began to explore loop_lt, but I have impression that in the manual the variables are mistaked.

What do you think?

All the best

Andrea S.





Il 02/04/2017 00:38, Forrest Curo ha scritto:
Me either.

So the chngets aren't really connecting to anything outside the instrument, just connecting the end to the beginning to make that value available on the next i pass...

I wouldn't have thought that approach would be simpler, but there it is!

On Sat, Apr 1, 2017 at 1:48 PM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Yes, it may be doable without the chngets, but I find them a convenient way to hold a "global" value in this case. To do it without chngets, you probably would go into the tie-reinit things you use in your approach. But I'm not so familiar with them.

2017-04-01 13:05 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Looks like. (The only thing not working in what I considered the simpler approach
 has been something in my logic not properly keeping the last value of kenv between changes.

Since I end up retriggering the note when I release the midi key, my mistake is producing a nice effect!)

Okay, what you say here is exactly the effect I've been after. (Should be doable without the chngets, shouldn't it? If I didn't get lost trying to see what execution path we follow from one pass to another...)

On Sat, Apr 1, 2017 at 11:58 AM, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:
Perhaps I misunderstand something, but isn't this a variation on:

istart chnget "amp"
iattacktime = 0.1
idectime = 0.3
isustainlevel = 0.4
ireleasetime = 1.5
kenv linsegr istart, iattacktime, 1.0, idectime, isustainlevel, 1, isustainlevel, ireleasetime
chnset kenv, "amp"

... which in many ways could be a simpler approach
And, yes, linseg starts from the value set in the first argument. So, in the example stated here, it will start from the value the "(same) envelope reached during the previous instance. If the release was interrupted, it will start from wherever it left off. If it was allowed to reach zero and turn off, then the next envelope will start from zero.



2017-04-01 6:02 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
It really is no good.

I did a simple test of what happens when you print out the values, ran into the bug you found & fixed it the same way, then found out that yes, if if the lineseg starts from 0 that will certainly be the first value generated.

Will send a working csd soon, I hope!

On Sat, Apr 1, 2017 at 5:06 AM, Andrea Strappa <a_strappa@tin.it> wrote:
'initmp = kmp'

it's no good. Perhaps did you mean write 'initmp = i(kmp)'?

Would you send an essential-full-well-running csd?

A.S.


Il 01/04/2017 00:41, Forrest Curo ha scritto:
initmp = kmp

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

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

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



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