You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 679B

12345678910111213141516171819202122232425
  1. // @flow
  2. // Script expects to find rnnoise webassembly binary in the same public path root, otherwise it won't load
  3. // During the build phase this needs to be taken care of manually
  4. import rnnoiseWasmInit from 'rnnoise-wasm';
  5. import RnnoiseProcessor from './RnnoiseProcessor';
  6. export { RNNOISE_SAMPLE_LENGTH } from './RnnoiseProcessor';
  7. export type { RnnoiseProcessor };
  8. let rnnoiseModule;
  9. /**
  10. * Creates a new instance of RnnoiseProcessor.
  11. *
  12. * @returns {Promise<RnnoiseProcessor>}
  13. */
  14. export function createRnnoiseProcessor() {
  15. if (!rnnoiseModule) {
  16. rnnoiseModule = rnnoiseWasmInit();
  17. }
  18. return rnnoiseModule.then(mod => new RnnoiseProcessor(mod));
  19. }