waveform

command module
v0.0.0-...-0b3bfab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 2 Imported by: 0

README

waveform

Build Status Coverage Status GoDoc

Documentation

Go package capable of generating waveform images from audio streams. MIT Licensed.

This library supports any audio streams which the azul3d/engine/audio package is able to decode. At the time of writing, this includes:

  • WAV
  • FLAC

An example binary called waveform is provided which show's the library's usage. Please see cmd/waveform/README.md for details.

Examples

Here are several example images generated using waveform. Enjoy!

Generate a waveform image, and scale it both vertically and horizontally.

$ cat ~/Music/02\ -\ Peace\ Of\ Mind.flac | waveform -x 5 -y 2 > ~/waveform.png

waveform

Apply a foreground and background color, to make things more interesting.

cat ~/Music/02\ -\ Peace\ Of\ Mind.flac | waveform -fg=#FF3300 -bg=#0099CC -x 5 -y 2 > ~/waveform_color.png

waveform_color

Apply an alternate foreground color, draw using a stripe pattern.

cat ~/Music/02\ -\ Peace\ Of\ Mind.flac | waveform -fg=#FF3300 -bg=#0099CC -alt=#FF9933 -fn stripe -x 5 -y 2 > ~/waveform_stripe.png

waveform_stripe

Apply an alternate foreground color, draw using a random fuzz pattern.

cat ~/Music/02\ -\ Peace\ Of\ Mind.flac | waveform -fg=#FF3300 -bg=#0099CC -alt=#FF9933 -fn fuzz -x 5 -y 2 > ~/waveform_fuzz.png

waveform_fuzz

Apply a new set of colors, draw using a gradient pattern.

cat ~/Music/02\ -\ Peace\ Of\ Mind.flac | waveform -fg=#FF0000 -bg=#00FF00 -alt=#0000FF -fn gradient -x 5 -y 2 > ~/waveform_gradient.png

waveform_gradient

Apply a checkerboard color set, draw using a checkerboard pattern.

cat ~/Music/02\ -\ Peace\ Of\ Mind.flac | waveform -fg=#000000 -bg=#222222 -alt=#FFFFFF -fn checker -x 5 -y 2 > ~/waveform_checker.png

waveform_checker

Usage

Pre-install:

$ go mod download
$ go get -u

To run tests, just run:

$ go test -v ./...

To build waveform, just run:

  1. Build
$ go build

The waveform binary is now available in the current directory. You may also wish to run it by following:

$ ./waveform
  1. Install

To install and use waveform, simply run:

$ go install github.com/fwx5618177/waveform/...

The waveform binary is now installed in your $GOPATH. It has several options available for generating waveform images:

$ waveform -h
Usage of waveform:
  -alt="": hex alternate color of output waveform image
  -bg="#FFFFFF": hex background color of output waveform image
  -fg="#000000": hex foreground color of output waveform image
  -fn="solid": function used to color output waveform image [options: fuzz, gradient, solid, stripe]
  -resolution=1: number of times audio is read and drawn per second of audio
  -sharpness=1: sharpening factor used to add curvature to a scaled image
  -x=1: scaling factor for image X-axis
  -y=1: scaling factor for image Y-axis

waveform currently supports both WAV and FLAC audio files. An audio stream must be passed on stdin, and the resulting, PNG-encoded image will be written to stdout. Any errors which occur will be written to stderr.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Command waveform is a simple utility which reads an audio file from stdin, processes it into a waveform image using input flags, and writes a PNG image of the generated waveform to stdout.
Command waveform is a simple utility which reads an audio file from stdin, processes it into a waveform image using input flags, and writes a PNG image of the generated waveform to stdout.
Package waveform is capable of generating waveform images from audio streams.
Package waveform is capable of generating waveform images from audio streams.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL