csound / csound.github.io

Csound Project Homepage
24 stars 27 forks source link

Manual: pchbend #81

Closed ReinerZorn closed 8 months ago

ReinerZorn commented 3 years ago

In the manual entry of

ibend pchbend [imin] [, imax]

the arguments are explained as:

imin, imax (optional) -- set minimum and maximum limits on values obtained

I don't think it really works like this. Rather the first argument is a midpoint and the second a width. So the range spanned by the pitch bender is not imin...imax but rather imin-imax...imin+imax. I suggest to use different dummy names in the manual.

jpffitch commented 3 years ago

I cannot see that in the code. Do you have an example of it being wrong?

ReinerZorn commented 3 years ago

Below you find a test which just prints the value from pchbend when I move the pitch bender from neutral to low and then to high. From the docs I would expect kpb to vary from a minimum of 0 to a maximum of two with 1 in the neutral position. In reality it varies between -2 in the low position to +2 in the high (which is actually much more reasonable).

grafik

jpffitch commented 3 years ago

I av looked at te code and rere is some abmbiguity asto what is required. The raw bend value is in the range [-1,+1] whic ypu request changing to [0,2]. Thecurret code assumes the raw value is in the range [0,1] so there is a bug here. My questio is what to you think the 0,2 should mean. Do you really want [0,2]?

vlazzarini commented 3 years ago

There are two choices:

1) keep the behaviour and change the manual (make it kmid, kdev or something like that).

2) change the code to match what is in the manual page.

However if 1) is the result of a bug, then 2) surely is the right thing to do.

Usually only 1 pchbend parameter is implemented, the abs bend width in semitones. But this opcode seems to be designed differently.

ReinerZorn commented 3 years ago

I would rather change the manual. Firstly, people already using it would have a bad surprise upon the next upgrade if the code is changed. Secondly, before reading the manual I expected the parameters to be the midpoint and the spread. I think this is more intuitive than min/max.

jpffitch commented 3 years ago

OK; will change the manual

jpffitch commented 3 years ago

I am not sure how to describe the parameters

I ran the achbend with variousparameters

base max minimum neutral maximum

0 2 -2 0 2 1 2 0 1 2 1 5 -3 1 5 3 2 4 3 2 Are you happy with that?

The second parameter is not the width nor the half width but the maximum value and the minimum is twice the base minus the maximum, whic is ard to explain clearly

vlazzarini commented 3 years ago

To me that sounds like it's broken but no one had noticed it before.

ReinerZorn commented 3 years ago

Well, that looks a bit more idiosyncratic. I forgot to test the possibility of the first parameter !=0 and what comes out in that case is really a bit strange. But I think 99% of applications want zero as a result when the the pitch bender is in the neutral position. And then you will not notice it. Nevertheless this may be a reason for changing the code.

joachimheintz commented 8 months ago

this either belongs to the manual, or to the main csound repo, so i am closing it here.