Skip to content

A simple library for audio chunking and processing using GStreamer.

Notifications You must be signed in to change notification settings

arun-mani-j/libmars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mars

A simple library for audio chunking and processing using GStreamer.

Getting Started

You need GStreamer for the usage. Meson can be used to build the project.

$ git clone [email protected]:arun-mani-j/libmars.git
$ cd libmars
$ meson setup _build/ # Setup build directory
$ meson compile -C _build/ # Compile the project

MarsChunker

Chunks the incoming audio stream by silence and duration.

Example

Suppose you want to chunk a file in data/sample.wav and save its output in /output directory, then you can use the following command.

$ mkdir -p output # Create the directory if it does not exist
$ _build/examples/chunker -i "data/sample.wav" -o "output/%02d.wav" -m "wavenc"

Pass "mic" to input, if you want to read from the default mic.

By default, the chunking happens if the audio segment size crosses 7 seconds.

Customization

Chunker relies on GStreamer to do all the heavy-lifting. To improve the output, you should try tweaking the properties of removesilence and splitmuxsink elements.

You can do the customization by modifying the properties of MarsChunker.

MarsCallbackSink

A sink that calls a given callback for every buffer it gets. Similarly, it can aggregate the buffers and call them when the stream ends.

Example

The following example prints the number of buffers the sink received.

$ _build/examples/callback-sink -i "data/sample.wav" -m "wavenc"

Pass "mic" to input, if you want to read from the default mic.

Library

You can use libmars.so in your application. See examples/ for a demonstration.

G-I Support

Mars supports GNOME Introspection. So you can use it in all the languages supported by G-I which includes Python, Rust, Vala etc.

See examples/chunker.py for an example.

References

  1. removesilence - GStreamer element to detect and remove silence.
  2. splitmuxsink - GStreamer element to split the files.

About

A simple library for audio chunking and processing using GStreamer.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published