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

Decoder for MP3 #20

Open
frizurd opened this issue Aug 19, 2021 · 0 comments
Open

Decoder for MP3 #20

frizurd opened this issue Aug 19, 2021 · 0 comments

Comments

@frizurd
Copy link

frizurd commented Aug 19, 2021

Did you guys manage to find or create a decoder for MP3?

I tried using https://www.npmjs.com/package/audio-decode
I integrated the decoder this way:

            const decodeMP3 = async file => {
                const buffer = await decode(file)
                const data = {
                    "numberOfChannels": buffer.numberOfChannels,
                    "length": buffer.length,
                    "sampleRate": buffer.sampleRate,
                    "channelData": Array.from({ "length": buffer.numberOfChannels },
                        (_, ch) => buffer.getChannelData(ch))
                }
                return data
            }
            decoder.set("mp3", decodeMP3)
            decoder.set("m4a", decodeMP3)

But I am receiving the following error:

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
  assert(
    audioBus.audioData.numberOfChannels === this.audioData.numberOfChannels,
  )
  ...
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant