Add Midi music to your Unity application
Playing music in your Unity 3D games or applications from Midi files or from your algo become easy. Thank SoundFont for adding hundred sounds of instruments for playing Midi files.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.
Want to start directly the journey? here a Quick start.
Otherwise, get a few information on this product:
- Play music from Midi files in your Unity application without any C# or JS scripting.
- Use powerful customs inspectors to define your musics.
- Synchronize Midi events with your game or application.
- Create generated music in your Unity application and reuse hundreds presets and waves extracted from SoundFont.
- Add Midi Prefab in your scene as much as you want.
- Add Midi files (from the web or from your composition) as much as you want.
- Play / Paused automatically based on distance.
- Write Midi file by script.
- Read Karaoke information.
- Read Midi events from a Midi keyboard, play directly, or do anything that you want with the Midi events.
- A full API is available to integrate MPTK in your application for more complex interactions.
- Furthermore, all the source code is available! (except for reading Midi input from a keyboard).
- Also, Prefab will help you to build your application. See below.
Prefab available for free
- MidiFilePlayer: play music from a Midi file.
- MidiStreamPlayer: create music from algo.
- MidiFileLoader: load a Midi file for analysis or processing purpose.
Prefab available with Pro version
- MidiListPlayer: play music from list of Midi files, overlap between Midi, play part of a midi, loop …
- MidiExternalPlay: playing a Midi directly from the Web or anywhere on the desktop.
- MidiInReader: read Midi events from a Midi keyboard, play directly, or do anything that you want with the Midi events.
One way, prefab!
There is many examples available in the Unity package
Demo has many roles: help us for regression test, demonstration, example of scripts.
Demos available for free :
- 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.
- TestMidiStreamSimple: how to generate music without any Midi files with 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!
Demos available with Pro version :
- 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. Contains 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!
Also have a look to the main demonstration scene to an easy access on each demos. Load and run this scene: Scenes For Demo/ScenesDemonstration
Warning: To avoid interacting with your project, MPTK doesn’t add MPTK scenes in the Build Settings. Add the MPTK scenes with “File/Build Settings” if you want a full functionality of the demonstrator.
Free or Pro version ?
|Play Midi Music (Midi File)||X||X|
|Play Generated Music (Midi Stream)||X||X|
|Play / Paused automatically on distance, on focus lost||X||X|
|Loop, transpose, quantization, start play at first note, change position, speed||X||X|
|Load Midi file||X||X|
|API for a full integration in your script||X||X|
|Midi File Writer||X|
|Play External Midi File||X|
|Midi Play List and Loop inside||X|
|Midi Input Reader from an external Midi keyboard||X|
|Import and manage several SoundFonts and optimize samples count||X|
|Load SoundFont on the fly from a local file or from the web||X|
|Add audio effects: low-pass filter, reverb, chorus (V2.8).||X|
|Integration with Cinematic Sequencer – Slate (V2.8).||X|
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 !!!
Play 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. Have a look to : TestMidiStreamSimple demo or EuclideanRhythm.
For more information see Class MidiPlayerTK.MidiStreamPlayer. More information about integrating MPTK in your script here.
There is no extra DLL or binary (except for reading Midi input from external keyboard), all the source code of MPTK is available (C#). Consequently, there is some functions not available on some devices. See here.
Example of integration with MPTK
Midi File Player Advanced
Write Midi File (Pro)
Catch Music (simplified design with MPTK asset)