Overview of The MidiEngine 3 API
MidiEngine emphasizes an object-oriented structure using Unreal Engine’s UObject
system. This design enhances the accessibility and manipulability of MIDI data through Blueprints and game code, facilitating dynamic and interactive musical experiences.
Key Components of the Music Session Object Model
The Music Session Object Model in MidiEngine 3 API consists of several interconnected UObject
classes that represent different aspects of a MIDI file. NB: each class is prefixed with “UAx” ,example “UAxMusicSession” Below is a detailed breakdown of each component:
1. MidiNote
- Description: Represents an individual MIDI note.
- Functionality: Stores information such as pitch, velocity, duration, and timing of a single note.
- Usage: Acts as the fundamental building block for creating more complex musical structures.
2. MidiTrack
- Description: A container for multiple
MidiNote
objects. - Functionality: Organizes notes into a coherent sequence, representing a single track within a MIDI file.
- Usage: Facilitates the management of notes, allowing for operations like adding, removing, or modifying notes within a track.
3. MidiPattern
- Description: A collection of
MidiTrack
objects. - Functionality: Groups multiple tracks into a pattern, which can represent a specific section or layer of a song.
- Usage: Enables the organization of complex musical arrangements by managing multiple tracks simultaneously.
4. MidiPattern Clip
- Description: References a specific
MidiPattern
. - Functionality: Acts as a pointer to a
MidiPattern
, allowing for the reuse and arrangement of patterns within a sequence. - Usage: Facilitates the creation of dynamic and reusable musical sections within a music sequence.
5. MusicSequenceTrack
- Description: A container for arranging
MidiPattern Clips
andAudio Clips
. - Functionality: Organizes clips into a sequence, enabling the arrangement of MIDI patterns and audio elements within a music session.
- Usage: Allows developers to structure the flow of a song by sequencing different musical and audio components.
6. MusicSession
- Description: The top-level container that holds multiple
MidiPatterns
,MusicSequenceTracks
, and song arrangements. - Functionality: Manages the overall structure of a musical piece, including different patterns, their arrangements, and sequence tracks within a session.
- Usage: Serves as the central hub for handling entire MIDI compositions, enabling comprehensive control and manipulation of the music session.
Importing MIDI Files
When a MIDI file is imported into MidiEngine 3 API, the following process occurs:
- Creation of MusicSession: A new
MusicSession
object is instantiated to serve as the container for the imported MIDI data. - Reading the MIDI File: The
.midi
file is parsed and converted into aMidiPattern
object. - Organizing Patterns: A
MidiPattern
contains multipleMidiTrack
objects, which in turn containMidiNote
objects representing individual notes..
Advantages of Using MidiEngine 3 API
- Simplified Access: The
UObject
architecture allows for straightforward access and manipulation of MIDI data within Blueprints and game threads. - Modular Structure: The hierarchical object model (MidiNote → MidiTrack → MidiPattern → MusicSession) provides a clear and organized framework for managing complex musical compositions.
- Enhanced Flexibility: Developers can easily read, modify, and interact with MIDI data, enabling dynamic music behavior and integration within interactive environments.