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

Noise / random buffer reading at the beginning of mp3 files. #349

Open
troisiemetype opened this issue Dec 15, 2020 · 0 comments
Open

Noise / random buffer reading at the beginning of mp3 files. #349

troisiemetype opened this issue Dec 15, 2020 · 0 comments

Comments

@troisiemetype
Copy link
Contributor

Hello.

Working on my mp3 player, I experience some problems with file playing : when I start playing a mp3 file, I've got a variable length noise before the song starts. The duration of this noise matches the time it takes for the AudioFileSourceID3 object to parse the tags in a given file. (On startup my player will check all exisiting files against its database, to extract tags from every audio files)
The noise seems to simply be whatever data was previously in the output buffer. On first play I've got silence, on the followings I've got something matching the level of the song that was previously played.
It is a problem because some files contains large ID3 tags, with embed jpeg for album covers.

So, I understand that the AudioGeneratorMP3 and AudioFileSourceID3 objects are made to work hand in hand, but would it be possible to have an option to skip ID3 tags when reading mp3 ? Maybe by testing for tag existence at the beginning of the file, in the begin() method of AudioGeneratorMP3, and skipping as many bytes as given by the file tag header ?

I could give it a try, but I don't know what would be the best way or place to do it.
In AudioGeneratorMP3.begin(), between the buffers allocation and the first calls to the underlying MAD lib ?
Or in AudioFileSourceID3.read(), forcing the parsing to be skipped once the header size is known, then handling to the caller ?

Any advice is welcome !

@troisiemetype troisiemetype changed the title Noise / random buffer at the beginning of mp3 files. Noise / random buffer reading at the beginning of mp3 files. Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant