| Wow, I really appreciate your reply!
>> Also, when csound writes a 16-bit integer, how is the conversion from
>> float back to int handled? It doesn't seem to be a simple
>> multiplication by 32767 or 32768 since -1.0 to +1.0 w/ 0dbfs=1.0 seems
>> to map back to the asymmetrical -32768 to +32767.
>
> If libsndfile is being used for this, then it is actually just a multiply
> by 32768. This is explained more fully here:
>
> http://www.mega-nerd.com/libsndfile/FAQ.html#Q010
I have been looking at this FAQ for the last couple of days -- unless
I'm reading it wrong it seems to suggest that a multiply by 32767 is
what should happen under libsndfile, which is why I've been confused
about this, since it does not seem to be happening in csound.
>
>> I suppose it could
>> just be a multiply by 32768 with the positive value just clipped to
>> +32767?
>
> libsndfile does have a mode where values that would exceed the range
> allowed by the output file are clipped instead of being allowed to
> wrap around. I'm not sure if Csound uses this mode or not.
>
It seems like there's no simple way to map back to -32768 -- +32767
with just a simple multiplication, so something must happen for the
max-amp positive value if it's a multiply by 32768. If it's not
clipping, one could maybe do this with lrintf(float*32767.5 - .5) --
if lrintf rounds to nearest even integer this should keep 0 amp at 0
after the conversion -- but I have a feeling this isn't going on here
either, and I don't know enough about it to know if this is even an
appropriate conversion scheme. I guess it's time to read the csound
and libsndfile source. =o)
Thanks again,
Matt
Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |