https://github.com/FMotalleb/nu_plugin_audio_hook
A nushell plugin to make and play sounds
https://github.com/FMotalleb/nu_plugin_audio_hook
audio-player beeper id3-reader noise-generator nushell-plugin
Last synced: 13 days ago
JSON representation
A nushell plugin to make and play sounds
- Host: GitHub
- URL: https://github.com/FMotalleb/nu_plugin_audio_hook
- Owner: FMotalleb
- License: mit
- Created: 2023-11-06T20:59:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-16T20:18:06.000Z (6 months ago)
- Last Synced: 2024-10-30T00:36:28.169Z (6 months ago)
- Topics: audio-player, beeper, id3-reader, noise-generator, nushell-plugin
- Language: Rust
- Homepage:
- Size: 122 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nu - nu_plugin_audio_hook
README
# ๐ต nu_plugin_audio_hook
A [Nushell](https://www.nushell.sh/) plugin for generating and playing sounds. Supports beeping, tone generation, metadata manipulation, and playback for multiple audio formats.
---
## โจ Features
- **`sound beep`** โ Play a simple beep sound.
- **`sound make`** โ Generate a noise with a given frequency and duration.
- **`sound meta`** โ Retrieve metadata (duration, artist, album, etc.) from an audio file.
- **`sound meta set`** โ Modify ID3 metadata frames in an audio file. [More about ID3](https://docs.puddletag.net/source/id3.html).
- **`sound play`** โ Play an audio file. By default, supports FLAC, WAV, MP3, and OGG. Use the `all-decoders` feature to enable AAC and MP4 playback.---
## ๐ Usage
### **Generate a simple noise**
```bash
sound make 1000 200ms
```### **Generate a noise sequence**
```bash
[ 300.0, 500.0, 1000.0, 400.0, 600.0 ] | each { |it| sound make $it 150ms }
```### **Play an audio file (first 3 seconds only)**
```bash
sound play audio.mp3 -d 3sec
```### **Retrieve metadata from an audio file**
```bash
sound meta audio.mp4
```Example Output:
```
โญโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ duration โ 4min 5sec 551ms 20ยตs 408ns โ
โ artist โ SINGER โ
โ title โ TITLE โ
โ album โ ALBUM โ
โ album_artist โ SINGER โ
โ track_no โ 1 โ
โ total_tracks โ 1 โ
โฐโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
```### **Modify ID3 metadata (change the artist tag)**
```bash
sound meta set audio.mp3 -k TPE1 -v new-artist
```### **Play an MP3 file using its metadata duration**
```bash
sound meta audio.mp4 | sound play audio.mp3 -d $in.duration
```### **List all available ID3 frame names**
```bash
sound meta list
```---
## ๐ง Installation
### ๐ Recommended: Using [nupm](https://github.com/nushell/nupm)
```bash
git clone https://github.com/FMotalleb/nu_plugin_audio_hook.git
nupm install --path nu_plugin_audio_hook -f
```### ๐ ๏ธ Manual Compilation
```bash
git clone https://github.com/FMotalleb/nu_plugin_audio_hook.git
cd nu_plugin_audio_hook
cargo build -r --features=all-decoders
plugin add target/release/nu_plugin_audio_hook
```### ๐ฆ Install via Cargo (using git)
```bash
cargo install --git https://github.com/FMotalleb/nu_plugin_audio_hook.git --features=all-decoders
plugin add ~/.cargo/bin/nu_plugin_audio_hook
```### ๐ฆ Install via Cargo (crates.io) _Not Recommended_
>
> _Since I live in Iran and crates.io often restricts package updates, the version there might be outdated._```bash
cargo install nu_plugin_audio_hook --features=all-decoders
plugin add ~/.cargo/bin/nu_plugin_audio_hook
```---
## ๐ Supported Features
You can enable specific features when compiling or installing:
- **`full`** โ Enables all features below.
- **`flac`** (default) โ FLAC format support.
- **`vorbis`** (default) โ OGG Vorbis support.
- **`wav`** (default) โ WAV format support.
- **`minimp3`** โ MP3 decoding.
- **`symphonia-all`** โ Enables all Symphonia-based decoders:
- `symphonia-aac` โ AAC decoding.
- `symphonia-flac` โ FLAC decoding.
- `symphonia-isomp4` โ MP4 (audio) decoding.
- `symphonia-mp3` (default) โ MP3 decoding.
- `symphonia-vorbis` โ OGG Vorbis decoding.
- `symphonia-wav` โ WAV decoding.