midilib

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT, MIT Imports: 2 Imported by: 0

README

This internal library contains functions derived from the github.com/afandian/go-midi package of Joe Wass. These functions are in the file "derived.go". The original functions are in the files midi_functions.go and music.go which are copies of the corresponding files from github.com/afandian/go-midi.

The functions in the file "not-derived.go" are not derived from Joe Wass.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearBitU8

func ClearBitU8(n uint8, pos uint8) uint8

ClearBitU8 clears the bit at position pos within n

func IsChannelMessage

func IsChannelMessage(b uint8) bool

IsChannelMessage returns if the given byte is a channel message

func IsStatusByte

func IsStatusByte(b uint8) bool

IsStatusByte returns if the given byte is a status byte

func KeyFromSharpsOrFlats

func KeyFromSharpsOrFlats(sharpsOrFlats int8, mode uint8) uint8

KeyFromSharpsOrFlats Taking a signed number of sharps or flats (positive for sharps, negative for flats) and a mode (0 for major, 1 for minor) decide the key signature.

This is a slightly modified variant of the keySignatureFromSharpsOrFlats function from Joe Wass. See the file music.go for the original.

func MsbLsbSigned

func MsbLsbSigned(n int16) uint16

MsbLsbSigned returns the uint16 for a signed MSB LSB message combination

func MsbLsbUnsigned added in v1.7.5

func MsbLsbUnsigned(n uint16) uint16

takes a 14bit uint and pads it to 16 bit like in the specs for e.g. pitchbend

func ParsePitchWheelVals

func ParsePitchWheelVals(b1 byte, b2 byte) (relative int16, absolute uint16)

ParsePitchWheelVals parses a 14-bit signed value, which becomes a signed int16.

This is a slightly modified variant of the parsePitchWheelValue function from Joe Wass. See the file midi_functions.go for the original.

func ParseStatus

func ParseStatus(b byte) (messageType uint8, messageChannel uint8)

ParseStatus parses the status byte and returns type and channel

This is a slightly modified variant of the readStatusByte function from Joe Wass. See the file midi_functions.go for the original.

func ParseTwoUint7

func ParseTwoUint7(b1, b2 byte) (uint8, uint8)

ParseTwoUint7 parses two 7-bit bit integer stored in two bytes, ignoring the high bit in each.

This is a slightly modified variant of the parseTwoUint7 function from Joe Wass. See the file midi_functions.go for the original.

func ParseUint7

func ParseUint7(b byte) uint8

ParseUint7 parses a 7-bit bit integer from a byte, ignoring the high bit.

This is a slightly modified variant of the parseUint7 function from Joe Wass. See the file midi_functions.go for the original.

func ReadByte

func ReadByte(rd io.Reader) (byte, error)

ReadByte reads a byte from the reader

func ReadNBytes

func ReadNBytes(n int, rd io.Reader) ([]byte, error)

ReadNBytes reads n bytes from the reader

func ReadUint16

func ReadUint16(rd io.Reader) (uint16, error)

ReadUint16 reads a 2-byte 16 bit integer from a Reader. It returns the 16-bit value and an error. This is a slightly modified variant of the parseUint16 function from Joe Wass. See the file midi_functions.go for the original.

func ReadUint24

func ReadUint24(rd io.Reader) (uint32, error)

ReadUint24 parse a 3-byte 24 bit integer from a Reader. It returns the 32-bit value and an error. This is a slightly modified variant of the parseUint24 function from Joe Wass. See the file midi_functions.go for the original.

func ReadUint32

func ReadUint32(rd io.Reader) (uint32, error)

ReadUint32 parse a 4-byte 32 bit integer from a Reader. It returns the 32-bit value and an error. This is a slightly modified variant of the parseUint32 function from Joe Wass. See the file midi_functions.go for the original.

func ReadVarLength

func ReadVarLength(reader io.Reader) (uint32, error)

ReadVarLength reads a variable length value from a Reader. It returns the [up to] 32-bit value and an error. This is a slightly modified variant of the parseVarLength function from Joe Wass. See the file midi_functions.go for the original.

func ReadVarLengthData

func ReadVarLengthData(reader io.Reader) ([]byte, error)

ReadVarLengthData reads data that is prefixed by a varLength that tells the length of the data

This is a slightly modified variant of the parseText function from Joe Wass. See the file midi_functions.go for the original.

Types

This section is empty.

Jump to

Keyboard shortcuts

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