GithubHelp home page GithubHelp logo

yuzukitsuru / world.js Goto Github PK

View Code? Open in Web Editor NEW
33.0 1.0 5.0 1.59 MB

World.JS is a JavaScript Wrapper for World Vocoder Powered by Emscripten

Home Page: https://www.gloomyghost.com/World.JS/

License: MIT License

CMake 7.43% C++ 90.08% C 1.77% HTML 0.11% JavaScript 0.62%
vocoder world javascript javascript-library emscripten audio-processing dsp wrapper morise f0-estimation

world.js's Introduction

World.JS logo

World.JS

A JavaScript Wrapper for World Vocoder Powered by Emscripten

The current version is not perfect, there may be a lot of obsolete methods and documents in the future, please pay more attention when using.

forthebadge

About World.JS

World.JS is A JavaScript Wrapper for World Vocoder Powered by Emscripten.
You can use World Vocoder in your Browser, NodeJS, Electron app and many more like normal JavaScript.

ExamplesDocumentationRelease

Build Status CI

appveyor master appveyor latest GitHub Action latest
Build status Build status CMake

Documentation

Read more info in (Maybe Outdate, Need Update): Documentation

API

World Native:
- [x] WavRead_JS             # .wav input functions.
- [x] DIO_JS                 # F0 estimation based on DIO (Distributed Inline-filter Operation).
- [x] Harvest_JS             # F0 estimation based on Harvest.
- [x] DisplayInformation     # Display Information.
- [x] CheapTrick_JS          # Spectral envelope estimation on the basis of the idea of CheapTrick.
- [x] D4C_JS                 # Band-aperiodicity estimation on the basis of the idea of D4C.
- [X] Synthesis_JS           # Voice synthesis based on f0, spectrogram and aperiodicity.
- [x] WavWrite_JS            # Output Wav File.

Wrapper:
- [x] Wav2World              # Wav to world.
- [x] DisplayInformationVal  # Display Information by Audio object from WavRead_JS()
- [X] GetInformation         # Output information in HTML.
- [ ] WavInJS                # Load wav file as WavRead do in JavaScript.

References

License

MIT License

Copyright (c) 2019 Gloomy Ghost

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

world.js's People

Contributors

yuzukitsuru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

world.js's Issues

CheapTrick_JS error

Thank you for developing the javascript version of World!!
I built WorldJS.js as described in the README, and tried it on a simple web server, but the following error came up.
It seems to be an error related to the detached ArrayBuffer in WorldJS.wasm.
I have confirmed that the Dio_JS function, written before CheapTrick_JS, can run and output an f0 value.
How can I resolve this?

Uncaught TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer
    at Float64Array.set (<anonymous>)
    at methodCaller_emscripten$$val_$emscripten$$val_emscripten$$val$ (eval at new_ (WorldJS.js:5008), <anonymous>:6:26)
    at __emval_call_method (WorldJS.js:5513)
    at emscripten::internal::MethodCaller<emscripten::val, emscripten::val&, emscripten::val>::call(emscripten::internal::_EM_VAL*, char const*, emscripten::val&, emscripten::val&&) (static/js/lib/WorldJS.wasm:wasm-function[105]:0x325a)
    at emscripten::val emscripten::val::call<emscripten::val, emscripten::val&, emscripten::val>(char const*, emscripten::val&, emscripten::val&&) const (static/js/lib/WorldJS.wasm:wasm-function[57]:0x1556)
    at double* (anonymous namespace)::GetPtrFrom1XArray<double>(emscripten::val, int*) (static/js/lib/WorldJS.wasm:wasm-function[53]:0x13ba)
    at CheapTrick_JS(emscripten::val, emscripten::val, emscripten::val, int) (static/js/lib/WorldJS.wasm:wasm-function[59]:0x17af)
    at emscripten::internal::Invoker<emscripten::val, emscripten::val, emscripten::val, emscripten::val, int>::invoke(emscripten::val (*)(emscripten::val, emscripten::val, emscripten::val, int), emscripten::internal::_EM_VAL*, emscripten::internal::_EM_VAL*, emscripten::internal::_EM_VAL*, int) (static/js/lib/WorldJS.wasm:wasm-function[89]:0x2c67)
    at Object.CheapTrick_JS (eval at new_ (WorldJS.js:5008), <anonymous>:11:10)

The code and environment I tried to use is as follows.

<script>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="static/js/lib/WorldJS.js"></script>
</head>
<body>
<script>
  const x = Module.WavRead_JS('static/js/lib/vaiueo2d.wav')
  const f0 = Module.Dio_JS(x.x, x.fs, 2.0)
  const sp = Module.CheapTrick_JS(x.x, f0.f0, f0.time_axis, x.fs)
  const ap = Module.D4C_JS(x.x, f0.f0, f0.time_axis, sp.fft_size, x.fs)
  const synthesis = Module.Synthesis_JS(f0.f0 * 2.0, sp.spectral * 1.2, ap.aperiodicity, sp.fft_size, x.fs, 2.0)
  Module.WavWrite_JS(synthesis.x, synthesis.fs, synthesis.nbit, 'static/js/lib/out.wav')
</script>
</body>
</html>
</script>
OS: Mac OS 10.13.6(17G14042)
Browser: Chrome (version: 87.0.4280.141(Official Build) (x86_64))

Can I use Dio_JS ( or other native method) with WebAudio API?

Thank you for you great product.

I tried to use this library with audio api.
But I'm not familiar with emscripten. so I could not do it .

Could you give me a hint?

there are my code ( Partially)

audio.js

import { default as Module } from "./WorldJS.js";
/**
   *
   * @param {Float32Array[]} input
   */
  static featureExtract(input) {

   // input is 128 * 32 float32ArrayArray
   // so I must change to Float64Array
    const buffer = new Float64Array(bufferSize * bufferingLength);
    for (const [i, f32] of input.entries()) {
      for (const [j, value] of f32.entries()) {
        buffer[i * bufferSize + j] = value;
      }
    }

    const { Dio_JS  } = Module;
    const { f0, time_axis: timeAxis } = Dio_JS(buffer, sampleRate, framePeriod);
    console.log(f0) // f0 is always zero array like  [0,0,....]

argument of featureExtract(input) come from mediaStream like mic.

I think I could not send buffer propery.
the first argument type of Dis_JS is emscripten::val
Do you know the way to use this function from javascript?

I'm looking forward your reply.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.