Documentation ¶
Overview ¶
Package mscx parses MuseScore 3 `*.mscx` or `*.mscz` files into Go structs.
Index ¶
- type ArticulationElement
- type BarLine
- type BarLineSpan
- type Bracket
- type CallbackFn
- type Channel
- type Chord
- type Clef
- type Controller
- type DefaultClef
- type DistOffset
- type Drum
- type Dynamic
- type EndSpanner
- type HairPin
- type ImageElement
- type ImageSize
- type Instrument
- type KeySig
- type LayerTag
- type LayoutBreak
- type Location
- type Lyrics
- type Measure
- type MetaTag
- type MuseScore
- type NextPrev
- type Note
- type Page
- type PageLayout
- type PageList
- type PageMargins
- type Part
- type PartStaff
- type Program
- type Rest
- type Score
- type ScoreStaff
- type ScoreZip
- type Segment
- type Slur
- type Spanner
- type StaffSmall
- type StaffText
- type StaffType
- type StringData
- type Style
- type StyleEnum
- type SynthVals
- type Synthesizer
- type System
- type Tempo
- type TextElement
- type TextPos
- type Tick
- type TimeSig
- type UnhandledError
- type VBox
- type Val
- type Voice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticulationElement ¶
type ArticulationElement struct { Name string `xml:"name,attr,omitempty"` Velocity string `xml:"velocity"` GateTime string `xml:"gateTime"` }
ArticulationElement represents the XML data of the same name.
type BarLineSpan ¶
type BarLineSpan int
func (BarLineSpan) MarshalXML ¶
func (b BarLineSpan) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error
type Bracket ¶
type Bracket struct { Type int `xml:"type,attr"` Span int `xml:"span,attr"` Col string `xml:"col,attr,omitempty"` }
Bracket represents the XML data of the same name.
func (*Bracket) MarshalXML ¶
type CallbackFn ¶
CallbackFn is an optional function that will be called with each file entry found in the ZIP.
type Channel ¶
type Channel struct { Name string `xml:"name,attr"` ChannelElements []any // Controller []*Controller `xml:"controller"` // Program Program `xml:"program"` Synti string `xml:"synti"` Mute int `xml:"mute,omitempty"` }
Channel represents the XML data of the same name.
func (*Channel) MarshalXML ¶
func (*Channel) UnmarshalXML ¶
Implements encoding.xml.Unmarshaler interface
type Clef ¶
type Clef struct { Staff string `xml:"staff,attr,omitempty"` ConcertClefType string `xml:"concertClefType,omitempty"` TransposingClefType string `xml:"transposingClefType,omitempty"` Text string `xml:",chardata"` }
Clef represents the XML data of the same name.
type Controller ¶
func (*Controller) MarshalXML ¶
func (c *Controller) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error
type DefaultClef ¶
type DefaultClef struct { Type string // One of: "", "Concert", "Transposing" Value string `xml:",chardata"` }
func (*DefaultClef) MarshalXML ¶
func (d *DefaultClef) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error
type DistOffset ¶
type DistOffset float64
func (DistOffset) MarshalXML ¶
func (d DistOffset) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error
type EndSpanner ¶
type EndSpanner struct {
ID int `xml:"id,attr"`
}
type HairPin ¶
type HairPin struct { ID int `xml:"id,attr"` Subtype string `xml:"subtype"` VeloChange int `xml:"veloChange,omitempty"` Segment *Segment `xml:"Segment"` BeginText *TextElement `xml:"beginText"` ContinueText *TextElement `xml:"continueText"` }
type ImageElement ¶
type Instrument ¶
type Instrument struct { LongName string `xml:"longName,omitempty"` ShortName string `xml:"shortName,omitempty"` TrackName string `xml:"trackName"` MinPitchP string `xml:"minPitchP,omitempty"` MaxPitchP string `xml:"maxPitchP,omitempty"` MinPitchA string `xml:"minPitchA,omitempty"` MaxPitchA string `xml:"maxPitchA,omitempty"` TransposeDiatonic string `xml:"transposeDiatonic,omitempty"` TransposeChromatic string `xml:"transposeChromatic,omitempty"` InstrumentID string `xml:"instrumentId"` UseDrumset int `xml:"useDrumset,omitempty"` Drum []*Drum `xml:"Drum"` Clef *Clef `xml:"clef"` StringData *StringData `xml:"StringData"` Articulation []*ArticulationElement `xml:"Articulation"` Channel []*Channel `xml:"Channel"` }
Instrument represents the XML data of the same name.
type LayoutBreak ¶
type LayoutBreak struct {
Subtype string `xml:"subtype"`
}
type Measure ¶
type Measure struct { Len string `xml:"len,attr,omitempty"` Number int `xml:"number,attr,omitempty"` Irregular int `xml:"irregular,omitempty"` Voice []*Voice `xml:"voice"` StartRepeat string `xml:"startRepeat,omitempty"` EndRepeat string `xml:"endRepeat,omitempty"` // older versions KeySig *KeySig `xml:"KeySig"` TimeSig *TimeSig `xml:"TimeSig"` Tempo *Tempo `xml:"Tempo"` TimedElements []any }
Measure represents the XML data of the same name.
func (*Measure) MarshalXML ¶
Implements encoding.xml.Marshaler interface
func (*Measure) UnmarshalXML ¶
Implements encoding.xml.Unmarshaler interface
type MuseScore ¶
type MuseScore struct { Version string `xml:"version,attr"` ProgramVersion string `xml:"programVersion"` ProgramRevision string `xml:"programRevision"` Score Score `xml:"Score"` }
MuseScore represents MuseScore 3 data in XML.
type PageLayout ¶
type PageLayout struct { PageHeight float64 `xml:"page-height"` PageWidth float64 `xml:"page-width"` PageMargins []*PageMargins `xml:"page-margins"` }
type PageMargins ¶
type Part ¶
type Part struct { Staff []*PartStaff `xml:"Staff"` Show string `xml:"show,omitempty"` TrackName string `xml:"trackName"` Instrument *Instrument `xml:"Instrument"` }
Part represents the XML data of the same name.
type PartStaff ¶
type PartStaff struct { ID string `xml:"id,attr"` StaffType StaffType `xml:"StaffType"` StaffElements []any }
PartStaff represents the XML data of the same name.
func (*PartStaff) MarshalXML ¶
func (*PartStaff) UnmarshalXML ¶
Implements encoding.xml.Unmarshaler interface
type Program ¶
type Program struct {
Value string `xml:"value,attr"`
}
Program represents the XML data of the same name.
func (Program) MarshalXML ¶
type Score ¶
type Score struct { LayerTag LayerTag `xml:"LayerTag"` CurrentLayer int `xml:"currentLayer"` Synthesizer *Synthesizer `xml:"Synthesizer"` Division int `xml:"Division"` Style *Style `xml:"Style"` ShowInvisible int `xml:"showInvisible"` ShowUnprintable int `xml:"showUnprintable"` ShowFrames int `xml:"showFrames"` ShowMargins int `xml:"showMargins"` MetaTags []*MetaTag `xml:"metaTag"` PageList *PageList `xml:"PageList"` Part []*Part `xml:"Part"` Staffs []*ScoreStaff `xml:"Staff"` }
Score represents the XML data of the same name.
type ScoreStaff ¶
type ScoreStaff struct { ID string `xml:"id,attr"` VBox *VBox `xml:"VBox"` Measure []*Measure `xml:"Measure"` }
ScoreStaff represents the XML data of the same name.
type ScoreZip ¶
type ScoreZip struct { // MetaInf MuseScore MuseScore `xml:"museScore"` }
ScoreZip represents a MuseScore 3 score in `mscz` (zip'd) format.
func New ¶
func New(buf []byte, callback CallbackFn) (*ScoreZip, error)
New reads `mscx` or `mscz` data and returns the resulting parsed score.
func NewFromFile ¶
func NewFromFile(filename string, callback CallbackFn) (*ScoreZip, error)
NewFromFile reads a `*.mscx` or `*.mscz` file and returns the resulting parsed score.
type StaffSmall ¶
type StaffSmall int
func (StaffSmall) MarshalXML ¶
func (s StaffSmall) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error
type StaffType ¶
type StaffType struct { Group string `xml:"group,attr"` Name string `xml:"name"` Lines int `xml:"lines,omitempty"` KeySig *int `xml:"keysig,omitempty"` }
StaffType represents the XML data of the same name.
type StringData ¶
type Style ¶
type Style struct { ConcertPitch int `xml:"concertPitch,omitempty"` PageLayout *PageLayout `xml:"page-layout"` PageWidth float64 `xml:"pageWidth,omitempty"` PageHeight float64 `xml:"pageHeight,omitempty"` PagePrintableWidth float64 `xml:"pagePrintableWidth,omitempty"` UseStandardNoteNames int `xml:"useStandardNoteNames,omitempty"` Spatium float64 `xml:"Spatium"` }
Style represents the XML data of the same name.
type Synthesizer ¶
type TextElement ¶
type UnhandledError ¶
func (*UnhandledError) Error ¶
func (u *UnhandledError) Error() string
type VBox ¶
type VBox struct { Height string `xml:"height"` Text []TextElement `xml:"Text"` Image []ImageElement `xml:"Image"` }
type Voice ¶
type Voice struct { KeySig *KeySig `xml:"KeySig"` TimeSig *TimeSig `xml:"TimeSig"` TimedElements []any }
func (*Voice) MarshalXML ¶
Implements encoding.xml.Marshaler interface
func (*Voice) UnmarshalXML ¶
Implements encoding.xml.Unmarshaler interface