Web Audio API - record to MP3?

前端 未结 6 1092
感情败类
感情败类 2021-02-01 06:06

I am asking because I couldn\'t find the answer anywhere. I have successfully implemented RecorderJS in order to record microphone input in JS. However, the recorded file is WAV

6条回答
  •  梦如初夏
    2021-02-01 06:46

    There's a library written in pure javascript, called lamejs. To encode mp3s from raw audio. It is much faster than emscripten compile of libmp3lame. https://github.com/zhuker/lamejs

    Example usage:

    lib = new lamejs();
    mp3encoder = new lib.Mp3Encoder(1, 44100, 128); //mono 44.1khz encode to 128kbps
    samples = new Int16Array(44100); //one second of silence
    var mp3 = mp3encoder.encodeBuffer(samples); //encode mp3
    

提交回复
热议问题