https://github.com/itzmanish/avmuxer
Library for audio Multiplexing and Transcoding in go
https://github.com/itzmanish/avmuxer
audio audio-processing g711 golang multiplexing opus pcm pcma pcmu transcoding
Last synced: 3 months ago
JSON representation
Library for audio Multiplexing and Transcoding in go
- Host: GitHub
- URL: https://github.com/itzmanish/avmuxer
- Owner: itzmanish
- License: mit
- Created: 2024-08-04T14:27:33.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-15T15:49:16.000Z (8 months ago)
- Last Synced: 2025-01-10T20:48:53.934Z (4 months ago)
- Topics: audio, audio-processing, g711, golang, multiplexing, opus, pcm, pcma, pcmu, transcoding
- Language: Go
- Homepage:
- Size: 7.26 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Audio Multiplexer And Transcoder
The `avmuxer` package provides functionality to manage multiple Opus and G711 audio streams, decode Opus/G711 data to PCM, interleave and multiplex PCM data, and re-encode the multiplexed PCM data back to Opus format. This is useful for real-time audio mixing, VoIP applications, and multi-participant audio conferencing systems.
## Features
- **Manage Multiple Audio Streams**: Add and handle multiple Opus and G711 audio streams, each with its own decoder and buffer.
- **Decode Opus/G711 Data**: Convert Opus-encoded data to PCM (Pulse Code Modulation) format.
- **Multiplex Audio Streams**: Interleave and combine PCM data from multiple streams into a single output.
- **Encode PCM to Opus/G711**: Convert the combined PCM data back into Opus/G711-encoded format for efficient transmission or storage.# Usage
## Creating an Multiplexer
```go
multiplexer, err := NewMultiplexer()
if err != nil {
log.Fatalf("Failed to create multiplexer: %v", err)
}
```## Reading PCM data
```go
pcmData := multiplexer.ReadPCM16()
if len(pcmData) == 0 {
log.Println("No PCM data available")
}
```## Reading Opus Data
```go
buf:=make([]byte, 2048)
n, err := multiplexer.Read(buf)
if err != nil {
log.Fatalf("Failed to read Opus bytes: %v", err)
}
if n == 0 {
log.Println("No Opus data available")
}
```# Testing
A comprehensive test suite is provided to ensure the end-to-end functionality of the multiplexer, including decoding, multiplexing, and re-encoding audio data. To run the tests, use the following command:
```sh
go test ./...
```# License
This project is licensed under the MIT License. See the LICENSE file for details.
# Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.