mohayonao / web-audio-engine

Pure JS implementation of the Web Audio API
243 stars 32 forks source link

Valid mp3 file returns format "unknown" #64

Open FireController1847 opened 6 years ago

FireController1847 commented 6 years ago

Here's my attempt at this.

const wae = require("web-audio-engine");
const mp3decoder = require("lame");
const { promisify } = require("util");
const Decode = promisify(mp3decoder.Decoder);

wae.decoder.set("mp3", Decode);
wae.decoder.set("m4a", Decode);

const fs = require("fs");
const AudioContext = require("web-audio-engine").RenderingAudioContext;
const context = new AudioContext();
const audioData = fs.readFileSync("c7.wav.mp3");

context.decodeAudioData(audioData).then((audioBuffer) => {
  console.log(audioBuffer);
});

You can downloaded said file here. http://www.multiplayerpiano.com/mp3/c7.wav.mp3 Why is this CONSTANTLY returning format unknown?

FireController1847 commented 6 years ago

This is still an issue, the reasoning behind why I closed it is a seperate issue entirely.

mreinstein commented 6 years ago

I'm having the same problem. Can someone explain how to use other decoders besides the built-in wav support?