https://github.com/deepankarm/pcm-to-opus
https://github.com/deepankarm/pcm-to-opus
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/deepankarm/pcm-to-opus
- Owner: deepankarm
- Created: 2024-06-26T04:31:05.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T06:30:54.000Z (almost 2 years ago)
- Last Synced: 2025-01-23T16:40:43.049Z (over 1 year ago)
- Language: Go
- Size: 7.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Steps to run this
```bash
go mod tidy
go run cmd/main.go
```
Pass `data/test/ws` to listen to the audio of a PCM file generated by a WebSocket stream from ElevenLabs.
Pass `data/test/post` to listen to the audio of a PCM file generated by a POST request to ElevenLabs.
### Example
```bash
go run cmd/main.go ws://---.livekit.cloud data/test/ws
```
```shell
2024-06-26T11:28:22.874+0530 DEBUG pkg/track.go:41 Connected to room {"room": "dummy-room", "participant": "publisher"}
2024/06/26 11:28:22 "level"=0 "msg"="published track" "name"="publisher-identity" "source"="MICROPHONE" "trackID"="TR_AMFo8vjwj2YJbo"
2024-06-26T11:28:22.888+0530 INFO pkg/track.go:84 Track published {"trackID": "TR_g2SXrYTfEoDD"}
2024/06/26 11:28:22 Listener URL: https://meet.livekit.io/custom?liveKitUrl=...&token=...
2024/06/26 11:28:22 Sleeping for 10 seconds to allow the listener to join before sending the audio files
```
Join the above `Listener URL` in a browser to listen to the audio of the PCM file in a LiveKit room.
### Note
To compare I've created 2 `.wav` files from the PCM files generated by the WebSocket stream and the POST request. They are [ws.wav](./ws.wav) and [post.wav](./post.wav). You can check the script to convert them [here](./to_wave.py).