https://github.com/membraneframework/membrane_wav_plugin
Plugin providing elements handling audio in WAV file format.
https://github.com/membraneframework/membrane_wav_plugin
Last synced: about 1 year ago
JSON representation
Plugin providing elements handling audio in WAV file format.
- Host: GitHub
- URL: https://github.com/membraneframework/membrane_wav_plugin
- Owner: membraneframework
- License: apache-2.0
- Created: 2021-07-23T11:22:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T15:11:05.000Z (about 2 years ago)
- Last Synced: 2025-03-21T22:33:41.075Z (about 1 year ago)
- Language: Elixir
- Homepage:
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Membrane WAV Plugin
[](https://hex.pm/packages/membrane_wav_plugin)
[](https://hexdocs.pm/membrane_wav_plugin)
[](https://circleci.com/gh/membraneframework/membrane_wav_plugin)
Plugin providing elements handling audio in WAV file format.
It is part of [Membrane Multimedia Framework](https://membraneframework.org).
## Installation
The package can be installed by adding `membrane_wav_plugin` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:membrane_wav_plugin, "~> 0.10.1"}
]
end
```
## Parser
The Parser requires a WAV file on the input and provides a raw audio in uncompressed, PCM format on
the output.
Parsing steps:
- Reading WAV header
- Extracting audio metadata and sending it through a pad to the next element
- Sending only audio samples to the next elements
It can parse only uncompressed audio.
## Serializer
The Serializer adds WAV header to the raw audio in uncompressed, PCM format.
### Warning
The Serializer creates header with invalid blocks which depend on the file size. You can bypass this
using `Membrane.File.Sink` to save the file or fixing the header afterwards with `Membrane.WAV.Postprocessing`
if you need to use any other sink.
## Sample usage
```elixir
defmodule Mixing.Pipeline do
use Membrane.Pipeline
@impl true
def handle_init(_ctx, _opts) do
spec = child(:file_src, %Membrane.File.Source{location: "/tmp/input.wav"})
|> child(:parser, Membrane.WAV.Parser)
|> child(:converter, %Membrane.FFmpeg.SWResample.Converter{
input_stream_format: %Membrane.RawAudio{channels: 1, sample_rate: 16_000, sample_format: :s16le},
output_stream_format: %Membrane.RawAudio{channels: 2, sample_rate: 48_000, sample_format: :s16le}
})
|> child(:serializer, Membrane.WAV.Serializer)
|> child(:file_sink, %Membrane.File.Sink{location: "/tmp/output.wav"})
{[spec: spec], %{}}
end
end
```
## Copyright and License
Copyright 2021, [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)