music-theory.v0: gopkg.in/music-theory.v0/note Index | Files

package note

import "gopkg.in/music-theory.v0/note"

Note has an adjustment symbol (Sharp or Flat) to render the "accidental notes for a given name (e.g. of a chord, scale or key)

In music, a pitch class is a set of all pitches that are a whole number of octaves apart, e.g., the pitch class C consists of the Cs in all octaves.

A Note is used to represent the relative duration and pitch of a sound.

A Note is used to represent the relative duration and pitch of a sound.

https://en.wikipedia.org/wiki/Musical_note

Credit

Charney Kaye <hi@charneykaye.com> https://charneykaye.com

XJ Music https://xj.io

A perfect octave is the interval between one musical pitch and another with half or double its frequency.

Note can be the Root of a Chord, Key or Scale.

Index

Package Files

adjsymbol.go class.go diff.go note.go octave.go root.go

func NameOf Uses

func NameOf(text string) (Class, Octave)

NameOf a note will return its Class and Octave

type AdjSymbol Uses

type AdjSymbol int

Expression of the "accidental notes" as either Sharps or Flats

const (
    No  AdjSymbol = iota
    Sharp
    Flat
)

func AdjSymbolBegin Uses

func AdjSymbolBegin(name string) AdjSymbol

AdjSymbolBegin the adjustment symbol (Sharp or Flat) that begins a given name (e.g. the Root of a chord, scale or key)

func AdjSymbolOf Uses

func AdjSymbolOf(name string) AdjSymbol

AdjSymbolOf the adjustment symbol (Sharp or Flat) for a given name (e.g. of a chord, scale or key)

type Class Uses

type Class int

Class of pitch for a note (across all octaves)

const (
    Nil Class = iota
    C
    Cs
    D
    Ds
    E
    F
    Fs
    G
    Gs
    A
    As
    B
)

func ClassNamed Uses

func ClassNamed(text string) Class

ClassNamed returns a pitch Class

func RootAndRemaining Uses

func RootAndRemaining(name string) (Class, string)

Parse all forms using Regexp's against a string

func (Class) Diff Uses

func (this Class) Diff(targetPitch Class) int

Diff to another pitch Class calculated in +/- semitones

func (Class) Step Uses

func (from Class) Step(inc int) (Class, Octave)

Step from a class to another class, +/- semitones, +/- octave

func (Class) String Uses

func (from Class) String(with AdjSymbol) string

String of the note, expressed with Sharps or Flats

type Note Uses

type Note struct {
    Class  Class  // Class of pitch
    Octave Octave // Octave #

    Performer string  // Can be used to sort out whose Notes are whose
    Position  float64 // Can be used to represent time within the composition
    Duration  float64 // Can be used to represent time of note duration
    Code      string  // Can be used to store any custom values
}

Note models a musical note

func Named Uses

func Named(text string) (n *Note)

Named note returns a Note model

func OfClass Uses

func OfClass(class Class) (n *Note)

OfClass pitch returns a Note model

type Octave Uses

type Octave int

Octave models a musical octave

func OctaveOf Uses

func OctaveOf(text string) Octave

Octave of text returns a new Octave

Package note imports 4 packages (graph) and is imported by 12 packages. Updated 2019-11-19. Refresh now. Tools for package owners.