- Notifications
You must be signed in to change notification settings - Fork1
Common APIs used by Noice Web applications to play sounds.
License
trynoice/january
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Common APIs used by Noice Web applications for gapless audio playback.
We use Web Audio APIs to support gapless playback. SinceBaseAudioContext.decodeAudioData()
method doesn't allow decoding small chunks of an audio file individually, weserve them from the server side as split segments alongside an index file. Theindex file holds references to all chunks corresponding to an audio file. On theclient side, we read the index file first. We then read and decode individualchunks and precisely queue them to an audio context for playback.
The following is an example of an index file.
0000.mp30001.mp30002.mp3
- Firefox 107: Sometimes, a slight jitter is audible during playbackwhen one chunk finishes and the next starts.
- Google Chrome 108: Works flawlessly.
- Microsoft Edge 107: Works flawlessly.
Using FFMPEG'ssegment
orstream_segment
muxersto split and encode the audio files causes gaps during playback. Instead, we use-ss
and-to
flags to encode individual segments of an audio file one by one.
ffmpeg -y -i source.wav -c mp3 -ab 320k -ac 2 -ar 44100 -ss 0 -to 10 0000.mp3
About
Common APIs used by Noice Web applications to play sounds.