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

How to play consecutive audio files with different sample rates #227

Closed
mark-summerfield opened this issue Nov 24, 2023 · 3 comments
Closed

Comments

@mark-summerfield
Copy link

Suppose I have two audio files one with a sample rate of 44100 and the other with 48000.
I can't see how I can play one after the other since once I create an oto.Context with a specific sample rate I can't change the context or the sample rate.
I tried along these lines:

if format.SampleRate != sampleRate {
    sampleRate = format.SampleRate
    otoCtx = nil
    runtime.GC()
    otoCtx = ... with new context options including the new sample rate
}

but this just crashed with oto: context is already created.

@hajimehoshi
Copy link
Member

Unfortunately there is no way to change the sample rate. This seems duplicated with #149

@mark-summerfield
Copy link
Author

OK, thanks.

@Asday
Copy link

Asday commented Nov 24, 2023

Consider remuxing your input streams to the highest sample rate among them (in realtime if you like), and using that sample rate for the context.

@hajimehoshi hajimehoshi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2023
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

3 participants