Re: [yoshimi-user] Different sound in Yoshimi and ZynAddSubFX - update

  • From: Will Godfrey <willgodfrey@xxxxxxxxxxxxxxx>
  • To: yoshimi-user@xxxxxxxxxxxxxxxxxxxxx
  • Date: Thu, 27 Feb 2014 15:30:48 +0000

On Tue, 25 Feb 2014 21:57:56 +0100
Kristian Amlie <kristian@xxxxxxxxxx> wrote:

On 23/02/14 12:16, Will Godfrey wrote:
As far as I can see there are at least 3 places where AddSynth filtering is
handled and Cal has made a lot of changes with regard to variable names -
all
of which make perfect sense of course!

Also there are a number of places where he's replaced something like:
GlobalPar.PFilterVelocityScale / 127.0 * 6.0 // velocity sensing
with:
GlobalPar.PFilterVelocityScale / 127.0f * 6.0f // velocity sensing
Is the latter just a more correct way of presenting a float value, or is it
possible that the compiler would treat these differently?

It is possible. Compilers generally convert each operand to the "best"
type of either operand. Which one is best is decided (roughly) by this
hierarchy:

- long double
- double
- float
- int
- short
- char

Thanks for this. I hadn't realised double took priority over float (although I
can see the sense of it).

I see from the definition of PFilterVelocityScale that this is a char
variable, which has a *very* small range. So it's possible that all
numbers are converted to char before doing the math, which is
potentially very bad. By explicitly stating that those numbers are
floats, we increase the range and resolution of the calculation a lot.

This is exactly the same as Zyn. though so whatever the rights and wrongs it
can't be the cause of the problem.


--
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.


Other related posts: