https://github.com/membraneframework/membrane_raw_audio_parser_plugin
Membrane element for parsing raw audio
https://github.com/membraneframework/membrane_raw_audio_parser_plugin
Last synced: over 1 year ago
JSON representation
Membrane element for parsing raw audio
- Host: GitHub
- URL: https://github.com/membraneframework/membrane_raw_audio_parser_plugin
- Owner: membraneframework
- License: apache-2.0
- Created: 2023-05-22T09:53:22.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T15:16:15.000Z (over 2 years ago)
- Last Synced: 2025-04-10T00:39:02.600Z (over 1 year ago)
- Language: Elixir
- Homepage:
- Size: 387 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Membrane Raw Audio Parser Plugin
[](https://hex.pm/packages/membrane_raw_audio_parser_plugin)
[](https://hexdocs.pm/membrane_raw_audio_parser_plugin)
[](https://circleci.com/gh/membraneframework/membrane_raw_audio_parser_plugin)
Plugin providing element for parsing raw audio.
It will ensure that buffers contain full samples and can overwrite timestamps additionally.
It is part of [Membrane Multimedia Framework](https://membraneframework.org).
## Installation
The package can be installed by adding `membrane_raw_audio_parser_plugin ` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:membrane_raw_audio_parser_plugin, "~> 0.4.0"}
]
end
```
## Usage
In this example, two audio sources from the internet are mixed and then passed to the player in real-time.
To link the audio source to LiveMixer each buffer has to have pts.
Source 1 is delayed by 5 seconds from source 2.
```elixir
defmodule Mixing.Pipeline do
use Membrane.Pipeline
@impl true
def handle_init(_ctx, _options) do
spec = [
child({:source, 1}, %Membrane.Hackney.Source{
location:
"https://raw.githubusercontent.com/membraneframework/static/gh-pages/samples/beep-s16le-48kHz-stereo.raw",
hackney_opts: [follow_redirect: true]
})
|> child({:parser, 1}, %Membrane.RawAudioParser{
stream_format: %Membrane.RawAudio{
channels: 2,
sample_format: :s16le,
sample_rate: 48_000
},
overwrite_pts?: true,
pts_offset: Membrane.Time.seconds(5)
})
|> get_child(:mixer),
child({:source, 2}, %Membrane.Hackney.Source{
location:
"https://raw.githubusercontent.com/membraneframework/static/gh-pages/samples/beep-s16le-48kHz-stereo.raw",
hackney_opts: [follow_redirect: true]
})
|> child({:parser, 2}, %Membrane.RawAudioParser{
stream_format: %Membrane.RawAudio{
channels: 2,
sample_format: :s16le,
sample_rate: 48_000
},
overwrite_pts?: true
})
|> get_child(:mixer),
child(:mixer, Membrane.LiveAudioMixer)
|> child(:player, Membrane.PortAudio.Sink)
]
{[spec: spec], %{}}
end
end
```
## Copyright and License
Copyright 2023, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane)
[](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane)
Licensed under the [Apache License, Version 2.0](LICENSE)