Documentation ¶
Overview ¶
Renders various data from a channel of [-1, 1] onto screen.
Package util provides a collection of utilities for dealing with Sounds, generating them, displaying them, calculating their samples etc...
Renders various data from a channel of [-1, 1] onto screen.
Index ¶
- Constants
- func CacheSamples(sound s.Sound) []float64
- func GuitarChord(chord string) s.Sound
- func MidiToHz(midiNote int) float64
- func MidiToSound(midiNote int) s.Sound
- func ParseChord(chord string, base uint) s.Sound
- func ParseNotesToChord(notes string, base uint) s.Sound
- type ComplexLine
- type Event
- type Line
- type Screen
- type SpectrogramScreen
Constants ¶
const (
LOAD_LIMIT = int(s.CyclesPerSecond * 10 * 60) /* 10 minutes */
)
Variables ¶
This section is empty.
Functions ¶
func CacheSamples ¶
func GuitarChord ¶
GuitarChord converts a standard guitar representation (e.g. "2x0232") into the sound of those notes being played, assuming standard tuning.
func MidiToSound ¶
MidiToSound converts a midi note into a sound that plays its pitch.
func ParseChord ¶
ParseChord converts a chord string (e.g. "G#sus4") and base octave into a Sound that contains the notes in the chord.
Types ¶
type ComplexLine ¶
type ComplexLine struct { Values <-chan []complex128 R float32 G float32 B float32 // contains filtered or unexported fields }
Line is the samples channel for the line, plus their color.
type Line ¶
type Line struct { Values <-chan float64 R float32 G float32 B float32 // contains filtered or unexported fields }
Line is the samples channel for the line, plus their color.
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
Screen is an on-screen opengl window that renders the channel.
func (*Screen) RenderLinesWithEvents ¶
RenderLinesWithEvents renders multiple channels of samples to screen, and draws events.
type SpectrogramScreen ¶
type SpectrogramScreen struct {
// contains filtered or unexported fields
}
Screen is an on-screen opengl window that renders the channel.
func NewSpectrogramScreen ¶
func NewSpectrogramScreen(width int, height int, bpo int) *SpectrogramScreen
NewScreen creates a new output screen of a given size and sample density.
func (*SpectrogramScreen) Render ¶
func (s *SpectrogramScreen) Render(values <-chan []complex128, sampleRate int)
Render starts rendering a channel of waves samples to screen.
func (*SpectrogramScreen) RenderLineWithEvents ¶
func (s *SpectrogramScreen) RenderLineWithEvents(line *ComplexLine, events <-chan interface{}, sampleRate int)
RenderLinesWithEvents renders multiple channels of samples to screen, and draws events.