note

package
v0.0.0-...-441bbdd Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

View Source
const (
	C_1      pitchValue = 0
	Csharp_1 pitchValue = 1
	D_1      pitchValue = 2
	Dsharp_1 pitchValue = 3
	E_1      pitchValue = 4
	F_1      pitchValue = 5
	Fsharp_1 pitchValue = 6
	G_1      pitchValue = 7
	Gsharp_1 pitchValue = 8
	A_1      pitchValue = 9
	Asharp_1 pitchValue = 10
	B_1      pitchValue = 11
	C0       pitchValue = 12
	Csharp0  pitchValue = 13
	D0       pitchValue = 14
	Dsharp0  pitchValue = 15
	E0       pitchValue = 16
	F0       pitchValue = 17
	Fsharp0  pitchValue = 18
	G0       pitchValue = 19
	Gsharp0  pitchValue = 20
	A0       pitchValue = 21
	Asharp0  pitchValue = 22
	B0       pitchValue = 23
	C1       pitchValue = 24
	Csharp1  pitchValue = 25
	D1       pitchValue = 26
	Dsharp1  pitchValue = 27
	E1       pitchValue = 28
	F1       pitchValue = 29
	Fsharp1  pitchValue = 30
	G1       pitchValue = 31
	Gsharp1  pitchValue = 32
	A1       pitchValue = 33
	Asharp1  pitchValue = 34
	B1       pitchValue = 35
	C2       pitchValue = 36
	Csharp2  pitchValue = 37
	D2       pitchValue = 38
	Dsharp2  pitchValue = 39
	E2       pitchValue = 40
	F2       pitchValue = 41
	Fsharp2  pitchValue = 42
	G2       pitchValue = 43
	Gsharp2  pitchValue = 44
	A2       pitchValue = 45
	Asharp2  pitchValue = 46
	B2       pitchValue = 47
	C3       pitchValue = 48
	Csharp3  pitchValue = 49
	D3       pitchValue = 50
	Dsharp3  pitchValue = 51
	E3       pitchValue = 52
	F3       pitchValue = 53
	Fsharp3  pitchValue = 54
	G3       pitchValue = 55
	Gsharp3  pitchValue = 56
	A3       pitchValue = 57
	Asharp3  pitchValue = 58
	B3       pitchValue = 59
	C4       pitchValue = 60
	Csharp4  pitchValue = 61
	D4       pitchValue = 62
	Dsharp4  pitchValue = 63
	E4       pitchValue = 64
	F4       pitchValue = 65
	Fsharp4  pitchValue = 66
	G4       pitchValue = 67
	Gsharp4  pitchValue = 68
	A4       pitchValue = 69
	Asharp4  pitchValue = 70
	B4       pitchValue = 71
	C5       pitchValue = 72
	Csharp5  pitchValue = 73
	D5       pitchValue = 74
	Dsharp5  pitchValue = 75
	E5       pitchValue = 76
	F5       pitchValue = 77
	Fsharp5  pitchValue = 78
	G5       pitchValue = 79
	Gsharp5  pitchValue = 80
	A5       pitchValue = 81
	Asharp5  pitchValue = 82
	B5       pitchValue = 83
	C6       pitchValue = 84
	Csharp6  pitchValue = 85
	D6       pitchValue = 86
	Dsharp6  pitchValue = 87
	E6       pitchValue = 88
	F6       pitchValue = 89
	Fsharp6  pitchValue = 90
	G6       pitchValue = 91
	Gsharp6  pitchValue = 92
	A6       pitchValue = 93
	Asharp6  pitchValue = 94
	B6       pitchValue = 95
	C7       pitchValue = 96
	Csharp7  pitchValue = 97
	D7       pitchValue = 98
	Dsharp7  pitchValue = 99
	E7       pitchValue = 100
	F7       pitchValue = 101
	Fsharp7  pitchValue = 102
	G7       pitchValue = 103
	Gsharp7  pitchValue = 104
	A7       pitchValue = 105
	Asharp7  pitchValue = 106
	B7       pitchValue = 107
	C8       pitchValue = 108
	Csharp8  pitchValue = 109
	D8       pitchValue = 110
	Dsharp8  pitchValue = 111
	E8       pitchValue = 112
	F8       pitchValue = 113
	Fsharp8  pitchValue = 114
	G8       pitchValue = 115
	Gsharp8  pitchValue = 116
	A8       pitchValue = 117
	Asharp8  pitchValue = 118
	B8       pitchValue = 119
	C9       pitchValue = 120
	Csharp9  pitchValue = 121
	D9       pitchValue = 122
	Dsharp9  pitchValue = 123
	E9       pitchValue = 124
	F9       pitchValue = 125
	Fsharp9  pitchValue = 126
	G9       pitchValue = 127
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration float64

Duration is the duration relative to the whole note

const (
	// Double is 𝅜
	Double Duration = 2
	// Whole is 𝅝
	Whole Duration = 1
	// Half is 𝅗𝅥
	Half Duration = 0.5
	// Quarter is ♩
	Quarter Duration = 0.25
	// Eighth is ♪
	Eighth Duration = 0.125
	// Sixteenth is 𝅘𝅥𝅯
	Sixteenth Duration = 0.0625
)

func (Duration) String

func (d Duration) String() string

String returns the musical note symbol

func (Duration) StringRest

func (d Duration) StringRest() string

StringRest returns the rest note symbol

func (Duration) ToSeconds

func (d Duration) ToSeconds(tempoNote Duration, bpm int) time.Duration

ToSeconds returns the note value as time.Duration. tempoNote is the note in the tempo marking, or the _beat_ in _beats per minute_.

type Interval

type Interval = uint8

Interval is the distance between pitches, measured in semitones

const (
	// Semitone is the smallest interval between pitches, a 12th of an octave
	Semitone Interval = 1
	// Tone is 2 semitones
	Tone Interval = 2
	// Octave is the distance between a pitch and another with double frequency
	Octave Interval = 12
)

type Note

type Note struct {
	Pitch
	Duration
}

Note is a musical Pitch and Duration

func NewNote

func NewNote(p Pitch, d Duration) Note

NewNote creates a new musical Note

func NewRest

func NewRest(d Duration) Note

NewRest creates a new rest Note

func (Note) Add

func (n Note) Add(i Interval) Note

Add returns a new Note adding an interval to this note's pitch, making it higher

func (Note) String

func (n Note) String() string

String returns a human readable representation of this note

func (Note) Subtract

func (n Note) Subtract(i Interval) Note

Subtract returns a new Note subtracting an interval to this note's pitch, making it lower

type Pitch

type Pitch interface {
	// String returns a human readable name for this pitch
	String() string
	// Frequency returns the hertz value for this pitch
	Frequency() float64
	// Add returns a new Pitch adding an interval to this pitch, making it higher
	Add(i Interval) Pitch
	// Subtract returns a new Pitch subtracting an interval to this pitch, making it lower
	Subtract(i Interval) Pitch
}

Pitch is an interface for a note musical frequency

Jump to

Keyboard shortcuts

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