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

Audio is streched #20

Open
jongsun89 opened this issue Mar 31, 2023 · 2 comments
Open

Audio is streched #20

jongsun89 opened this issue Mar 31, 2023 · 2 comments

Comments

@jongsun89
Copy link

jongsun89 commented Mar 31, 2023

Hi @samirkumardas .
I'm trying to play audio with real-time created pcm data.
It comes slice by slice through websocket and use feed method on every websocket.onmessage.
It works cool , but sometimes or after long time sound is streched(delayed?).
I don't know the mechanism of this, but I assumed that pcm data is stacked in a queue while previous pcm data is processed(decoded or played).
but, i want to play the latest pcm data even if previous pcm is played to sync as real-time.
any idea to treat this ? like stop current played audio and play the latest every time when buffer is filled with the latest pcm

    encoding: '16bitInt',
    channels: 1,
    sampleRate: 8000,
    flushingTime: 1000
@Aroxed
Copy link

Aroxed commented Feb 19, 2024

@jongsun89 Have you found a solution?
By the way, what is your frequency of feeding? I mean how many times per second you pass the data?
I observed two options: 40 instances of 200 bytes and 50 instances of 160 bytes.

@t104360088
Copy link

Hi, I have the same issue, I found that when I continued to send audio bytes, the sound at the receiving end would start to be delayed. The longer I continued to send, the longer the delay. I checked the source code and found that startTime was much higher than currentTime. The difference between the two was 0.001 seconds when I first started playing. , but the longer the playback time, the difference will be more than 5 seconds. But I don't know why currentTime is slower than startTime

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

3 participants