README

Note

GoDoc Coverage

A model of a musical note.

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

Musical Note on Wikipedia

Credit

Charney Kaye

XJ Music

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NameOf

func NameOf(text string) (Class, Octave)

    NameOf a note will return its Class and Octave

    Types

    type AdjSymbol

    type AdjSymbol int

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

      const (
      	No AdjSymbol = iota
      	Sharp
      	Flat
      )

      func AdjSymbolBegin

      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

        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

          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

            func ClassNamed(text string) Class

              ClassNamed returns a pitch Class

              func RootAndRemaining

              func RootAndRemaining(name string) (Class, string)

                Parse all forms using Regexp's against a string

                func (Class) Diff

                func (this Class) Diff(targetPitch Class) int

                  Diff to another pitch Class calculated in +/- semitones

                  func (Class) Step

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

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

                    func (Class) String

                    func (from Class) String(with AdjSymbol) string

                      String of the note, expressed with Sharps or Flats

                      type Note

                      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

                        func Named(text string) (n *Note)

                          Named note returns a Note model

                          func OfClass

                          func OfClass(class Class) (n *Note)

                            OfClass pitch returns a Note model

                            type Octave

                            type Octave int

                              Octave models a musical octave

                              func OctaveOf

                              func OctaveOf(text string) Octave

                                Octave of text returns a new Octave