samirkumardas / pcm-player

A minimalist javascript audio player for PCM streaming audio
Other
294 stars 83 forks source link

open discontinuity #2

Closed xiaozhi1995 closed 5 years ago

xiaozhi1995 commented 5 years ago

The raw file HZ is 44100,I set

var player = new PCMPlayer({
        encoding: '16bitInt',
        channels: 2,
        sampleRate: 44100,
        flushingTime: 2000

but the sound discontinuity,please help.I think analyze data'time is small current video.

start vs current 2.010666666666667 vs 2.010666666666667 duration: 0.54421768707483 pcm-player.min.js:1 start vs current 4 vs 4 duration: 0.7256235827664399 pcm-player.min.js:1 start vs current 6 vs 6 duration: 0.7256235827664399 pcm-player.min.js:1 start vs current 8 vs 8 duration: 0.7256235827664399 pcm-player.min.js:1 start vs current 10 vs 10 duration: 0.7256235827664399 pcm-player.min.js:1 start vs current 12 vs 12 duration: 0.7256235827664399 pcm-player.min.js:1 start vs current 14 vs 14 duration: 0.7256235827664399

samirkumardas commented 5 years ago

Is your data stream continuous? I mean do you get data from server without latency? Can you try increasing flushingTime to 4000?

xiaozhi1995 commented 5 years ago

The data stream iscontinuous。I try 4000,duration is 1.0。But I try convert sampleRate from 44100 to 8000,it success work。Why is the performance?

xiaozhi1995 commented 5 years ago

Can you support real-time playback? I see that flushtime can cause delays

samirkumardas commented 5 years ago

You must adjust flashTime depending on your streaming rate. Try a little flashTime first, say 500, then you can increase it to a bigger value if it played well. Basically the bigger the flashTime, the less the jittering.