Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Difference between x32 and x64 results of tone:// (Read 1133 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Difference between x32 and x64 results of tone://

While looking for a way to calibrate my component I found the tone:// protocol.

However, I'm discovered that tone://997,30 produces (sample rate 96kHz) produces different RMS values between the x86 and x64 of fb2k 2.1.3. I know that x86 uses float and x64 uses double for audio_sample but 1.f = 1.0 and -1.f = -1.0 AFAIK.

Is this a bug or am I misinterpreting the results?

Re: Difference between x32 and x64 results of tone://

Reply #1
I see the produced files are slightly different, but peaks are at 1.00000 for both, ReplayGain values are identical (-18 dB) and RMS should also be identical. For example Audition shows -3.01 dB for both.
Zooming in on the waveforms I see the slopes in 64-bit output are getting more and more delayed as time goes on. So definitely some math difference in play here.
Audition shows the 32-bit output is actually 997.16 Hz and 64-bit output is 996.95 Hz.

Re: Difference between x32 and x64 results of tone://

Reply #2
I see the produced files are slightly different, but peaks are at 1.00000 for both, ReplayGain values are identical (-18 dB) and RMS should also be identical. For example Audition shows -3.01 dB for both.
Zooming in on the waveforms I see the slopes in 64-bit output are getting more and more delayed as time goes on. So definitely some math difference in play here.
Audition shows the 32-bit output is actually 997.16 Hz and 64-bit output is 996.95 Hz.
The x64 version produces a nice approximation of 1/sqrt(2) for the RMS while the x86 version of the same code approaches this value with tone://440,30.
I'm definitely not qualified enough to understand why there is a difference but it makes testing my own code confusing.

Re: Difference between x32 and x64 results of tone://

Reply #3
What is the tone:// protocol? Mr. Google wasn't very helpful.

Thanks,
Mike

Re: Difference between x32 and x64 results of tone://

Reply #4
tone://X,Y produces tone of X hertz lasting for Y seconds

The reason why output is different is that 32bit version, being 20+ years old tech, uses assembly-optimized sine generator, relying on fsin opcode rather than sin() C runtime function. This seems to have very slight accuracy issues that account for what you observe.
I'm removing offending code to prevent different builds producing different output in the future, as any performance gains from this are irrelevant by now.
Microsoft Windows: We can't script here, this is bat country.

Re: Difference between x32 and x64 results of tone://

Reply #5
tone://X,Y produces tone of X hertz lasting for Y seconds

The reason why output is different is that 32bit version, being 20+ years old tech, uses assembly-optimized sine generator, relying on fsin opcode rather than sin() C runtime function. This seems to have very slight accuracy issues that account for what you observe.
I'm removing offending code to prevent different builds producing different output in the future, as any performance gains from this are irrelevant by now.
Thx, Peter.

Re: Difference between x86 and x64 results of tone://

Reply #6
@Peter ,

x86 2.2 preview 2024-04-10 produces even weirder results: audio_sample only varies between [-0.6680, 0.5938].
The same code compiled as x64 behaves normal.

Re: Difference between x32 and x64 results of tone://

Reply #7
Can't replicate. 997 Hz tone generated on new 32-bit foobar compared to the old tone I generated with 64-bit foobar showed 22 differing samples. (Differences found: 22 values, 0:14.500000 - 0:29.500000, peak: 0.000000 (-301.03 dBFS) at 0:28.500000, 1ch).

Edit: and the "RMS+3" RMS calculation gives 0.0000000 dB RMS result for the tone.

Re: Difference between x32 and x64 results of tone://

Reply #8
Can't replicate. 997 Hz tone generated on new 32-bit foobar compared to the old tone I generated with 64-bit foobar showed 22 differing samples. (Differences found: 22 values, 0:14.500000 - 0:29.500000, peak: 0.000000 (-301.03 dBFS) at 0:28.500000, 1ch).

Edit: and the "RMS+3" RMS calculation gives 0.0000000 dB RMS result for the tone.
Must be my system then.

Does any of that data go outside fb2k before it is presented to a vizualisation stream? An audio driver? Strange though that the x64 code behaves OK. It's not just the tone:// protocol BTW. I played a couple of tracks and never got any values outside that range.

Re: Difference between x32 and x64 results of tone://

Reply #9
Oh you are looking at the output through visualization API? The data you get there is after DSP processing and before going to outputs.
Note that with that API you may not see the entire waveform if you only request partial chunks here and there. But I just tested and that API too fully sees the tone using full -1.00..+1.00 scale.

Re: Difference between x32 and x64 results of tone://

Reply #10
Oh you are looking at the output through visualization API? The data you get there is after DSP processing and before going to outputs.
Note that with that API you may not see the entire waveform if you only request partial chunks here and there. But I just tested and that API too fully sees the tone using full -1.00..+1.00 scale.
I understand the result does not represent the entire waveform but why the difference between x86 and x64 with the same code? Please have a look at my PM.

Re: Difference between x32 and x64 results of tone://

Reply #11
For future reference: Mystery solved with the help from Case

The visualization stream gets the data after the DSP. The x86 foobar2000 version had the Equalizer enabled which scaled down the sample values.