Closed wilsonlmh closed 3 years ago
To explain my concept:
For your reference, the sample rate/accuracy of wavesurfer.js can provide (base on my test) is about 96Hz. It means wavesurfer draw 96 pixels for each second of audio.(This doesn't relative anything to the sound frequency) For:
You can get 65536 levels and 960pixels/second, which detail enough for retina display but only 7MB/hour/channel memory needed.I personally suggest 960Hz/16bit or 960Hz/8bit(sample rate can adjust) will be suitable for this purpose.
@wilsonlmh I this would perform better with a hls audio type source, #1078 let's continue the discussion at that ticket instead.
As @katspaugh said, "We do not control how decoding works", I think split input media into pieces will be a good solution to get rid of crashes while loading big files(And keep the peaks only with much much lower resolution. Or decode/cache on demand). However it's a big challenge and huge workloads. I have no experience on de/remuxing any binary format. I hope somebody can involve together. Below is some research:
Here’s native support audio codecs list: https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
So they are
opus
,vorbis
,mp1/2/3
,aac
andPCM
. If we only deal with these codecs, we need to remux (minimum) 3 types of containers:opus, vorbis -> ogg mp1/2/3, aac -> mp4/m4a PCM -> wav (tested PCM in ogg doesn’t works)
Ref: https://en.wikipedia.org/wiki/Comparison_of_video_container_formats#Audio_formats_supported
Existing muxer(I mean something we can reuse): ogg -> https://github.com/jpemartins/speex.js (demux and mux) mp4/m4a -> https://github.com/videojs/mux.js (demux and mux) wav -> http://webaudiodemos.appspot.com/AudioRecorder/index.html (seems mux only)
Talk me about what you think?