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

Integration with Twilio #74

Open
oemd001 opened this issue Dec 10, 2023 · 1 comment
Open

Integration with Twilio #74

oemd001 opened this issue Dec 10, 2023 · 1 comment

Comments

@oemd001
Copy link

oemd001 commented Dec 10, 2023

Hello!
I am currently using Twilio as my method to make phone calls + streaming the voice data to my server.
However, when I tried to convert Twilio's x-mulaw audio format to PCM Linear (as expected from WhisperLive), I don't get any response from WhisperLive. In other words, I know that my GPU is working, I know that the audio data works (I converted the audio to a wav file and listened to it clearly) but I'm not getting any transcription.

I also thought it was worth noting that the audio was a bit quiet--not sure if that could be a source of suspicion?

Here's my code conversion (from x-mulaw to PCM)

audio = base64.b64decode(packet['media']['payload'])
audio = audioop.ulaw2lin(audio, 2)
audio = audioop.ratecv(audio, 2, 1, 8000, 16000, None)[0]
await websocket.send(audio)

Let me know if you'd like me to provide any additional context :)
Thanks for the help in advance!

@arkadiy-telegin
Copy link

same issue:

pcm_bytes = audioop.ulaw2lin(chunk, 2)
        pcm_upsampled, _ = audioop.ratecv(pcm_bytes, 2, 1, 8000, 16000, None)
        pcm_array = np.frombuffer(pcm_bytes, dtype=np.int16)
        pcm_float32 = pcm_array.astype(np.float32) / 32768.0
        to_buffer = pcm_float32.tobytes()

Can't get this to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants