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

Sync changing of sample rate #8

Closed
jscheid opened this issue Jul 28, 2021 · 10 comments
Closed

Sync changing of sample rate #8

jscheid opened this issue Jul 28, 2021 · 10 comments
Labels
enhancement New feature or request

Comments

@jscheid
Copy link

jscheid commented Jul 28, 2021

Could the call to new SRC somehow be moved out of the promise, so that different sample rates can be chosen without needlessly having to resolve a promise?

@aolsenjazz
Copy link
Owner

It sounds like you want to be able to do something like this?

// ... create SRC object with sample rate 44.1k
src.simple(data); // or full 

src.outputSampleRate = 48000;

src.simple(data); // or full 

Is this correct?

@jscheid
Copy link
Author

jscheid commented Jul 28, 2021

Yes, something like that would be ideal.

@aolsenjazz
Copy link
Owner

Cool. Seems like the easiest way to do this would be to add a setter to the js src object which just calls destroy() + init() on the WASM module.

If you're comfortable doing this, please open a pr! otherwise, I can look into it in the next week or two.

@aolsenjazz aolsenjazz added the enhancement New feature or request label Jul 29, 2021
@jscheid
Copy link
Author

jscheid commented Jul 29, 2021

I've worked around it like so: https://gist.github.com/jscheid/0fe0ca86dbecc7a4efb65a604284d1c1

It's a hack but it does work, feel free to close this.

@aolsenjazz
Copy link
Owner

Seems like a feature worth having. Will add within the next week or two.

@jscheid
Copy link
Author

jscheid commented Aug 2, 2021

The other useful improvement would be a way to process multiple streams in parallel (with the full API). This doesn't currently work (efficiently) because there's only a single SRC_STATE per wasm instance.

@aolsenjazz
Copy link
Owner

Interesting. Curious to see how you would want this used. For organization, would you open a new issue with a bit more detail?

@aolsenjazz
Copy link
Owner

Added support for updating input and output sample rates in 1c90c7e

@jscheid
Copy link
Author

jscheid commented Aug 29, 2021

Thanks!

@aolsenjazz
Copy link
Owner

Happy to!

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

No branches or pull requests

2 participants