Bug with trigonometric functions?
-
- KVRer
- Topic Starter
- 4 posts since 15 Jul, 2012 from Germany
Hi all,
this is my first post in this forum.
I am trying to write my first Sonic Birth PlugIn but as soon as I include trigonometric functions I encounter calculating problems.
For example:
sin (0) should be 0, sin (90) should be 1, any number between 0 and 90 should therefore result in a value between 0 and 1. But if I create (in a empty circuit) a slider from 0 to 90, connect it to a sin object and monitor the result in a show value object (an audiofile must be run to make the display working), I get completely wrong results.
For 90 it outputs the value of 0.893996664, for 0 it results in 2.47033e-32
Am I missing something?
MM
this is my first post in this forum.
I am trying to write my first Sonic Birth PlugIn but as soon as I include trigonometric functions I encounter calculating problems.
For example:
sin (0) should be 0, sin (90) should be 1, any number between 0 and 90 should therefore result in a value between 0 and 1. But if I create (in a empty circuit) a slider from 0 to 90, connect it to a sin object and monitor the result in a show value object (an audiofile must be run to make the display working), I get completely wrong results.
For 90 it outputs the value of 0.893996664, for 0 it results in 2.47033e-32
Am I missing something?
MM
-
- KVRist
- 225 posts since 11 Apr, 2007 from Montreal, Canada
Degree values have to be in radian: pi/180.
Hint: it' always better to have a multiplication rather than a division, so transform that division into a constant multiplication by entering "pi/180" into a constant multiplication element. The degrees control, that I guess will be part of the GUI, will be then multiplied by a constant of 0.0174532925199433.
Hint: it' always better to have a multiplication rather than a division, so transform that division into a constant multiplication by entering "pi/180" into a constant multiplication element. The degrees control, that I guess will be part of the GUI, will be then multiplied by a constant of 0.0174532925199433.
-
- KVRist
- 225 posts since 11 Apr, 2007 from Montreal, Canada
Also, you don't need a file, just press start in the "Sound server", without loading a file.
-
- KVRist
- 225 posts since 11 Apr, 2007 from Montreal, Canada
And use this version http://www.radio.uqam.ca/ambisonic/soni ... _beta2.zip
-
- KVRer
- Topic Starter
- 4 posts since 15 Jul, 2012 from Germany
Ok, thanks.
That helps. Needed some time for a solution to my problem, though, as to keep it simple, I was giving the sin - circuit as an example to find out if there is something wrong with the trigonometric function, while I actually needed was the opposite: I have the sin (or cos) and I need to calculate the angle in degrees. The function I need is asin (x).
So, radiant was the important clue, I found in wikipedia the inverse function x*(180/pi).
So thanks again!
MM
-------
btw: Where the hell in the manual can I find that? I mean - in every damn calculator i enter a number, press the sin button, and get the correct value. Nowhere any hint, that values have to be in radiant rather then an degree format.
That helps. Needed some time for a solution to my problem, though, as to keep it simple, I was giving the sin - circuit as an example to find out if there is something wrong with the trigonometric function, while I actually needed was the opposite: I have the sin (or cos) and I need to calculate the angle in degrees. The function I need is asin (x).
So, radiant was the important clue, I found in wikipedia the inverse function x*(180/pi).
So thanks again!
MM
-------
btw: Where the hell in the manual can I find that? I mean - in every damn calculator i enter a number, press the sin button, and get the correct value. Nowhere any hint, that values have to be in radiant rather then an degree format.
-
- KVRist
- 225 posts since 11 Apr, 2007 from Montreal, Canada
I agree that the manual is bare bones (SonicBirth was originally an end of term project for a course in software engineering, so I guess that docs were not a high priority...), but when dealing with trigonometry, it's either degrees or radians. When I first used sine and cosine elements with degrees and it didn't output the expected results, I also scratched my head and tried radians just to see if it worked.MassMover wrote:btw: Where the hell in the manual can I find that? I mean - in every damn calculator i enter a number, press the sin button, and get the correct value. Nowhere any hint, that values have to be in radiant rather then an degree format.
The calculator that comes with OS X has a degree/radian switch: maybe it's defaulted to degrees, I've never noticed.
-
- KVRer
- Topic Starter
- 4 posts since 15 Jul, 2012 from Germany
So, after a round of math the PlugIn starts to get working - slowly. But whenever I install it as an AU, it won't pass the AU validation on Logic's start - it causes Logic to crash. The original SB PlugIns work fine. I downloaded the 1.3.1b2, but with this version not even the framework will pass the validation. So I went back to 1.3.0.
I canot even export a simple 2in-hardpatch-2out test PlugIn - Logic tells me to verify the new PlugIn - and than quits.
I'm on a G5 Quad with X.5.8 (Leopard) and Logic9 - any help would be appreciated.
MM
I canot even export a simple 2in-hardpatch-2out test PlugIn - Logic tells me to verify the new PlugIn - and than quits.
I'm on a G5 Quad with X.5.8 (Leopard) and Logic9 - any help would be appreciated.
MM