beatboxer

package
v0.0.0-...-c6c79d5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 10 Imported by: 0

README

Developing Beatboxer Programs

This document describes development of "programs" for the Beatboxer.

Quick Start

From the root of this repo:

go run cmd/beatboxer_noleds.go

Optional web renderer:

open http://localhost:8080

The Beatboxer's 16x4 grid of buttons is emulated via your keyboard. The first 8x4 keys are bound to:

  • 1 .. 8
  • q .. i
  • a .. k
  • z .. ,

The shift key modifies the above to act on the second set of 8x4 keys.

Note all indexes in code are 0-based. Button 0x0 is 1, 15x3 is shift + ,.

Pressing button 15x1 (shift + i) 5 times will switch programs.

Adding a Program

  1. Add a new file under programs

  2. Implement the Program interface, as defined in program.go. This interface supports the following:

    • Input
      • New: initialize state, kicks off long-running processes, returns new handle
      • Amplitude: receive amplitude, [0..1]
      • Keyboard: receive button presses
      • Close: stops all processes, frees resources
    • Output
      • Play: play audio files
      • Render: render LEDs
      • Yield: yield back to the harness
  3. Add your new module to ../cmd/beatboxer_noleds.go.

TODO

  • update LED rendering code for harness environment
  • consider buffered channels, drop when channels fills

Documentation

Index

Constants

View Source
const (
	MIN_MAX_VOL = 0.1

	SMOOTHING_FAST = 0.9
	SMOOTHING_SLOW = 0.99
)
View Source
const (
	SWITCH_COUNT = 5
)

Variables

View Source
var (
	MAX_SMOOTHING = math.Pow(0.999, 1.0/100)
)

Functions

This section is empty.

Types

type Amplitude

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

func InitAmplitude

func InitAmplitude() *Amplitude

func (*Amplitude) Close

func (a *Amplitude) Close()

func (*Amplitude) Level

func (a *Amplitude) Level() <-chan float64

func (*Amplitude) Run

func (a *Amplitude) Run()

type Harness

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

func InitHarness

func InitHarness(
	renderers []render.Renderer,
	kb *keyboard.Keyboard,
) *Harness

func (*Harness) Register

func (h *Harness) Register(program Program)

func (*Harness) Run

func (h *Harness) Run()

type Program

type Program interface {
	New(wavDurs map[string]time.Duration) Program

	// input
	Amplitude() chan<- float64
	Keyboard() chan<- bbox.Coord
	Close() chan<- struct{}

	// output
	Play() <-chan string
	Render() <-chan render.State
	Yield() <-chan struct{}
}

Program defines the interface all Beatboxer programs must satisfy

Directories

Path Synopsis
programs
led
web

Jump to

Keyboard shortcuts

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