Skip to content

Decoder for MP3 #20

@frizurd

Description

@frizurd

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: '=='
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions