<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 08/10/14 13:36, Raine M. Ekman
wrote:<br>
</div>
<blockquote
cite="mid:20141008153614.uuizkn38g0s8oc48@webmail1.abo.fi"
type="cite">
<blockquote type="cite">Phil CM <a class="moz-txt-link-rfc2396E"
href="mailto:philcm@gnu.org"><philcm@gnu.org></a> wrote:
<br>
<blockquote type="cite">Now the only think that is left is a
portamento function, to go from <br>
one note to another (/exactly/ like so-404 <br>
<a class="moz-txt-link-rfc2396E"
href="http://d00m.org/%7Esomeone/so404/"><http://d00m.org/%7Esomeone/so404/></a>
does). <br>
</blockquote>
</blockquote>
<br>
Quoting Philipp Überbacher <a class="moz-txt-link-rfc2396E"
href="mailto:murks@tuxfamily.org"><murks@tuxfamily.org></a>:
<br>
<blockquote type="cite">I have never done this but I suggest to
look at the calf monosynth <br>
code. AFAIR it has a couple of different ways to handle <br>
successive/overlapping notes. <br>
<br>
Another synth that comes to mind and has portamento is phasex. <br>
</blockquote>
<br>
Well, if it has to be exactly the same, I'd suggest digging in the
so-404 code and not in those other synths. Looks like it adjusts
frequency at samplerate/100, calculating: <br>
freq = ((portamento/127.0)*0.9)*freq +
(1.0-((portamento/127.0)*0.9))*tfreq; <br>
<br>
I guess tfreq is the target frequency of the note being
portamented towards. <br>
<br>
</blockquote>
OK, so I found how to control the envelope with a new control, and
how to output values in console while jalv runs, like this :<br>
<br>
<tt>printf("Key: %d, Period: %d, Vel: %d, Envelope: %f\n", key,
m_period, velocity, m_envelope);</tt><br>
<br>
And it prints this :<br>
<br>
<tt>Key: 77, Period: 276, Vel: 81, Envelope: 0.632812</tt><tt><br>
</tt><tt>Key: 79, Period: 246, Vel: 75, Envelope: 0.585938</tt><tt><br>
</tt><tt>Key: 64, Period: 584, Vel: 43, Envelope: 0.335938</tt><tt><br>
</tt><tt>Key: 76, Period: 292, Vel: 54, Envelope: 0.421875</tt><tt><br>
</tt><tt>Key: 65, Period: 551, Vel: 54, Envelope: 0.421875</tt><tt><br>
</tt><tt>Key: 64, Period: 584, Vel: 64, Envelope: 0.500000</tt><tt><br>
</tt><tt>Key: 77, Period: 276, Vel: 55, Envelope: 0.429688</tt><tt><br>
</tt><tt>Key: 76, Period: 292, Vel: 44, Envelope: 0.343750</tt><tt><br>
</tt><tt>Key: 76, Period: 292, Vel: 63, Envelope: 0.492188</tt><tt><br>
</tt><tt>Key: 67, Period: 491, Vel: 78, Envelope: 0.609375</tt><tt><br>
</tt><br>
So apparently the period <i>is</i> the note. (I looked in the lib
for the formula).<br>
Now how do I introduce those freq and portamento variables, are they
variables (or parameters or functions or keywords) that exists for
me to use it, or do I have to declare them and if so, how do I
connect them to render()? Maybe I don't even need them, most of the
logic seems to be already here:<br>
See, look how it goes :<br>
<br>
<tt> void render(uint32_t from, uint32_t to) {</tt><tt><br>
</tt><tt> if (m_key == LV2::INVALID_KEY)</tt><tt><br>
</tt><tt> return;</tt><tt><br>
</tt><tt> for (uint32_t i = from; i < to; ++i) {</tt><tt><br>
</tt><tt> m_envelope = *p(p_enve);</tt><tt><br>
</tt><tt> float pwm = *p(p_pwm) + (1 - *p(p_pwm)) * m_envelope;</tt><tt><br>
</tt><tt> float s = -0.25 + 0.5 * (m_counter > m_period * (1
+ pwm) / 2);</tt><tt><br>
</tt><tt> // float s = -0.25 + 0.5 * (m_counter > m_period /
2);</tt><tt><br>
</tt><tt> m_counter = (m_counter + 1) % m_period;</tt><tt><br>
</tt><tt> p(p_left)[i] += s;</tt><tt><br>
</tt><tt> p(p_right)[i] += s;</tt><tt><br>
</tt><tt> if (m_envelope > 0)</tt><tt><br>
</tt><tt> m_envelope -= 0.5 / m_rate;</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><br>
And <i>from</i> and <i>to</i> are already there. This for loop
determines the duration of the note, right? I have to use some of
that time to go from <i>from</i> to <i>to</i> in a fraction of
that time. <br>
<br>
How do I do that?<br>
<br>
<tt>--</tt><tt><br>
</tt><tt>Phil</tt><br>
</body>
</html>