Csound Csound-dev Csound-tekno Search About

[Csnd] problem with ntrpol

Date2012-08-30 11:59
FromStefan Thomas
Subject[Csnd] problem with ntrpol
Dear community,
I have a problem with the ntrpol-opcode, which does not behave, I've excpected.
I want to change the brightness of a wave dependent of the midi keyvelocity.
But unfortunately the below quoted example doesn't work:

<CsoundSynthesizer>
<CsOptions>
-odevaudio -Ma
</CsOptions>
; ==============================================
<CsInstruments>

sr    =    48000
ksmps     =     100
nchnls    =    2
0dbfs    =    1
instr 1       
    inote     notnum
    ivel     veloc
    ivelsens = 0.9
    iamp     ampmidi 0.2
    icps    cpsmidi
    ibrightest = 0.2
    ibright    ntrpol 0.9, ibrightest, ivel*ivelsens
    igausswave ftgen 0,0, 2^13,20,6,1,ibright
    aenv linsegr 0, 0.01, 1, 7,0, 0.1, 0
    asig poscil iamp*aenv, icps, igausswave
    outs asig, asig
endin

</CsInstruments>
; ==============================================
<CsScore>
f 0 10


</CsScore>
</CsoundSynthesizer>




Date2012-08-30 17:25
FromJim Aikin
Subject[Csnd] Re: problem with ntrpol
My suspicion, having tried your instrument, is that ntrpol is working fine.
One difficulty is that you're misinterpreting the output of veloc. If you
use a print statement, you'll see that this gives you the _raw_ MIDI
velocity value (between 0 and 127), not a value between 0 and 1. As a
result, your input to ntrpol's 3rd argument is way out of range.

Another tricky spot may be that you're misunderstanding what GEN 20 does.
It's likely to be a poor choice for a waveform generator, or so it would
appear to me, because it's going to produce a signal that varies between 0
and 1 rather than between -1 and 1.

With suitable values, you may get better results with GEN 11. I had to
fiddle with the numbers a bit, but here's what I came up with. (You'll
observe that I don't much care for ampmidi.)

instr 1       
    ivel     veloc
    iamp     = 0.07 + (ivel / 250)
    icps    cpsmidi
    iratio = 0.6 + (ivel * 0.003)
    iwave ftgen 0, 0, 2^13, 11, 64, 1, iratio
    aenv linsegr 0, 0.01, 1, 7, 0, 0.1, 0
    asig poscil iamp*aenv, icps, iwave
    outs asig, asig
endin



--
View this message in context: http://csound.1045644.n5.nabble.com/problem-with-ntrpol-tp5715315p5715326.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2012-08-30 20:39
FromStefan Thomas
SubjectRe: [Csnd] Re: problem with ntrpol
Dear Jim,
thanks for Your tipps and I think You are right, gen11 sounds better.

2012/8/30 Jim Aikin <midiguru23@sbcglobal.net>
My suspicion, having tried your instrument, is that ntrpol is working fine.
One difficulty is that you're misinterpreting the output of veloc. If you
use a print statement, you'll see that this gives you the _raw_ MIDI
velocity value (between 0 and 127), not a value between 0 and 1. As a
result, your input to ntrpol's 3rd argument is way out of range.

Another tricky spot may be that you're misunderstanding what GEN 20 does.
It's likely to be a poor choice for a waveform generator, or so it would
appear to me, because it's going to produce a signal that varies between 0
and 1 rather than between -1 and 1.

With suitable values, you may get better results with GEN 11. I had to
fiddle with the numbers a bit, but here's what I came up with. (You'll
observe that I don't much care for ampmidi.)

instr 1
    ivel     veloc
    iamp     = 0.07 + (ivel / 250)
    icps    cpsmidi
    iratio = 0.6 + (ivel * 0.003)
    iwave ftgen 0, 0, 2^13, 11, 64, 1, iratio
    aenv linsegr 0, 0.01, 1, 7, 0, 0.1, 0
    asig poscil iamp*aenv, icps, iwave
    outs asig, asig
endin



--
View this message in context: http://csound.1045644.n5.nabble.com/problem-with-ntrpol-tp5715315p5715326.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"