Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why fixed point instead of float? #16

Open
obsoleszenz opened this issue Feb 2, 2024 · 3 comments
Open

Why fixed point instead of float? #16

obsoleszenz opened this issue Feb 2, 2024 · 3 comments

Comments

@obsoleszenz
Copy link

obsoleszenz commented Feb 2, 2024

Is there any reason to use fixed point over float? I thought it was an optimization of the past, but maybe I'm misinformed?

@Holzhaus
Copy link
Owner

Holzhaus commented Feb 2, 2024

Sorry, I'm lacking context here. Where is fixed point arithmetic used?

@obsoleszenz
Copy link
Author

Maybe i'm just assuming it, but isn't this fixed point arithmetic?

https://github.com/Holzhaus/vinylla/blob/main/src/util.rs#L68

Also here the sample is a i32 ? I would have expected an f32 ?

self.ewma.process(sample);

@Holzhaus
Copy link
Owner

Holzhaus commented Feb 3, 2024

Maybe i'm just assuming it, but isn't this fixed point arithmetic?

https://github.com/Holzhaus/vinylla/blob/main/src/util.rs#L68

No, that's just integer math. Not using fixed point arithmeric anywhere IIRC.

Also here the sample is a i32 ? I would have expected an f32 ?

self.ewma.process(sample);

Originally the samples are an i16, because 16 bit audio should suffice for our purposes. The Serato timecode audio CDs are also 16 bit anyway.

https://github.com/Holzhaus/vinylla/blob/main/src%2Ftimecode.rs#L129-L130

Using integers here because it's faster and I don't see an advantage in using floating point math for this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants