Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Player ¶
type Player struct { // BPM is the beats per minute BPM int // Beat counts the number of 1/64 beats Tick int // Key stores the key of the song (TODO: Add in key-signature constraints) Key string // Piano is the piano that does the playing, the MIDI keyboard Piano *piano.Piano // MusicFuture is a map of future chords to play MusicFuture *music.Music // MusicHistory is a map of all the previous notes played MusicHistory *music.Music MusicHistoryFile string // AI stores the AI being used AI *ai2.AI // BeatsOfSilence waits this number of beats before asking // the AI for an improvisation BeatsOfSilence int // HighPassFilter only uses notes above a certain level // for computing last note HighPassFilter int // KeysCurrentlyPressed keeps track of whether a key is down (should be 0 if no keys are down) KeysCurrentlyPressed int // Listening frequency (to determine tick size) ListeningRateHertz int // Number of ticks per beat TicksPerBeat int // 1/Quantize = shortest possible note Quantize int // flag to allow only manually activation ManualAI bool // UseHostVelocity changes emitted notes to follow the velocity of the host UseHostVelocity bool LastHostPress int IsImprovising bool // contains filtered or unexported fields }
Player is the main structure which facilitates the Piano, and the AI. The Player spawns threads for listening to events on the Piano, and also spawns threads for playing notes on the piano. It also spawns threads for doing the machine learning and using the results.
func (*Player) Emit ¶
Emit will play/stop notes depending on the current beat. This should be run in a separate thread.
func (*Player) Improvisation ¶
func (p *Player) Improvisation()
Improvisation generates an improvisation from the AI and loads into the next beats to be playing
func (*Player) Listen ¶
func (p *Player) Listen()
Listen tells the player to listen to events from the piano MIDI connection. This is meant to be run in a separate thread.