Git Product home page Git Product logo

audio-encoder's Issues

onProgress

Hi this is great. Can you include in the readMe what is possible to get out from onProgress and an example.
I would like to make a encode progress bar. How do I get progress data out?

Support streaming Float32Array input

Support streaming Float32Array input.

Currently it appears the only valid input to audioEncoder() is a Web Audio API AudioBuffer.

AudioWorklet and MediaStreamTrackProcessor (https://w3c.github.io/mediacapture-transform/) provides a means to get "real-time" audio data as Float32Arrays.

We should be able to stream Float32Arrays to audioEncoder() and later call a method to encode the data once required input is achieved.

MPEGMode is not defined (from Lame.js)

Hi there,

the encoder to mp3 doesn't work anymore.

Here is my code :

import encode from 'audio-encoder';

export const bufferToMp3 = (buffer) => {
        return new Promise((res, rej) => {
            encode(buffer, 320, null, blob => res(blob));
        })
    }

An error is thrown :

Lame.js:135 Uncaught (in promise) ReferenceError: MPEGMode is not defined
    at lame_init_old (Lame.js:135:1)
    at Lame.lame_init (Lame.js:229:1)
    at new Mp3Encoder (index.js:100:1)
    at encodeMp3 (encodeMp3.js:49:1)

Update lamejs dependency

Working with audio-encoder, I discovered an issue as described here. My colleague reported it and luckily the maintainer of lamejs package released a new version 1.2.1 to fix that.

It would be great if you could update the dependency to the most recent version (1.2.0 -> 1.2.1) so that I don't have to emulate the bugfix manually each time I build.

Promisify encodeWav.js ?

Currently encodeWav expects a callback that will be passed the blob after a 30ms timeout.

Why is the timeout necessary in a function that appears to be otherwise fully synchronous? I tried swapping the setTimeout for a simple return blob; and it works fine.

Assuming there's some asynchronicity that has to be waited for, why not return a promise that resolves with the blob?

In my use case, I'm encoding many different chunks of audio and then putting the blobs into a zip file for download, so I have to wait for all blobs to be returned. The callback was not a practical solution for me, but maybe other people using this library typically don't have this problem and are okay with the callback solution.

I could submit a PR with a very simple change to promisify encodeWav, but I wanted to understand the library's rationale first.

Thanks!

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.