# README
go-scala
A pure Go library to parse Scala SCL and KBM files to support microtunings
A reimplementation, in Go, of the Surge team's C++ tuning-library. This is mostly a copy of that library, but with some name changes and refactoring to make the library idiomatic Go.
This version of the Go library (tagged v1.2.0) corresponds to the release_1.1.0 tag of the source C++ library
Usage
$ go get github.com/chinenual/go-scala
Example
An example of using the API:
import (
"github.com/chinenual/go-scala"
)
...
s,_ := scala.ScaleFromSCLFile("./my-scale.scl")
k,_ := scala.KeyboardMappingFromKBMFile("./my-mapping.kbm")
t,_ := scala.TuningFromSCLAndKBM(s,k)
fmt.Printf("The frequency of C4 and A4 are %v and %v\n",
t.FrequencyForMidiNote(60)
t.FrequencyForMidiNote(69))
Building and testing the library:
$ go get -v -t -d ./...
$ go build
$ go test
# Functions
KeyboardMappingFromKBMFile returns a KeyboardMapping from a KBM file name.
KeyboardMappingFromKBMStream returns a KeyboardMapping from a KBM input stream.
KeyboardMappingFromKBMString returns a KeyboardMapping from a KBM data in memory.
KeyboardMappingStandard is the standard key mapping.
KeyboardMappingStartScaleOnAndTuneNoteTo generates a KBM where scaleStart is the note 0 of the scale, where midiNote is the tuned note, and where feq is the frequency.
KeyboardMappingTuneA69To creates a KeyboardMapping which keeps the midi note 69 (A4) set to a constant frequency, given.
KeyboardMappingTuneNoteTo creates a KeyboardMapping which keeps the midi note given is set to a constant frequency, given.
ScaleEvenDivisionOfSpanByM provides a scale referred to as "ED2-17" or "ED3-24" by dividing the Span into M points.
ScaleEvenTemperment12NoteScale provides a utility scale which is the "standard tuning" scale.
ScaleFromSCLFile returns a Scale from the SCL File in fname.
ScaleFromSCLStream returns a Scale from the SCL input stream.
ScaleFromSCLString returns a scale from the SCL file contents in memory.
TuningEvenStandard constructs a tuning with even temperament and standard mapping.
TuningFromKBM constructs a tuning for a particular mapping (12 Tone even temperament).
TuningFromSCL constructs a tuning for a particular scale (standard key mapping).
TuningFromSCLAndKBM constructs a tuning for a particular scale and mapping.
# Structs
KeyboardMapping represents a KBM file.
The Scale is the representation of the SCL file.
A Tone is a single entry in an SCL file.
# Interfaces
The Tuning type is the primary place where you will interact with this library.
# Type aliases
No description provided by the author