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

Overview

waveform Build Status GoDoc

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

Issues
  • waveform.go: Refactored if block which calculates scaling factor in New.

    waveform.go: Refactored if block which calculates scaling factor in New.

    Just thought I'd make a slight change. it's idiomatic to have a switch statement in this situation where there are multiple if statements, especially since only one variable is involved. I also made sure tests passed before submitting this pull request.

    Since the resuting code that could be executed on each condition is only one line, I didn't think to place parentheses over the single statements, but let me know if that's what you prefer and I'll make the changes accordingly.

    opened by Xercoy 3
  • Use

    Use "functional options" pattern instead of config structs

    This will provide a much more simple interface, reduce the need to merge in default options, etc etc.

    http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis

    enhancement 
    opened by mdlayher 1
  • Add waveform generation from []float64

    Add waveform generation from []float64

    Since []float64 is computed from reading samples anyway, allow direct generation by inputting []float64. Also add the option to retrieve the values used to compute a new waveform from a io.Reader, so that the same waveform can be quickly regenerated.

    enhancement 
    opened by mdlayher 1
  • If possible, implement `io` interfaces

    If possible, implement `io` interfaces

    If possible, allow images to be generated, encoded, and directly streamed using io interfaces. This would enable images to be sent via HTTP as they are generated, etc.

    enhancement 
    opened by mdlayher 1
  • Figure out a way to generate fixed-width images

    Figure out a way to generate fixed-width images

    Right now, image width is completely dependent on stream duration. In the future, it would be nice to be able to specify that the output image should be a certain width.

    enhancement 
    opened by mdlayher 1
  • Compute method returns unknown format

    Compute method returns unknown format

    Hi, I'm trying to get []float64 from Compute() method of Waveform, but it returns an error of "audio: unknown format", is there anything that I did wrong?

    myAgi := agi.New()
    myAgi.Init(nil)
    
    fd, err := syscall.Open("/dev/fd/3", syscall.O_RDWR, 0755)  // open file descriptor
    if err != nil {
    	myAgi.Verbose(err)
    	return
    }
    
    buf := make([]byte, 1024)
    
    for {
    	n, err := syscall.Read(fd, buf)  // read streaming audio
    	if n > 0 {
    		br := bytes.NewReader(buf[:n])
    
    		wav, err := waveform.New(br)
    		if err != nil {
    			myAgi.Verbose(err)
    		}
    
    		value, err := wav.Compute()
    		if err != nil {
    			myAgi.Verbose(err)  // got an error here
    		}
    
    		// futher proccesing with value
    	}
    
    	if err != nil {
    		myAgi.Verbose(err)
    		return
    	}
    } 
    
    opened by andrewyang17 0
  • Reformat Markdown files

    Reformat Markdown files

    General changes:

    • Consistent line breaks after 80 characters
    • Heading levels (# for title and ## for sections)

    LICENSE.md:

    • Replace (C) with copyright symbol

    README.md:

    • Badges aren't part of the title anymore
    • Small fixes (MIT Licensed to MIT licensed and show's to shows)
    • Specify language for code snippets
    opened by vulpivia 0
  • panic: EOF

    panic: EOF

    Hi,

    I'm using the latest commit of waveform: 6b28917edfbacd50bff4d58f951cf80499c952c4 and Go 1.11 on 64-bit Arch Linux.

    After building waveform and copying test.wav to the cmd/waveform directory:

    $ ls -al
    .rw-r----- 1,0k afr 14 sep.  11:36 README.md
    .rw-r-----  47M afr 14 sep.  11:40 test.wav
    .rwxr-x--- 3,0M afr 14 sep.  11:36 waveform*
    .rw-r----- 4,8k afr 14 sep.  11:36 waveform.go
    .rw-r-----    0 afr 14 sep.  11:40 waveform.png
    $ file test.wav
    test.wav: RIFF (little-endian) data, WAVE audio
    

    When attempting to create a .png image, I get an error message:

    $ cat test.wav | ./waveform -x 5 -y 2 > waveform.png
    panic: EOF
    
    goroutine 1 [running]:
    main.main()
            /home/afr/clones/waveform/cmd/waveform/waveform.go:127 +0xc9b
    

    I tried with several different .wav files.

    Line 127 in waveform.go is here.

    opened by xyproto 1
  • something wrong with vertical scaling

    something wrong with vertical scaling

    this;

    ./waveform.a -resolution 1000 < wavTones.com.unregistred.sin_10Hz_-12dBFS_1s.wav > temp.png

    (wav file from here; http://www.wavtones.com/functiongenerator.php github wont let me add wav files, but these both produce correct waveforms in audacity.)

    produces this;

    temp

    which is too big, -12db is 1/4 full scale.

    and this, which is just full scale;

    ./waveform.a -resolution 1000 < wavTones.com.unregistred.sin_10Hz_0dBFS_1s.wav > temp.png

    produces this? (completely white png)

    temp

    opened by splace 0
  • unlimited memory usage

    unlimited memory usage

    when i generate with this;

    img, err := waveform.Generate(out,waveform.Resolution(8000),bColor,fColor)

    with a wave file with 8k samples per second, its fine, using 6MB memory in 0.01sec, but

    img, err := waveform.Generate(out,waveform.Resolution(10000),bColor,fColor)

    (ie when resolution slightly higher than the sample rate, )

    i had to kill the process at 6GB mem usage.

    opened by splace 0
Owner
Matt Layher
Software Engineer. Go, Linux, and open source software enthusiast. On and ever upward.
Matt Layher
Local-audio - Web walking audio tour platform proof-of-concept

Goal: Proof of concept for a Web Audio walk platform Data retention dynamdo db "time to live" expires in 1 day from creation of record set in add.go s

Kai Hendry 3 Jan 9, 2022
GAAD (Go Advanced Audio Decoder)

GAAD (Go Advanced Audio Decoder) Package currently provides AAC parsing capabilities. This package performs a full parse of AAC-LC and HE-AACv1 bitstr

null 98 May 7, 2022
Go tools for audio processing & creation ?

GoAudio ? GoAudio is an audio processing library, currently supporting WAVE files, although some tools such as the synth and breakpoints are encoding

Dylan Meeus 221 May 7, 2022
Mini audio library

malgo Go bindings for miniaudio library. Requires cgo but does not require linking to anything on the Windows/macOS and it links only -ldl on Linux/BS

Milan Nikolic 171 May 7, 2022
Sequence-based Go-native audio mixer for music apps

Mix https://github.com/go-mix/mix Sequence-based Go-native audio mixer for music apps See demo/demo.go: package main import ( "fmt" "os" "time"

null 154 Apr 11, 2022
Go bindings for the PortAudio audio I/O library

portaudio This package provides an interface to the PortAudio audio I/O library. See the package documentation for details. To build this package you

Gordon Klaus 503 May 6, 2022
CLI audio player written in go.

A very minimal CLI audio player.

Dave Hulihan 42 Apr 8, 2022
alto is a program built for audio management.

alto, a music organizer alto is a program built for audio management. It's purpose is to provide the user the means to create a path construct to move

null 20 Apr 5, 2022
Terrible Audio Downloader

Terrible Audio Downloader This is just a small go project I did for myself, to manage my audio library to get away from spotify. All it does is downlo

null 0 Oct 30, 2021
Audio visualizer in Go

demo_audio_visualizer Simple audio visualizer in Go Used libraries: raylib-go go-mp3 oto go-dsp To disable the additional console window on Windows OS

Miretz 1 Mar 8, 2022
Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed.

arp Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed. Portions of this code are taken from the Go standard library. The

Matt Layher 286 May 18, 2022
Package dhcp6 implements a DHCPv6 server, as described in RFC 3315. MIT Licensed.

dhcp6 Package dhcp6 implements a DHCPv6 server, as described in IETF RFC 3315. MIT Licensed. At this time, the API is not stable, and may change over

Matt Layher 74 May 8, 2022
Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed.

ethernet Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed. For more in

Matt Layher 240 Mar 12, 2022
Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed.

raw Package raw enables reading and writing data at the device driver level for a network interface. MIT Licensed. For more information about using ra

Matt Layher 422 May 11, 2022
Package socket provides a low-level network connection type which integrates with Go's runtime network poller to provide asynchronous I/O and deadline support. MIT Licensed.

socket Package socket provides a low-level network connection type which integrates with Go's runtime network poller to provide asynchronous I/O and d

Matt Layher 41 May 9, 2022
pure go, cross-platform, MIT-licensed ui toolkit for developers

duit - developer ui toolkit WARNING: this library is work in progress. backwards incompatible changes will be made. details duit is a pure go (*), cro

Mechiel Lukkien 847 May 14, 2022
Package flac provides access to FLAC (Free Lossless Audio Codec) streams.

flac This package provides access to FLAC (Free Lossless Audio Codec) streams. Documentation Documentation provided by GoDoc. flac: provides access to

null 208 May 14, 2022
ready-to-use RTSP / RTMP server and proxy that allows to read, publish and proxy video and audio streams

rtsp-simple-server is a simple, ready-to-use and zero-dependency RTSP / RTMP server and proxy, a software that allows users to publish, read and proxy live video and audio streams. RTSP is a specification that describes how to perform these operations with the help of a server, that is contacted by both publishers and readers and relays the publisher's streams to the readers.

Alessandro Ros 3k May 9, 2022
Local-audio - Web walking audio tour platform proof-of-concept

Goal: Proof of concept for a Web Audio walk platform Data retention dynamdo db "time to live" expires in 1 day from creation of record set in add.go s

Kai Hendry 3 Jan 9, 2022
CLI tool and library for generating a Software Bill of Materials from container images and filesystems

A CLI tool and Go library for generating a Software Bill of Materials (SBOM) from container images and filesystems. Exceptional for vulnerability dete

Anchore, Inc. 2.5k May 18, 2022
One-stop shop for english-translated licensed hentai manga and doujins, beat your meat in peace, without any bullshit and drama attached to it.

koushoku Source code of site [redacted] for those who are willing to run their own instance. How it serve and index the archives Archives and its file

rs 21 May 10, 2022
CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed.

CoreRAD CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed. To get started with

Matt Layher 114 May 16, 2022
🔍 Go tool for LSB steganography, capable of hiding any file within an image.

stegify Overview stegify is a simple command line tool capable of fully transparent hiding any file within an image or set of images. This technique i

Dimitar Petrov 1k May 9, 2022
EarlyBird is a sensitive data detection tool capable of scanning source code repositories for clear text password violations, PII, outdated cryptography methods, key files and more.

EarlyBird is a sensitive data detection tool capable of scanning source code repositories for clear text password violations, PII, outdated cryptograp

American Express 485 May 11, 2022
MenuStart plugin to nwg-panel, also capable of working standalone

nwg-menu This code provides the MenuStart plugin to nwg-panel. It also may be used standalone, however, with a little help from command line arguments

Piotr Miller 25 May 2, 2022
jacobin - A more than minimal JVM written in Go and capable of running Java 11 bytecode.

This overview gives the background on this project, including its aspirations and the features that it supports. The remaining pages discuss the basics of JVM operation and, where applicable, how Jacobin implements the various steps, noting any items that would be of particular interest to JVM cognoscenti.

Andrew Binstock 30 May 9, 2022
A tiny Go library + client for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos.

A tiny Go library + client (command line Youtube video downloader) for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos. If ffmpeg is available, client can extract MP3 audio from downloaded video files.

Kunal Diwan 3 Apr 30, 2022
A tool capable of flashing a D-Link DIR-882 (no IE required!)

dir882-flasher One problem with the D-Link DIR-882 is that you can only upload firmware using Internet Explorer. IE is going away, and I don't use win

Johan Sundin 0 Jan 9, 2022
GoServe - A simple http server capable of serving resources and pages

goServe a simple http server capable of serving resources and pages. disclaimer

Lorenzo 2 Feb 2, 2022