MusIT

Easily, Quickly Add MIDI Music To Your Unity App

MIDI player from Unity

Quick description

The Maestro Midi Player Tool Kit enables easy integration of MIDI music into Unity applications using the extensive collection of publicly available MIDI files online or create your own music from ground up with a seamless interaction between music and gameplay.

The SoundFont-based synthesizer makes thousands of instruments and sounds readily available often at no cost.

Watch this video to learn how to add MIDI music to your app in just three clicks:

Add MIDI music in 3 clicks and a few seconds

MIDI Gives you Full Control on the Music:

  • Easy interaction between the music and your gameplay:
    • Your app can capture every musical event in real time, including notes played, instruments selected, effects and tempo…
    • Make changes to your scene in relation to these musical events.
    • Adjust the music to match the events occurring in your scene.
    • The possibilities are endless!
  • Your application can do real-time music changes:
    • Change tempo without affecting the pitch
    • Adapt in real-time music speed to game speed.
    • Mute or change instrument on fly.
    • Jump to other places in the music with a 100% smooth transition.
    • Music looping is easy.
    • Apply all transformations you want on the music.
  • Start creating your music from scratch:
    • Easy to use dedicated API for creating and playing music in real-time.
    • Simple yet efficient MIDI Editor is available within the Unity Editor.
    • Chord builder.

If you need more information about MIDI, you could read this short tutorial: MIDI Tutorial.

Want to start directly the journey? Go to these pages:

Main functionalities

  • No external components such as a Synthesizer or MIDI device are required to play music!
  • The main functions do not require coding as dedicated inspectors define all necessary elements directly in the Unity editor.
  • Maestro adheres to the full SoundFont standard and MIDI norms, based on a rewrite of the legendary FluidSynth synthesizer.
  • It includes many exciting demonstrations to help you get started!
  • Two versions are available; begin with the Free version and upgrade to the Pro version if you love it!
  • The fully documented (Web) version is freely available on the website before purchase.

Features All Versions:

  • Add as many MIDI prefabs to your scene as you like.
  • Play MIDI files from the web or your own compositions as often as you like.
  • A SoundFont with 270 instruments and 864 samples from GeneralUser_GS_SoftSynth_v144 is included. It’s a free SoundFont, see the schristiancollins page.
  • MIDI parameters: loop, transpose, speed, position, quantization, auto start, auto pause, stat, verbose …
  • Enable or disable channels, change instruments on the fly.
  • Synchronise MIDI events with your game or application.
  • Synthesizer parameters: spatialisation, rate, buffer size, interpolation level, apply pan, LFOs, modulator, release time, auto buffer, device performance, stat, verbose
  • Play & pause MIDI automatically based on distance.
  • Create generated notes from your algorithm, see our demos.
  • Karaoke capabilities (via script).
  • Spatialisation capabilities, ready for your virtual reality project.
  • Extended API for more complex interactions.

Features Pro Version:

  • MIDI editor integrated into the Unity editor.
  • MIDI file analyser to optimise the samples required by your MIDI set.
  • Midi External Player plays MIDI directly from a website or your desktop.
  • Midi File Writer: Compose your music, save it as MIDI or play it directly.
  • Midi Input/Output: reads and writes MIDI events from a MIDI device (keyboard, …) connected to your computer (Windows and MacOS only).
  • Midi Spatializer: spatialise a Midi file by channel/instrument in a 3D environment.
  • Midi List Player: automatically plays a list of MIDI files. It has the ability to play parts of a MIDI (from / to in ticks, seconds or time) with overlap between the Midis being played.
  • Warp Dynamic sound effects processing: change parameters for low-pass filter, reverb, chorus in real time. Use standard Unity effect or dedicated effect.
  • Chord creation wizard: dynamically created from parameters such as degree, scale, arpeggio or from the 85 chords in the library.
  • Wizard for creating scales from the 86 scales in the library: Major, Minor, Blues, Pentatonic, Enigmatic, Oriental, Bitonal, …
  • Integration ready with other packages from the Asset Store. No scripting C# or JS is mandatory to add Midi music to your application!
  • Look here for a full comparison between pro and free.

SoundFont

A synthesizer based on SoundFont is indeed a fantastic solution to access hundreds of sounds from real instruments as well as synthetic sounds, often for free.

What’s more, there are hundreds of SoundFonts available on the web! Whether they’re free or not, they come in various styles (general, classic, jazz, electro, hip hop, etc.), and different qualities and sizes. The possibilities are vast, almost infinite!

And if that’s not enough, there are tools available to create your own! You can find more information here. Please note that SoundFont® is a registered trademark of E-mu Systems, Inc.

Prefab & Class

Maestro proposes Prefab and Class to meet your needs.

  • MidiFilePlayer, MidiStreamPlayer, MidiListPlayer, MidiExternalPlay, MidiInReader, MidiSpatializer,
  • MPTKEvent , MPTKChannel, MPTKWriter, MidiKeyboard, … 

See detailed information here.

Demos

Demos have several roles: regression tests for the Maestro team, feature demonstrations, scripting examples, … you like demos and we like making demos!

Demos available for Free :

Free Maestro MPTK demos available
  • TestMidiFilePlayer: a very simple example with only one MidiFilePlayer prefab to play MIDI music. An example of using MPTK to play MIDI music without programming. There is no script !
  • TestMidiFilePlayerScripting: how to integrate MPTK by script in your application. Example of a a Karaoke like application. Use of the MPTK API with a few lines of code.
  • TestMidiLoader: a simple MIDI loader able to display the MIDI events.
  • TestMidiFilePlayerMulti: four MidiFilePlayer prefabs are defined on a scene with the camera moving on each to experiment the “Playing on distance” function.
  • TestMidiStream: how to generate music without a MIDI file with just a few lines of code.
  • CatchMusic: MIDI is read from a MidiFilePlayer but playing music is delayed in time, thank to the MidiStreamPlayer. Could become a game! See Here.

Demos available with Pro :

Pro Maestro MPTK demos available
Pro Maestro MPTK demos available
  • TestExternalMidiPlay: MIDI is loaded directly from your desktop or from a web site.
  • TestMidiPlayList: demonstration of the prefab MidiListPlayer able to play a list of MIDI files with overlap and loop inside a MIDI itself.
  • TestMidiWriter: four methods to create and write a MIDI file with MPTK. Contain also a light music sequencer.
  • TestMidiInReader: wait and play MIDI events from a Midi keyboard connected to your computer. Use of the MPTK API with a few lines of code.
  • EuclideanRhythm: the Euclidean rhythm in music was discovered by Godfried Toussaint in 2004 and is described in a 2005 paper “The Euclidean Algorithm Generates Traditional Musical Rhythms”. An impressive Rhythm Box. It’s a demonstration, but a lot of potential for a more complex application! See Here.
  • SpatializerFly: each instruments from the MIDI are positionned on the 3D stage. You can navigate among them in a spatial journey! See Here.
  • Merge MIDI Files: load MIDI files from the MIDI DB, merge or insert them at a defined position, save as an external MIDI File or in the MIDI DB. All these actions can be performed while playing!
  • Inner Loop: quick demonstration for MIDI inner loop. A very accurate MIDI looper.
  • Music Wood Box: transform your smartphone or tablet into a wood instrument. Thanks to the sensitive surface with low latency for playing music (Always in development mode)
  • Load External SoundFont: load a SoundFont from a website or from your device. Perfect for downsizing your app or offering options for different instruments or styles.

See menu Maestro / Load Demonstration for a quick access to all these demos.

Free or Pro version ?

FunctionFreePro
Play MIDI Music (MIDI File) with no codeXX
Play Generated Music (MIDI Stream)XX
Play / Paused automatically based on distance and on focus lostXX
Loop, transpose, quantization, start play at first note, change position, speed, all on flyXX
Channel, applied mute, volume, force instruments.XX
Load MIDI file and explore MIDI events.XX
API for a full integration in your scriptXX
MIDI Spatializer on the whole MIDI XX
MIDI Editor as a Unity Editor extensionX
MIDI File Writer for building your MIDI file X
MIDI Spatializer by channels or by tracksX
Play External MIDI File from a web site or locally from the device X
MIDI Play List and Looping function X
MIDI Input Reader from an external MIDI keyboardX
Import and manage several SoundFonts and optimize samples count X
Load SoundFont on the fly from a local file or from the web X
Accurate MIDI Inner loopX
Add audio effects: low-pass filter, reverb, chorus (V2.8).X
Integration with Cinematic Sequencer – Slate (V2.8). X
Builder for Chords and ScalesX
Real Time Effect modifier (MTPK_ModifySynthParameterX
Real Time Synth (OnAudioFrameStart) processingX
Change MIDI event in real timeX

Obviously, even if you don’t have the need of the Pro function, you can also bought it 😉 It’s a lot of work. Please, help us to maintain this application with a professional behaviors !!!

Playing Music Without MIDI File

Furthermore, you can generate your music from your own algorithm by using hundreds waves extracted from SoundFont.

Of course, some examples are provided to explain how to this. Have a look to : TestMidiStreamSimple demo or EuclideanRhythm.

For more information see Class MidiPlayerTK.MidiStreamPlayer. More information about integrating MPTK in your script here.

Limitations

The Maestro MPTK source code is available in C#, and there is no binary or hidden code, except for reading and writing MIDI events from an external keyboard.

Nevertheless, playing music is not available with WebGL app. See here why.

Example of integration with MPTK

Demo MIDI player with C# script - apply change to music
Demo Midi Player Scripting
change in real-time channels setting: instrument, volume, mute
MIDI Channel change in real-time
connect a MIDI keyboard like a synthesizer to your application
http://paxstellar.fr/class-midikeyboard/
Demo build MIDI music in realtime - select instrument from soundfont, loop on notes,  play chord and music scales, apply audio effect
Demo Generative MIDI full test of generative notes, chords, scales and effects
Realtime synthesizer parameter change
Run Time effects applied to the Synthesizer
Select an instrument from the soundfont
write MIDI file
Write MIDI file
Catch Music (simplified design with MPTK asset)
Euclidean Rhythm (pro)
Next version on the way
Play from external MIDI
Play from external MIDI

Get MPTK from the Unity store

If you like Midi Player Tool Kit, please leave a review on the Asset Store. It’s very appreciated!!!

Maestro MPTK on ChatGPT!

From different MPTK documentation sources DarkSky42 has created a custom LLM based on ChatGPT. You are now able to ask all the questions you want and get a good level of response, request code example, verify your source code …

Contact

If you have questions, please don’t hesitate to contact us via the dedicated Unity forum or our Discord  channel.

Reach the Discord archive by topic.

We are always happy to discuss your projects!

Add MIDI Music With 3 Clicks for Free

Sound Spatialisation, MPTK is ready for Virtual Reality [Pro]

Sound Spatialisation, MPTK is ready for Virtual Reality [free]

Midi Synth : Real Time Voice Effect Change

Euclidean Rhythm demo

The Deezer playlist that helped me create Maestro