https://github.com/pabsan-0/gst-awkward
Gstreamer audio application that plays music when mic is silent
https://github.com/pabsan-0/gst-awkward
alsa audio-processing gnuplot gstreamer repos-gstreamer
Last synced: about 1 year ago
JSON representation
Gstreamer audio application that plays music when mic is silent
- Host: GitHub
- URL: https://github.com/pabsan-0/gst-awkward
- Owner: pabsan-0
- Created: 2023-04-21T19:14:15.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-23T15:48:30.000Z (about 3 years ago)
- Last Synced: 2025-01-23T16:53:03.325Z (over 1 year ago)
- Topics: alsa, audio-processing, gnuplot, gstreamer, repos-gstreamer
- Language: C
- Homepage:
- Size: 349 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gst-awkward
A small gstreamer application that plays music, but shuts up whenever someone speaks. Quit awkward silences today!
## Usage
- Match dependencies:
- Gstreamer
- Alsa-utils [optional]: `apt install alsa-utils`
- Gnuplot [optional]: `apt install gnuplot`
- Clone this repo `git clone https://github.com/pabsan-0/gst-awkward`
- Set your device configuration in the `src/main.c` `#define`s
- Build the tool: `make`
- Run the app with `./main.o`
## The audio essentials
- Audio loopback `sudo modprobe snd-aloop`
- List mic-like devices `arecord -l`
- List speaker-like devices `aplay -l`
- Hardware spec: `hw:x,y,z` `hw:card,device,subdevice`
- `x`: Card
- `y`: Device
- `z`: Subdevice
- Gstreamer elements:
- `alsasink`, `alsasrc`: Advanced Linux Sound Architecture
- `audioconvert`
- `volume`, `level`: for setting/reading levels
- `decodebin`, `autovideosink`, `autovideosrc`
## Snippets:
```
# Playing audio file in a loop
gst-launch-1.0 multifilesrc loop=1 location=media/short.mp3 ! decodebin ! audioconvert ! alsasink
# Introducing delay
gst-launch-1.0 audiotestsrc ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=1000000000000 ! autoaudiosink
# Mic to speaker with native delay (fractions of a sec)
gst-launch-1.0 alsasrc device="hw:3,0,0" ! alsasink
# Mic to speaker fancier
gst-launch-1.0 alsasrc device="hw:3,0,0" ! volume volume=1.5 ! level message=TRUE ! alsasink
```
## Links
- Linux audio 101 small tutorial [TheSalarKhan/Linux-Audio-Loopback-Device](https://github.com/TheSalarKhan/Linux-Audio-Loopback-Device)
- On introducing delay on a pipeline https://stackoverflow.com/a/17218113
- Level plugin example https://github.com/krad-radio/gstreamer-plugins-good-krad/blob/master/tests/examples/level/level-example.c
## Acknowledgements
- Song bit from The Engagement by Silent Partner: https://www.youtube.com/watch?v=_TcAQEufZcU