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

Resampling fixes and tests #209

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

keleftheriou
Copy link
Contributor

@keleftheriou keleftheriou commented Sep 29, 2024

This is meant to demonstrate some problems with the current resampling code & usage, and propose a new implementation.

The current resampling code and usage has the following issues:

  • Fails with loadAudioFailed("Failed to process audio buffer") on certain inputs - e.g. for 44.1khz files with frame counts of 12289 + 1024*N.
  • Takes up roughly twice as much memory, since both the AVAudioPCMBuffer returned from AudioProcessor.loadAudio() and the [Float] returned from AudioProcessor.convertBufferToArray() are retained for the entire duration of the inner transcribe(audioArray: ...) call.
  • The code seems unnecessarily complex, with an error-prone structure.

The included tests attempt to demonstrate the problem and stress-test a proposed implementation via the use of dynamically created silent files of arbitrary lengths and sample rates.

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

Successfully merging this pull request may close these issues.

1 participant