Maestro - Midi Player Tool Kit for Unity Version 2.19.0
Loading...
Searching...
No Matches

Experimental - Search a MIDI from a sequence of notes and calculate a score tempo.
. More...

Classes

class  FootPrint
 Contains detailed information about a MIDI footprint. More...

Public Member Functions

void MPTK_Clear ()
 Clear MPTK_MidiLib.
void MPTK_AddOne (string name)
 Add a MIDI to MPTK_MidiLib. Use the exact name defined in Unity resources folder MidiDB without any path or extension.
void MPTK_AddMultiple (string filter=null)
 Add multiple MIDI to MPTK_MidiLib.
List< FootPrintMPTK_Search (List< MPTKEvent > sequence, int countnote=-1, float tempoScore=-1f)
 Search in MPTK_MidiLib from the footprint (or partial footprint) from a sequence of notes.
If notes in the sequence contains duration then a tempo score is given for each MIDI found.
.
FootPrint MPTK_Encode (List< MPTKEvent > sequence)
 Calculate the footprint from the sequence of MPTKEvent. Only noteon in the range defined in the Setting are used.

Public Attributes

List< FootPrintMPTK_MidiLib
 List of MIDI to search for a sequence of notes. MIDI can be added with MPTK_AddOne or MPTK_AddMultiple.
bool Verbose
 For debugging goal ...

Properties

int SettingFirstNote [get, set]
 First note of the footprint range.
int SettingLastNote [get, set]
 Last note of the footprint range.
uint SettingShiftLeft [get, set]
 Shift bit for the footprint builder. Default value = 8. Other value has not been tested.
int SettingCountNote [get, set]
 Number of notes used to calculated the footprint. Default value = 8.

Detailed Description

Experimental - Search a MIDI from a sequence of notes and calculate a score tempo.
.

These capabilities and API could evolve in time or ... disappear!
A footprint is calculated for each MIDI added in MPTK_MidiLib with MPTK_AddOne or MPTK_AddMultiple.
Then MPTK_Search can be used to find a list of MIDI with the same fooprint (or partial footprint) from a sequence of notes (List of MPTKEvent).
If notes in the sequence contains duration then a tempo score is given for each MIDI found.
Limitation: max of 8 first notes are used for calculating the footprint

Version
Maestro Pro
private MPTKFootPrint libFootPrint;
void Awake()
{
libFootPrint = gameObject.AddComponent<MPTKFootPrint>();
}
private void Start()
{
libFootPrint.Verbose = true;
libFootPrint.MPTK_AddMultiple("BACH");
libFootPrint.MPTK_AddOne("_simple-48");
libFootPrint.MPTK_AddOne("_simple-49");
libFootPrint.MPTK_AddOne("_simple-50");
}
private void YourMethod()
{
// .... build a sequence of notes ...
SequenceNotes.Add(new MPTKEvent() {Command = MPTKCommand.NoteOn, Value = value, Duration = duration) });
// .... Find MIDI with this sequence ...
List<MPTKFootPrint.FootPrint> listMidi = libFootPrint.MPTK_Search(SequenceNotes);
if (listMidi.Count > 0)
{
foreach (MPTKFootPrint.FootPrint midiFP in listMidi)
Debug.Log(midiFP.ToString());
}
else { Debug.Log("No MIDI found"); }
}
Experimental - Search a MIDI from a sequence of notes and calculate a score tempo....
Definition MidiFootPrint.cs:53
void MPTK_AddOne(string name)
Add a MIDI to MPTK_MidiLib. Use the exact name defined in Unity resources folder MidiDB without any p...
Definition MidiFootPrint.cs:140
List< FootPrint > MPTK_Search(List< MPTKEvent > sequence, int countnote=-1, float tempoScore=-1f)
Search in MPTK_MidiLib from the footprint (or partial footprint) from a sequence of notes....
Definition MidiFootPrint.cs:182
void MPTK_AddMultiple(string filter=null)
Add multiple MIDI to MPTK_MidiLib.
Definition MidiFootPrint.cs:159
MPTKCommand
MIDI command codes. Defines the action performed by the message: note on/off, patch change,...
Definition MPTKEnum.cs:16

Member Function Documentation

◆ MPTK_AddOne()

void MidiPlayerTK.MPTKFootPrint.MPTK_AddOne ( string name)

Add a MIDI to MPTK_MidiLib. Use the exact name defined in Unity resources folder MidiDB without any path or extension.

Parameters
name

◆ MPTK_Search()

List< FootPrint > MidiPlayerTK.MPTKFootPrint.MPTK_Search ( List< MPTKEvent > sequence,
int countnote = -1,
float tempoScore = -1f )

Search in MPTK_MidiLib from the footprint (or partial footprint) from a sequence of notes.
If notes in the sequence contains duration then a tempo score is given for each MIDI found.
.

Parameters
sequenceSequence of MPTKEvent to search. Only the 8 first notes are used
countnoteNumber of notes to search. The count of notes in sequence must be equal to the count of note of the searched MIDI.
Default= -1, for searching partial match.
tempoScoreOnly MIDI found with a score equal or greater are keep in the resulting list. Default = -1, keep all MIDI regardless the score.
Returns
List of MIDI found. Each FootPrint in list contains the MIDI name and the tempo score between 0 and 1