Giter VIP home page Giter VIP logo

Comments (5)

danielweidman avatar danielweidman commented on June 20, 2024

Hi @VRciF
I know this is very old, but did you ever find a solution? I am in pretty much the same situation.
Thanks

from lamejs.

geeee avatar geeee commented on June 20, 2024

There is no easy solution to splicing multiple mp3 files seamlessly. Why it's hard and how to do it is described in the LAME Technical FAQ linked above.
But it sounds like you are trying to fix the wrong thing. Instead of transferring multiple mp3 files try to send chunks of a single mp3 stream.

from lamejs.

danielweidman avatar danielweidman commented on June 20, 2024

Hi @geeee,
Thanks so much for your response and your contributions to this very useful resource. I have read the FAQ, and to me it sounds like the issue concerns the spread of data across multiple frames. I should clarify that my plan for splicing together these multiple files was to just convert each to WAV format (16 bit linear PCM) and then to splice those files together. I figured that if I knew the padding added onto each MP3 file, I would be able to just ignore the WAV data (after conversion) that fell into the padding. My thinking was that the conversion to WAV (server side, by a different library) would handle to combination of data from multiple frames. Is there something else I am missing that would cause this not to work? My main purpose for converting the data into MP3 format in the browser is just to decrease bandwidth usage.

I'll look into the process of sending an MP3 stream in chunks, since I'm sure that would be the more elegant solution. I didn't consider this as strongly before because I was just going for something quick and dirty that I could easily work into the framework of an existing project where WAV data is put in base64 and then sent over a websocket at a certain interval. I thought it might be quick to just throw in the extra step of converting the WAV data to MP3 before the base64 encoding so I could make minimal changes. Seems like it might not be that simple though I guess.

from lamejs.

geeee avatar geeee commented on June 20, 2024

Padding at the start is going to be 576 samples. Padding at the end will vary. At the very least it's going to be 288 samples. And more silence to make the total number of samples exact multiple of 1152. And on top of that decoders might also contribute by adding even more silence.
Try to generate one PCM chunk with values of all of the samples set to maximum. After encoding/decoding this chunk it's going to be ease to tell an exact number of samples added to the start and the end of the chunk.

from lamejs.

danielweidman avatar danielweidman commented on June 20, 2024

Thanks very much, I will try that!

from lamejs.

Related Issues (20)

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.