An open API service indexing awesome lists of open source software.

https://github.com/deepankarm/pcm-to-opus


https://github.com/deepankarm/pcm-to-opus

Last synced: 12 months ago
JSON representation

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).