waveform

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-waveform

go-waveform

Golang project for the purpose of practicing, understanding golang and audio file format.

Usage

Requirements

Go 1.11 (Go Modules)

Cli

Generate waveform image via CLI

GO111MODULE=on make
./bin/go-waveform -t dark -r 1000 -f png example/violin.wav

open example/violin-L.png
open example/violin-R.png
Import as package

Import as package,

import "github.com/cettoana/go-waveform"

and decode wav audio file

w := waveform.DecodeWav(wavFileBytes)
fmt.Println(w.BitsPerSample)

data, _ := w.GetData()

if stereoData, ok := data.(*waveform.StereoData); ok {
  fmt.Println(stereoData.RSample)
  fmt.Println(stereoData.LSample)
} else if monoData, ok := data.(*waveform.MonoData); ok {
  fmt.Println(monoData.Sample)
}
Todo
  • More wav file details
  • Converter
  • Raw Waveform
  • Waveform image customization
  • Test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OutputWaveformImageMp3

func OutputWaveformImageMp3(data *mp3.Decoder, option *Option) (r io.Reader, err error)

OutputWaveformImageMp3 outputs waveform image from *mp3.Decoder.

func OutputWaveformImageWav

func OutputWaveformImageWav(data *wav.Decoder, option *Option) (r io.Reader, err error)

OutputWaveformImageWav outputs waveform image from *wav.Decoder.

Types

type Option

type Option struct {
	// Resolution specifies the resolution of the
	// Required.
	Resolution int
	// Width specifies the width of the resulting image.
	// Default: Resolution * 5
	Width int
	// Height specifies the height of the resulting image.
	// Default: 540
	Height int
	// Background specifies the color of the background.
	// Default: none (transparent)
	Background color.Color
	// Color specifies the color of the waveform.
	// Default: color.Black
	Color color.Color
}

Option image option

Jump to

Keyboard shortcuts

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