Post

Replies

Boosts

Views

Activity

Reply to Core Audio: sine wave gets distorted over time
Thank you so much! You were absolutely correct. r32 is an alias for float. runningSampleIndex is increasing indefinitely, and the larger the number, the more float loses precision. The solution was to not grow runningSameIndex indefinitely, but reset it every period, so that it always stays in [0, framesPerPeriod] range.
Topic: Media Technologies SubTopic: Audio Tags:
Aug ’23
Reply to Core Audio: sine wave gets distorted over time
Just in case - here is the source code: audio initialization: https://github.com/DataDrivenEngineer/antiqua/blob/main/antiqua/main.m#L96 audio callback: https://github.com/DataDrivenEngineer/antiqua/blob/main/antiqua/main.m#L23 sine wave generation: https://github.com/DataDrivenEngineer/antiqua/blob/main/antiqua/antiqua.cpp#L26
Topic: Media Technologies SubTopic: Audio Tags:
Aug ’23