logarithmic curve?

Hi there,

As a beginner I'm trying out several things in Csound, and as you could imagine, some answers raise even more questions. I was trying to convert between midi velocity and amp, and came across a method of doing this with the tablei opcode. That worked fine. But When I decided to use a logarithmic curve for the conversion, instead of a linear one, I realised there wasn't a way to create such a curve in the GENs help files.

I coundn't manage to find out how to produce functions with logarithmic curves. Is it possible? I mean, to be able to create an envelope with a logarithmic growth, instead of the exponential growth of GEN5, or linear growth, for exemple.

Thanks in advance, any clue will be highly appreciated.
Peter, Brazil

Logarithmic curve the hard way.

One way to do this would be to use GEN07 and make a quasi-logarithmic function by filling in a few points along the way. This is one example:

f 1 0 1024 7 0 32 0.096 32 0.176 64 0.301 128 0.477 128 0.602 128 0.699 128 0.778 128 0.845 128 0.903 128 0.954

You could be more precise if you want, specifically in the early portions. Seeing as how you are using midi, I would assume that the above example would be precise enough. I did this in Log base 10, so you would have to redo the numbers if you want a different base.

Mark

Great

Oh, that's exactly what I was looking for. It perfectly fits my needs. That's a good lesson: I allways can draw specific functions, and not limit myself to the presets.

Well, thanks to your insight I made a complete 128 points logarithmic curve.

Thank you very much.
Regards,

f 1 0 128 7 0 1 0.088388347648318 1 0.125 1 0.15309310892395 1 0.17677669529664 1 0.19764235376052 1 0.21650635094611 1 0.23385358667337 1 0.25 1 0.26516504294496 1 0.27950849718747 1 0.29315098498896 1 0.3061862178479 1 0.31868871959955 1 0.33071891388307 1 0.34232659844073 1 0.35355339059327 1 0.36443449342783 1 0.375 1 0.38527587518556 1 0.39528470752105 1 0.40504629365049 1 0.41457809879442 1 0.42389562394533 1 0.43301270189222 1 0.44194173824159 1 0.450693909433 1 0.45927932677185 1 0.46770717334674 1 0.47598581911649 1 0.48412291827593 1 0.49212549212574 1 0.5 1 0.50775240028975 1 0.51538820320221 1 0.5229125165838 1 0.53033008588991 1 0.53764532919016 1 0.54486236794258 1 0.55198505414549 1 0.55901699437495 1 0.56596157113359 1 0.57282196186948 1 0.57960115596848 1 0.58630196997793 1 0.59292706128157 1 0.59947894041409 1 0.60595998217704 1 0.61237243569579 1 0.61871843353823 1 0.625 1 0.63121905864763 1 0.6373774391991 1 0.64347688381169 1 0.64951905283833 1 0.65550553010634 1 0.66143782776615 1 0.66731739075196 1 0.67314560089181 1 0.67892378070001 1 0.68465319688146 1 0.6903350635742 1 0.69597054535375 1 0.70156076002011 1 0.70710678118655 1 0.71260964068696 1 0.71807033081725 1 0.72348980642439 1 0.72886898685566 1 0.73420875777942 1 0.73950997288745 1 0.74477345548831 1 0.75 1 0.75519037334966 1 0.76034531628728 1 0.76546554461974 1 0.77055175037112 1 0.77560460287443 1 0.7806247497998 1 0.78561281812353 1 0.79056941504209 1 0.79549512883487 1 0.80039052967911 1 0.80525617042032 1 0.81009258730098 1 0.81490030065033 1 0.81967981553775 1 0.82443162239206 1 0.82915619758885 1 0.8338540040079 1 0.83852549156242 1 0.843171097702 1 0.84779124789066 1 0.85238635606162 1 0.85695682505013 1 0.86150304700564 1 0.86602540378444 1 0.87052426732401 1 0.875 1 0.87945295496689 1 0.88388347648318 1 0.88829190022199 1 0.89267855356786 1 0.89704375590046 1 0.901387818866 1 0.90571104663684 1 0.91001373616006 1 0.91429617739549 1 0.91855865354369 1 0.92280144126459 1 0.92702481088696 1 0.93122902660946 1 0.93541434669349 1 0.93958102364831 1 0.94372930440884 1 0.94785943050644 1 0.95197163823299 1 0.95606615879865 1 0.96014321848358 1 0.96420303878384 1 0.96824583655185 1 0.9722718241315 1 0.97628120948833 1 0.98027419633488 1 0.98425098425148 1 0.98821176880262 1 0.99215674164922 1 0.99608609065683 1 1.0

pharmacy uk buy zithromax generic cialis z-pak viagra uk zpack z-pack cialis uk Canadian pharmacy avanafil viagra online z pack buy viagra uk ed drugs z pak zpak staxyn generic viagra Canadian pharmacy viagra cialis online ed pills cheap generic viagra kamagra uk