beep

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

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 4 Imported by: 0

README

go-beep-player

编写音谱后调用系统蜂鸣器演奏

演示
package example_test

import (
	"testing"

	"github.com/Drelf2018/go-beep-player"
	"github.com/Drelf2018/go-beep-player/example"
)

func TestHaruhikage(t *testing.T) {
	player := beep.Player{BPM: 95, Major: beep.MajorB}
	player.Play(0, 1, 100, example.Haruhikage)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MajorB = map[int]int{
	1: 1,
	2: 1,
	3: 0,
	4: 1,
	5: 1,
	6: 1,
	7: 0,
}

Functions

This section is empty.

Types

type Note

type Note struct {
	// [1, 7]
	Key int
	// [-4, 4]
	Tone int
	// [-2, 2]
	Sharp   int
	Natural bool
	// {1, 2, 4, 8, 16, ...}
	Fraction int
	// [0, +∞)
	Dot  int
	Hold *Note
}

func (*Note) Duration

func (n *Note) Duration() float64

func (*Note) KeyNum

func (n *Note) KeyNum() int

type Player

type Player struct {
	Major      map[int]int
	BPM        int
	Channel    int
	Instrument int
	Velocity   int
	Period     int
	Notes      []Note
	// contains filtered or unexported fields
}

func (*Player) Call

func (p *Player) Call(a uintptr)

func (*Player) Play

func (p *Player) Play()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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