Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[Free] Midi Player Tool Kit Available !

Discussion in 'Made With Unity' started by BachmannT, Apr 14, 2018.

  1. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello
    Midi Player Tool Kit is a package able to play music from Midi files in your application. There is no need of external component or device.

    Thank to SoundFont for adding hundred sounds of instruments for playing Midi files
    • No scripting C# or JS is mandatory: specific inspector defined all your needs directly in Unity editor. See Quick Start.
    • Add Midi Audio Source 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.
    • API available to integrate MPTK in your application.
    Have Fun !
     
    Last edited: Jul 9, 2018
  2. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi
    Version 1.1 available. Check API here.
    Version 1.2 on the rail with MidiStreamPlayer component to generate on the fly music midi.
    Perfect for Music Generator !

    Have Fun !
     
    Last edited: Jul 1, 2018
  3. Denis2018m

    Denis2018m

    Joined:
    Feb 11, 2018
    Posts:
    2
    Hello Bachmann! Thank you for the interesting asset. You write: "...Midi Player Tool Kit converts SoundFont to a simpler format with not all the functionalities of SoudFont..." Would you please tell, which exactly functional of SoundFont is modified in Unity, or will be not available?
     
  4. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi Denis2018m,

    Included : key range, velocity range, pan, sample, loop sample, OverridingRootKey, FineTune, CoarseTune
    not included : ADSL, Chorus, Reverb, Frequency Modulation

    Mainly, all heavy CPU consumming generator are not implemented.

    Best regards
     
  5. CodeIsTheAnswer

    CodeIsTheAnswer

    Joined:
    Jul 16, 2013
    Posts:
    4
    Is there a way to dynamically "feed" the player with data instead of sending a prebuilt file?
    for example, what if I want to play a few chords instead of an entire song?
    thanks,
    Mark
     
  6. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi
    If I well understand your question, you want to play music without a Midi file ?
    The last version 1.5, can be used to play notes with the API. For each notes you have to defined : note, instrument, duration, volume, ....
    Have a look to this two demo in the package :
    • TestMidiStreamSimple : very simple (and horrible!) music generator. Usefull to understand how to use the MidiStreamPlayer Prefab.
    • TestMidiStreamGenerator : a more complex music generator with some algorithm. Could become in futur a new asset in the store ;-)
    BR
    Thierry
     
    Last edited: Jun 10, 2018
  7. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Hi,

    interested in the plugin for the music tiles type game. The api link is broken to see if it would be possible.

    Regards
     
  8. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Last edited: Jun 20, 2018
  9. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
  10. wangzy_88

    wangzy_88

    Joined:
    Sep 12, 2012
    Posts:
    14
    Hi BachmannT,

    I'm very happy that there is a free midi toolkit in asset store, I tried it but found a problem. Is the OnEventNotesMidi event only appear in PRO version? I can't find it in free version.

    Thank you very much!
     
  11. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello wangzy_88,
    I'm happy if you are happy !
    I can confirm that OnEventNotesMidi is also available on the free version.
    I'm publishing a new version today (1.7), you could have a look to the new demo "Demo CatchMusic" where this event is used.

    Best Regards
    Thierry
     
  12. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
  13. wangzy_88

    wangzy_88

    Joined:
    Sep 12, 2012
    Posts:
    14
    Hi Thierry,
    Thank you for your answer!
    I can't find the 1.7 version now but I think the reason is asset store has upload delay. Anyway I'll watch it:)

    Have a good day!
    wangzy_88
     
  14. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi
    1.7 available !
    Thank to Unity for the efficient publishing process !
     
  15. wangzy_88

    wangzy_88

    Joined:
    Sep 12, 2012
    Posts:
    14
    Hi Thierry,

    I tried the 1.7 version and I must say it's very good! The new demo is interesting too!
    Now I have two new questions:
    Can I read the notes of midi without playing it?
    Can I get the real time(since play start) of note? I found that the AbsoluteQuantize isn't what I want.

    Thank you!
    wangzy_88
     
    Last edited: Jul 9, 2018
  16. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi wangzy_88

    Yes ! from the inspector of MidiFilePlayer, have a look to "Direct Send to Player". If not checked, no sound are played.
    From the script, use properties MPTK_DirectSendToPlayer of a MidiFilePlayer component.

    Yes ! Have a look to this properties of MidiFilePlayer.
    /// Time from the start of playing the current midi
    public virtual TimeSpan MPTK_PlayTime

    it's a TimeSpan, use MPTK_PlayTime.TotalMilliseconds to get the time in milliseconds

    ps: thank for your good comment ;-)

    Best regards
    Thierry
     
  17. wangzy_88

    wangzy_88

    Joined:
    Sep 12, 2012
    Posts:
    14
    Haha, I'm happy that you like my comment!
    And what I really want to do is read the midi info in Editor, I want to let midi file to tell me the notes, but player will listen mp3 or wav, they sound better than midi.
    Anyway I can play midi once and record the info, but if you have a better suggest, I'll be very happy.:)

    PS: I found another way, use ReadMidiEvents() in MidiLoad, but I can't get the real time too.

    Have a good day!
    wangzy_88
     
  18. yamomoniy

    yamomoniy

    Joined:
    Jul 13, 2018
    Posts:
    2
    Hi,
    Is there a way to do the following process with this kit?
    • transposing (changing) key of music
    • mapping each channel of MIDI to a specified channel of output device
      • I want to map each instrument to each channel of 7.1ch surround output device.
    Thanks,
    yamomoniy
     
  19. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello yamomoniy

    For your questions :
    1) Yes, MPTK can transpose key of music. See inspector of MidiFilePlayer or API if you want also to transpose by script.
    2) No, for mapping each channel of MIDI to a specified channel of output device. MPTK don't use midi device to play music.Music is played with waves extracted from Soundfont. No need of external device. But, could be an idea for a future version !

    Best regards
    Thierry
     
    Last edited: Jul 14, 2018
  20. yamomoniy

    yamomoniy

    Joined:
    Jul 13, 2018
    Posts:
    2
    Hello Thierry-san,

    I see. Thank you for your kind support!

    Best regards,
    yamomoniy
     
  21. alexrshare

    alexrshare

    Joined:
    Jul 19, 2018
    Posts:
    2
    Hi Thierry,

    I've just found your asset and it looks very promising! Thanks so much for sharing it!

    I'm now studing the code and I'm trying to find a way to get a frame rate indipendent and sample accurate player, maybe implementing it into OnAudioFilterRead.

    I'm developing a rhythm game so my needs are:
    1) Sync a background music track (wav, mp3, whatever)
    2) Play MIDI and get events to handle gameplay

    Since the gameplay is music based, the MIDI has to play no matter what, even if the frame rate drops drammatically, so I can't rely on WaitForSeconds because it's fps dependent.

    I'll share my solution with you if I find one :p

    Thanks again for your hard work!

    Best,
    Alex
     
    Last edited: Jul 19, 2018
  22. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi alexrshare
    Seems a very good project that you have ! And thank for your kind comment.
    Have you see the demo CatchMusic in MPTK ? It could be interesting for you : a midifile is loaded but midi events are not played immediately. A unity event is defined to receive list of midi events at each midi ticks (if there is midi events!). So you are independant of frame per second.

    Best regards
    Thierry
     
  23. alexrshare

    alexrshare

    Joined:
    Jul 19, 2018
    Posts:
    2
    Hi Thierry,
    thanks for your reply!

    I've already seen CatchMusic demo.
    Setting "V Sync Count" to "Don't Sync" in Quality Setting and, just for testing, adding
    Application.targetFrameRate = 1;
    in Awake method, of course the video is refreshed every 1 second but also the MIDI is played every second, which is what I want to avoid.

    Best,
    Alex
     
  24. weisuolong

    weisuolong

    Joined:
    Jun 12, 2017
    Posts:
    7
    hi 。can i play guitar bass drum three instruments with one sound?how can i do that 。
    editor sound font only can select one instrument 。。
     
  25. weisuolong

    weisuolong

    Joined:
    Jun 12, 2017
    Posts:
    7
    i got i must join sf2 together to use ,but how can i use them split?
     
  26. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello, split defined in SF2 are also managed by MPTK
     
  27. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello, I don't understand "can i play guitar bass drum three instruments with one sound". Could you be more detailed ?
     
  28. CelesteEvrad

    CelesteEvrad

    Joined:
    Apr 21, 2017
    Posts:
    1
    Any plans to support the sfz format?
     
  29. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi, one try have been done.For now I have an issue with the wave format of SFZ.
     
  30. weisuolong

    weisuolong

    Joined:
    Jun 12, 2017
    Posts:
    7
    yes。details i know how to do that!
    but i have one requirement。how can i play one song to a midi file
    this plugin can do that?
    i play some key just like c d e f g then i can export to a midi file out put?
     
  31. D12Duke1

    D12Duke1

    Joined:
    Feb 14, 2016
    Posts:
    103
    I scrolled down a few pages and I do LOVE what you've done with the MIDI Toolkit.
     
  32. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello
    No, MPTK is not a Midi Sequencer able to take your input to create Midi. MPTK is a Midi file reader to play music. BR
     
  33. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    You are welcome ;-)
     
  34. weisuolong

    weisuolong

    Joined:
    Jun 12, 2017
    Posts:
    7
    ok but i need to record music by note! can you show me some roads?
     
  35. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Ok, perhaps I better understand your need. It could be an interesting function if you are using MPTK to generate note in real time. I will plan this evolution as soon as possible.
    Best regards
     
  36. weisuolong

    weisuolong

    Joined:
    Jun 12, 2017
    Posts:
    7
    thank you ! five stars wait for you! (。-ω-)zzz
    and i will try ,found have some code on you code,maybe it can work
    just like MidiEventCollection PrepareForExport
     
  37. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    ;-)

    perhaps, you could contact me on my private adresse mail (see MPTK Unity Store) to better describe your project. Writing midi file is not a complex task, technically speaking, it's more tricky to understand how integrate this function with MPTK and keep consistency of the whole. There is a lot of approach possible ! Thank.
     
  38. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hi all
    The version 1.9 Pro is waiting for the Unity review. Could be available in a few days. New functions available:
    Added new MidiListPlayer GameObject able to lead Midi play list
    Added new class to write Midi file from MPTK
    Added capacity of playing multiple waves for one note when SoundFont contains overlapped zone
    Added processing of the Panoramic SoundFont parameter when playing waves
    Added processing of the Attenuation SoundFont parameter when playing waves
    Added ReleaseTime change with MidiStreamPlayer Inspector

    And a lot of enhancement !

    Have Fun
     
  39. CodeIsTheAnswer

    CodeIsTheAnswer

    Joined:
    Jul 16, 2013
    Posts:
    4
    I REALLY like what you have built and intend to use it for several music games. But, when I create a midi file
    using Band In A Box, and play it using the Free MPTK, it sounds like an old fashioned midi game from the 1990's. But, when I play the same song on my computer as a midi file, it sounds full and correct. Is this caused by the soundfonts used in the free version? If I purchase the PRO version will this allow me to select fonts which will sound more natural and professional?
     
  40. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello I'm sorry for the delay in response. There is no Unity notification when a new comment is publish.

    To answer : MPTK use a simplified SoundFont model to avoid heavy calculation and installation of other components. Some Midi don't sounds like a synthesizer or a computer but generally, the sound is good !

    Please send me your Midi or a link, I will have a look to understand the issue.

    I'm working on a version 2 to implement some effects as filters, chorus, adsr, … to get sounds near a classical synthesizer, it's quite complex ! So, the price of the Pro version will increase ... of course with no change for current owner of the Pro! They will get the update for free.
     
    Last edited: Oct 13, 2018
  41. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello all,
    I have temporaly deprecated the MPTK package to correct an issue. Will be available soon !
     
  42. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    1.93 available !
    Corrected an issue : the path to the SoundFont was lost when changing the project path.
     
  43. keeves_test14

    keeves_test14

    Joined:
    Dec 5, 2016
    Posts:
    8
    can you please guide me how to work with this plugin?
     
  44. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Sure ! but your question is quite large! Have you read the documentation here ?
    Have you some specific questions ?
    Best Regards
     
  45. CreepyInpu

    CreepyInpu

    Joined:
    Oct 9, 2014
    Posts:
    3
    Does this give you access to the lyrics embedded in midi files to display then while the song is playing ?
     
  46. keeves_test14

    keeves_test14

    Joined:
    Dec 5, 2016
    Posts:
    8
    How to use this plugin for piano tiles game? We need to generate tiles according to the midi note's duration
     
  47. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Yes ! the lyrics are displayed in the Inspector. You can also get them by the API: MPTK_TextEvent from MidiFilePlayer object.
     
    Last edited: Oct 31, 2018
  48. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    If I well understand, you want to generate some graphics asset (piano tiles ?) with notes (duration) from a Midi ? Have a look to the demonstration in MPTK package: CatchMusic


    Also, I'm working on a more interesting version that could be on Unity as a other package:
     
  49. rn9dfj3

    rn9dfj3

    Joined:
    Nov 7, 2018
    Posts:
    1
    Hi. Defaut Alto Sax [065] can't play in correct time. But the Soprano Sax [064] can play.
    My environment is Midi Player Tool Kit For Unity free with Unity2018.2.14f1.
    I used MidiStreamPlayer.prefab.
    I find Audio Source of Soprano check "Loop", but one of Alto don't.
    Finally, your asset is very easy to use. Thanks! h1.png h2.png
     
    Last edited: Nov 7, 2018
  50. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    31
    Hello rn9dfj3.
    Thank for your comment ! For your remark, I will check this asap, but i'm going in holidays tomorrow, so perhaps not before one week.
    BR
    Thierry