spectrogram

package module
v0.0.0-...-fdeaec0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

README

Spectrogram

Taking an audio signal (wav) and converting it into a spectrogram. Written in Go programming language.

example

Install

git clone https://github.com/xigh/spectrogram

Example

python3 sine_wav.py && ../../xigh/spectrogram/spectrogram -hamming -hideavg -bins=256 sine.wav

example

Usage

./spectrogram [options] input_file.wav

-preemp float64
    set pre-emphasis parameter (0 means no pre-emp)
-rectangle
    disable hamming window support
-BG0 string
    set background color 0 (default "000000")
-BG1 string
    set background color 1 (default "333")
-BG2 string
    set background color 2 (default "447744")
-FG0 string
    set forground color 0 (default "0972a2")
-FG1 string
    set forground color 1 (default "6b5f7e")
-RUL string
    set rulers color (default "a0b0c0")
-bins int
    set freq bins (default 512)
-dft
    use dft instead of fft
-height int
    set height (default 450)
-hideavg
    hide average
-hiderulers
    hide rulers
-length int
    set number of samples [0 means all]
-offset int
    sey begin of samples
-out string
    set output filename (default "out.png")
-ratio float
    set ratio (default 0.8)
-width int
    set width (default 2048)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drawfft

func Drawfft(img draw.Image, samples []float64, rate, bins uint32, RECTANGLE, DFT, MAG, LOG10 bool)

func Drawwav

func Drawwav(img draw.Image, samples []float64, BG1, FG0, FG1, RUL string, HIDERULERS, HIDEAVG bool, RATIO float64)

func SavePng

func SavePng(img *Image128, fileName string) error

Types

type Color128

type Color128 struct {
	R, G, B, A uint32
}

func NewColor128

func NewColor128(r, g, b, a uint32) Color128

func ParseColor

func ParseColor(text string) Color128

func (Color128) RGBA

func (c Color128) RGBA() (r, g, b, a uint32)

type Gradient

type Gradient []Color128

func New

func New() Gradient

func (*Gradient) Append

func (grad *Gradient) Append(c Color128)

func (Gradient) ColorAt

func (grad Gradient) ColorAt(i float64) Color128

func (Gradient) Index

func (grad Gradient) Index(i float64) (int, float64)

type Image128

type Image128 struct {
	// contains filtered or unexported fields
}

func NewImage128

func NewImage128(bounds image.Rectangle) *Image128

func (*Image128) At

func (img *Image128) At(x int, y int) color.Color

func (*Image128) Bounds

func (img *Image128) Bounds() image.Rectangle

func (*Image128) ColorModel

func (img *Image128) ColorModel() color.Model

func (*Image128) Set

func (img *Image128) Set(x int, y int, c color.Color)

func (*Image128) Stats

func (img *Image128) Stats() (int, int)

func (*Image128) Sub

func (img *Image128) Sub(bounds image.Rectangle) *SubImage128

type PngImage

type PngImage struct {
	// contains filtered or unexported fields
}

func (*PngImage) At

func (p *PngImage) At(x int, y int) color.Color

func (*PngImage) Bounds

func (p *PngImage) Bounds() image.Rectangle

func (*PngImage) ColorModel

func (p *PngImage) ColorModel() color.Model

type SubImage128

type SubImage128 struct {
	// contains filtered or unexported fields
}

func (*SubImage128) At

func (sub *SubImage128) At(x int, y int) color.Color

func (*SubImage128) Bounds

func (sub *SubImage128) Bounds() image.Rectangle

func (*SubImage128) ColorModel

func (sub *SubImage128) ColorModel() color.Model

func (*SubImage128) Set

func (sub *SubImage128) Set(x int, y int, c color.Color)

Jump to

Keyboard shortcuts

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