Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Maestro Midi Player Tool Kit - Good news for your rhythm game !

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

  1. cihadturhan_unity

    cihadturhan_unity

    Joined:
    Apr 19, 2021
    Posts:
    62
    Nope, because MIDI player can be paused, seeked at different time and its speed can be changed. Realtime shows the real time since the beginning of play not the actual time of midi.

    But the solution above worked perfectly for my case. It always gives me the right milliseconds of midi player.
     
    BachmannT likes this.
  2. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    You're welcome!
     
  3. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    I have been finding a good workflow for getting MIDI tracks in, which is correctly allowing me to allocate program changes (instruments) per channel as expected.

    However, bank change is not working and I cannot figure out why. I am trying to get to the drum bank (bank 127, program 0). If I open my MIDI in MIDI Editor it shows that there is a correct bank change request being run through on the correct channel:

    bankselect.PNG

    I can get these bank select messages to work at least sometimes in my DAW (audio program). However, they do not work at all in Maestro in Unity.

    There are no bank select messages after to negate this. I tried putting a program change as well to value 0 before or after this MSB. I also tried an LSB bank select of 0 value just in case it needed that too after. No benefit. I can't get the drum patches to be utilized. It keeps trying to play this channel on the grand piano (bank 0, instrument 0).

    Can you get the bank select to work on your end? If so, what does the bank change event look like in MIDI Editor to work?

    Thanks
     
    Last edited: Mar 31, 2023
  4. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello, could send me (by email if you prefer) your MIDI file ?
     
  5. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Sure. Sent one to demonstrate now. Thanks.
     
  6. JWerner

    JWerner

    Joined:
    Dec 18, 2016
    Posts:
    8
    Just an FYI, Bank Selects require 3 messages immediately following one another to work correctly. Bank Select MSB and LSB should be sent as a pair, immediately followed by a Program Change. To select bank 127, program 0 the 3 messages are MSB=0 LSB=127 PC=0. At least that's according to the spec. I'm working on a MIDI editor now, and can test MPTK in the next few days.
     
  7. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Thank for the information.
    The version 2.9.0 is now in release candidate phase, so it's too late to add new feature which need strong testing. But I add it to my priority backlog and that will be available with the 2.9.1.
    Regards
    Thierry

    PS: the current version implement only the MSB controller, a value of 127 (max value possible) select the bank 127. There is no bank 127 in the default soundfont of Maestro free, so bank 0 is selected. Selecting bank 120 works well.
     
    Last edited: Apr 11, 2023
  8. claveSounds

    claveSounds

    Joined:
    Apr 23, 2023
    Posts:
    3
    Hi.
    I hope this is the right place to post a new message.
    Firstly I should say I'm very new to C# and Unity, but I am a musician and have used MIDI all my life. However, this is my first dev project, so I am learning as I go.
    I have built a lot of my project around another MIDI API (drywetMidi), and I am really just looking for something that will create a virtual MIDI port and then allow me to send that midi to your synth/soundfonts. Will your asset do that? I already have the MIDI data, I just want to send it to sound fonts instead of to another application or external MIDI device?
    Or would I need to reprogram all the MIDI in the language of your API?
    I'm happy to pay for the full version, but first I need to know if it will do what I need.
    Many thanks, and it looks like a great asset.
     
  9. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello, this is one of the right place ;-) For more complex question, email could be easier.
    For a quick answer to your question: It's possible with Maestro (Pro) to receive MIDI events thru a MIDI port. See here.
    But I never checked with a virtual port. I could make a test if you help me to choose a good virtual port app.
    With this solution you will have 3 app: your MIDI generator + Virtual port + Player MIDI with SoundFont. A little complex, no ?
     
  10. claveSounds

    claveSounds

    Joined:
    Apr 23, 2023
    Posts:
    3
    Wow, thanks so much for the incredibly fast reply! Bonsoir!
    Yes it may be a bit complex. Since writing that, I've been playing with the free version of Maestro. I think I can probably refactor my code to use Maestro (there's a lot of MIDI in this game - realtime, midi file creation, and midi file playback!), however I have a couple of questions about Midifiles before I commit and start the long task of rewriting it all:

    1, the game requires dynamic creation of Midi files. That means I need to load those midi files from assets folder rather than the midifile list as they don't exist until the game is running! Or can I add files to the list dynamically?
    2, Does that also create problems with removing unwanted sound fonts? As from what I've read in your docs, Maestro removes sound fonts based on what's NOT being used in your midi files list. Or can I manually remove any banks/fonts I don't need?
    3, The midi files it generates have Marker events which count the beats and bars and these events are used in game to handle stuff. Can I do that with Maestro?

    Thanks
     
  11. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello,
    I try to answer as quickly as possible, it's so uncomfortable waiting a response!

    Your app seems very interesting, it's possible to have a more detailed view of the features? (By email for avoiding disclose!). I could also better advise you.

    1, the game requires dynamic creation of Midi files.

    A very quick resume of the Maestro features:
    • playing existing MIDI file + real time change + Unity Event from MIDI event: MidiFilePlayer
    • dynamic creation of Midi files + adding marker events + playing + real time change+ Unity Event from MIDI event: MidiFileWriter2 class (the MIDI editor is build with this class). Looks like the best candidates for your cases.
    • playing individual note from instrument in real time (for example from the Unity Update() : MidiStreamPlayer
    You could also have a look to this page (always in progress): https://paxstellar.fr/use-case/

    upload_2023-5-30_8-51-11.png

    2, Does that also create problems with removing unwanted sound fonts
    No problem, in case of preset missing, the first one is used (generally piano) and a warning message is displayed.
    Yes, it's possible to removes preset from your soundfont. But for a more precise result it's better to use an app like Viena or Polyphone before importing in Maestro. Some information here.

    3, The midi files it generates have Marker events which count the beats and bars and these events are used in game to handle stuff. Can I do that with Maestro?
    Not yet, but it's a so good idea that I will add it ;-)
    Perhaps with the MIDI Editor for a first attempts, automatic insert as meta text:
    upload_2023-5-30_9-2-30.png
    (preview on the oncoming 2.9.2)

    Regards
    Thierry
     
  12. claveSounds

    claveSounds

    Joined:
    Apr 23, 2023
    Posts:
    3
    Thanks Thierry.

    I've bought the asset. I'll speak to you by email.

    Thanks :)
     
  13. wedgiebee

    wedgiebee

    Joined:
    Aug 9, 2016
    Posts:
    40
    @brunoofvr Did you ever find a solution to this? I'm experiencing the same thing
     
  14. LeoMassaFM

    LeoMassaFM

    Joined:
    Jul 1, 2023
    Posts:
    1
    Hello Bachmann. I gotta say, I really like your plugin! It's super versatile and perfect for my game! Though there's one issue that I don't know how to solve:
    I have a MIDI file that has a time signature change, which I explicitly indicated with a cue, in the middle of the song. However, the MidiFileLoader never updates the time signature events even after passing the point in the song where the time signature change happens. How do I fix this? Thanks.
     
  15. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello, thank to appreciate Maestro. It's a lot of work ;).
    Good news for you, the next version 2.10.0 will manage time signature change! That was missing in the previous version.
    Look here for detail: https://discord.gg/zPbvQ8wP
    Regards
    Thierry
     
    Lars-Steenhoff likes this.
  16. metamota

    metamota

    Joined:
    Jul 3, 2023
    Posts:
    5
    Hi, I'm happy I found (and you wrote!) this package because it seems to be exactly what I need. Thanks for the good work!
    I am trying to import the MIDI stream player prefab. On older Unity versions (2020) it works. I added a script and can successfully play a note based on a script. On the newest 2022 version, it doesn't.

    When adding the prefab, I get the error:
    ArgumentNullException: Value cannot be null.
    Parameter name: prefabInstance
    UnityEditor.PropertyEditor.ExtractPrefabComponents () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:894)
    UnityEditor.PropertyEditor.OnTrackerRebuilt () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:721)
    UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:1851)
    UnityEditor.PropertyEditor.RebuildContentsContainers () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:1060)
    UnityEditor.InspectorWindow.OnSelectionChanged () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/InspectorWindow.cs:143)
    UnityEditor.Selection.Internal_CallSelectionChanged () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Selection.cs:37)



    This might or not have to do with a Unicode warning that I get already when browsing the package in the Package Manager. The error is similar, though not exactly, this one: https://issuetracker.unity3d.com/is...nsole-when-browsing-assets-in-package-manager


    The character with Unicode value \u2B50 was not found in the [Inter-Regular SDF] font asset or any potential fallbacks. It was replaced by Unicode character \u25A1.
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)


    Would be great to be able to figure this out, so any ideas of what might be happening are welcome.
    Thanks again
    Elisa
     
  17. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello Elisa.
    If you are happy, I'm happy :)
    I'm sure that we will find a solution. Maestro is tested on all major version of Maestro but not all minor.
    Could you send me these information:
    - exact Unity version
    - MacOS, Windows ? version ?
    - which method are you using to add the prefab ?
    - have you tried others prefab like MidiFilePlayer ?
    - Is the Maestro demo are working well ?
    Thanks

    Regards
    Thierry
     
  18. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    ok, forget my stupid questions!
    It seems that the creation of prefab from a contextual menu (from Maestro menu or right click on the hierarchy) does'nt works now ...
    Create your prefab by drag & drop from prefab in project to hierarchy:
    upload_2023-8-2_22-7-40.png

    I haven't identified the root cause ... I will check more in depth, or remove the contextual menu!

    Regards
    Thierry
     
  19. metamota

    metamota

    Joined:
    Jul 3, 2023
    Posts:
    5
    Hi, sure

    - Unity version: 2022.3.5f1
    - MacOS, Ventura 13.4.1
    - I'm using the MPTK Pro version
    - After importing the package, I just click on the menu, Maestro -> Add Prefab Midi Stream Player. (Not sure if this responds to your question about which method I use. Here's a 45-second video showing the error: MPTKerror.mov)
    - Adding the prefab MidiFilePlayer gives me the same error

    ArgumentNullException: Value cannot be null.
    Parameter name: prefabInstance
    UnityEditor.PropertyEditor.ExtractPrefabComponents () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:894)
    UnityEditor.PropertyEditor.OnTrackerRebuilt () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:721)
    UnityEditor.PropertyEditor.DrawEditors (UnityEditor.Editor[] editors) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:1851)
    UnityEditor.PropertyEditor.RebuildContentsContainers () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/PropertyEditor.cs:1060)
    UnityEditor.InspectorWindow.RedrawFromNative () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/InspectorWindow.cs:195)



    - I tried the demo 1-simply play MIDI and got the error:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.AudioFilterGUI.DrawAudioFilterGUI (UnityEngine.MonoBehaviour behaviour) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/AudioFilterGUI.cs:42)
    UnityEditor.Editor.DoDrawDefaultInspector () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/Editor.cs:865)
    UnityEditor.Editor.DrawDefaultInspector () (at /Users/bokken/build/output/unity/unity/Editor/Mono/Inspector/Editor.cs:826)
    MidiPlayerTK.MidiFilePlayerEditor.OnInspectorGUI () (at Assets/MidiPlayer/Scripts/Editor/MidiFilePlayerEditor.cs:171)
    UnityEngine.Debug:LogException(Exception)
    MidiPlayerTK.MidiPlayerGlobal:ErrorDetail(Exception) (at Assets/MidiPlayer/Scripts/MPTKGameObject/MidiPlayerGlobal.cs:1001)
    MidiPlayerTK.MidiFilePlayerEditor:OnInspectorGUI() (at Assets/MidiPlayer/Scripts/Editor/MidiFilePlayerEditor.cs:179)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorApplication.cs:362)



    For now I'm actually happy using the 2020.3.36f1 Unity version, which works fine. But it's a weird problem, in the future it might be important :)

    Thanks again!


     
  20. metamota

    metamota

    Joined:
    Jul 3, 2023
    Posts:
    5
    Ah! sorry, I didn't see this as I was composing the response. I'll try. For some reason my Unity isn't loading My Assets on the Project manager, but I'll try on a fresh project soon and report back. Thanks!
     
  21. metamota

    metamota

    Joined:
    Jul 3, 2023
    Posts:
    5
    Indeed, that worked! And now the prefab is shown in blue, as I expected it to be (even when it worked on unity 2020 it was shown in black.)
    Thanks again
     
  22. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Perfect!
    The method I'm using to instantiate the prefab from a contextual menu doesn't preserve the link with the prefab (stay black, not blue). I will change this in the next version (coming soon !).
    Thank you for contacting me, that help me to make Maestro better!
     
    metamota likes this.
  23. rmacgillis

    rmacgillis

    Joined:
    Feb 5, 2014
    Posts:
    15
    Hello,

    I'd like the option in my app to only play one track of a midi at a time, but I can't figure out how to implement this.
     
  24. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello
    By track or by channel ?
     
  25. rmacgillis

    rmacgillis

    Joined:
    Feb 5, 2014
    Posts:
    15
    Track, if possible

    Because I tried messing with channels and got nowhere. But the toolkit recognizes the number of tracks.
     
    Last edited: Aug 5, 2023
  26. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Yes it's possible but not easier as with channel.

    You need the version pro and create a callback with the OnMidiEvent (it's an Action from MidiFilePlayer, will be a Func wich return boolean with the next version)

    It's a MIDI events pre-processor able to change the MIDI events before they are going to the synth to be played.

    You can filter MIDI events by their track number and change the meaning of the event (you can't remove it for now, that will be possible with the next version), for example, change the velocity to 0.

    See here with an example:

    https://mptkapi.paxstellar.com/d3/d..._synth.html#a1ff7a431b64a01a3ce800351461e2241

    There is also an example in the demo 2 Play Midi with script
    upload_2023-8-5_19-17-18.png

    Regards
    Thierry
     
  27. rmacgillis

    rmacgillis

    Joined:
    Feb 5, 2014
    Posts:
    15

    It's working, thank you.
     
  28. unity_B8BB62EE731F1E06F6F9

    unity_B8BB62EE731F1E06F6F9

    Joined:
    Apr 12, 2022
    Posts:
    3
    Hello, and thanks for a great product!

    I have an issue though, when trying to build the project i got an error cannot build player while editor is importing asset.
    I've searched references of "using UnityEditor;" in my project files which are not inside Editor folder and found one in
    Assets/MidiPlayer/Demo/ProDemos/Script/MidiJoinAndImport.cs
    Not quite sure why it's even loaded as i'm not using it, commenting out the code, everything works.

    Could you please advise why is it happening. Quite concerned that my app is loading resources which it doesn't use, at least explicitly.

    Thank you.
     
  29. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello
    Thank for using Maestro!
    If I well understand, you are trying to build the MidiJoinAndImports demo?

    I confirm, this demo use Unity Editor for writing the MIDI to the DB (not possible outside Unity Editor). Classically there is a #if to avoid compilation error
    upload_2023-8-10_19-52-30.png

    But, there is a missing #if around the using of UnityEditor. Here to add.
    upload_2023-8-10_19-54-31.png

    Thank to alert me. That will be corrected in the next version.

    For information, not all demos are tested to be build outside Unity editor.

    Regards
    Thierry
     
  30. unity_B8BB62EE731F1E06F6F9

    unity_B8BB62EE731F1E06F6F9

    Joined:
    Apr 12, 2022
    Posts:
    3
    Hey hey, n

    Hey hey!

    The problem is that i'm not referencing MidiJoinAndImports demo in my scene scripts, so i don't expect this to appear in the build. The only things i'm using are MidiStreamPlayer and MidiFilePlayer prefabs.

    Regards, Max.
     
  31. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Strange thing, I wasn't aware of that: builder seems to take all source files for building an app, whatever the content of the scenes to build!

    Some explanation here: https://support.unity.com/hc/en-us/articles/208456906-Excluding-Scripts-and-Assets-from-builds

    i'm annoyed by this problem because the solution would be to add #if UNITY_EDITOR around each demo scripts but it's interesting for you to be able to build a demo to check Maestro inside an app!

    A brutal solution would be to delete (or move) the folder MidiPlayer\Assets\MidiPlayer\Demo but let me check before if there is no regression in the core MidiPlayer!
     

    Attached Files:

    Last edited: Aug 11, 2023
  32. unity_B8BB62EE731F1E06F6F9

    unity_B8BB62EE731F1E06F6F9

    Joined:
    Apr 12, 2022
    Posts:
    3
    Thank you! i'll try!
     
  33. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    No problem with deleted (moving is better !) the Demo folder, just some icons missing in the Midi Editor setup windows.
    But he gain is low (< 3 Mo), time to compile quite the same. Not sure it's useful, only perhaps to generate the final version of your app.
     
  34. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Hey Thierry, I hope you are doing well. I recently updated my project to 2023.1.7f from 2022.2.9f I believe. I previously tried upgrading to a 2023.2 preview and I noticed the same thing.

    Upon upgrading to any 2023 version my MPTK player can no longer keep up with the same playback efficiency as it did in 2022.2.9f. It slows down, lags, stutters, trying to playback songs that it could play perfectly smoothly in 2022.2.9f. I tried disabling everything in a scene and just having it playback and I find the same thing.

    Have you tried any 2023 versions? Have you noticed anything similar or any funny behavior? Perhaps it is something else in Unity that is slowing things down but everything else looks normal. I am not sure. I am just asking at this point. Thanks.
     
  35. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello
    Unity 2023 is a pre-release version! More of that, it's an alpha.
    upload_2023-8-11_21-50-42.png

    I have made quick check, mainly for WebGL which will be improved for Maestro (I hope !) and got some issue also.
    I'm waiting for the official release for going further.

    Regards
    Thierry
     
    mikejm_ likes this.
  36. adayal2016

    adayal2016

    Joined:
    Jan 11, 2022
    Posts:
    6
    Hi Thierry, I am creating an iOS app where people can load Midi files from their iOS device (iPhone, iPad) and play it. I was wondering if Maestro will support this use-case?

    I was going over the FileLoader API, and it looks like there is a MPTK_Load() method in the Pro version that takes in a filepath. I'm guessing this adds the Midi file to the MidiDB? I'm assuming then I can use the FilePlayer to play the Midi?

    Follow-up questions:
    1. Has this been tested on iOS (loading a Midi filepath and playing it)? I'd like to know if it works on iOS before making a Pro purchase
    2. Is this use-case possible to support with the Free version?
    3. What happens when a user tries to load the same Midi file multiple times? Does MidiDB handle that ok or would I need to add some checking code?

    Thank you for the help!
     
  37. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello, Thank for your interest for Maestro!
    With Maestro pro you can load a MIDI file and play it from anywhere with path on your device, a URL from a web site. Have a look here

    1. Has this been tested on iOS (loading a Midi filepath and playing it)? I'd like to know if it works on iOS before making a Pro purchase
    Yes tested on iOS but from a URL. For MacOS, a file path like this file:///Users/thierry/Desktop/Nirvana.mid works well. I'm not sure for the path on iOS, have you an example? I can test.

    2. Is this use-case possible to support with the Free version?

    Not directly

    3. What happens when a user tries to load the same Midi file multiple times? Does MidiDB handle that ok or would I need to add some checking code?
    MidiDB is the other way to load a MIDI but from a MIDI in a Unity resource directory. MIDI files are added in MidiDB with the Unity Editor, but are readonly when running. You will have to check multiple load of the same MIDI.

    Some useful links:

    MidiExternalPlayer on Maestro site
    API for MIDI External Player

    Regards
     
    Last edited: Sep 5, 2023
  38. adayal2016

    adayal2016

    Joined:
    Jan 11, 2022
    Posts:
    6
    Thanks for the info. Just to clarify - the MidiExternalPlayer plays the Midi file directly without having to load it first into the MidiDB - correct?

    Is there any advantage to using the MidiDB? I'm curious why it even exists, and by default not just support reading from the Unity resource directory directly?

    If I wanted to use the MidiDB approach, is there an API to add/remove Midi files to MidiDB programmatically?

    As for the iOS testing - if you have an iPad or iPhone you can create a small Unity app that reads a file from a directory. If its too much trouble for you to test no worries - I can give it a go too. Is the Pro version as easy to use as the Free version? Or is there more setup work that needs to be done for it? I think I read somewhere in the docs that with the Pro version some additional setup or sound configuration needs to be done?
     
  39. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello
    the MidiExternalPlayer plays the Midi file directly without having to load it first into the MidiDB - correct?
    Yes, correct!

    Is there any advantage to using the MidiDB?
    The idea is to propose an autonomous setup for your app: all needed data are inside the Unity build (same for the SoundFontDB)

    is there an API to add/remove Midi files to MidiDB programmatically?
    No, by design the Unity resource folders are readonly from the Build. Its' only possible with the Unity Editor (same process than images in a resource folder)

    As for the iOS testing
    I'm able to find the the URI of a file on MacOS (like file://) but I found nothing with iOS. Is it the same?

    Is the Pro version as easy to use as the Free version?
    Yes, pro is an extension of the free, same concepts, same API but added features.
    Also MIDI and SoundFont are not directly available with the pro to not interact with your app when you update Maestro. Look here

    The free version of Maestro use the SoundFont GeneralUser GS v1.471 from Christian Collins site here. It’s a SoundFont with a very good balancing between size and quality.
    (look at this page for more information about loading a soundfont)

    Regards
    Thierry
     
    Last edited: Sep 6, 2023
  40. Chito1703

    Chito1703

    Joined:
    Apr 14, 2022
    Posts:
    3
    Hello!
    I am new to this forum and I was wondering if it is possible to send an event when one particular midi note has been played. I am developing a musical videogame for my thesis and using this library could help me a lot. My goal is to make the notes appear visually from the midi triggers changing the time of appearance by a bit so they appear before the actual beat of the note hits, so you have time to hit them. in order to do this it would be great to be able to make my own notes sprites appear on the canvas when the midi note is hit or reached. do you have any insight/tips/examples?
     
  41. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello Chito,
    Yes it's possible with Maestro, even with the free version ;-)
    Install Maestro Free, display the demo list:
    upload_2023-9-12_20-35-39.png

    and have a look to the demo 6 - catch music

    upload_2023-9-12_20-36-25.png

    All the source code is available but you will have to understand the script demo before building your own solution.
    Start reading with MusicView.cs:
    In short: MIDI events are read with the MidiFilePlayer prefab from a MIDI file but no sound is played (send to synth is disabled).
    A callback method is triggered for each MIDI event which create a gameObject, in some condition, for the visual.
    This gameobject (NoteView.cs or CntrolView.cs depending the kind of MIDI event) holds also the description of the MIDI event (instance of class MPTKEvent).
    When gameObject if about to falling, the MIDI event is played with a MidiStreamPlayer by the internal synth. Easy (almost) ;-)

    Don't forget to look at the description of the API:
    MidiFilePlayer
    MidiStreamPlayer

    And obviously f Maestro site pages!

    Let me inform of your progress !
    regards
    Thierry
     
  42. Chito1703

    Chito1703

    Joined:
    Apr 14, 2022
    Posts:
    3
    thanks a lot! i'll try all of this and let you know. Thanks again and have a great time
     
  43. Chito1703

    Chito1703

    Joined:
    Apr 14, 2022
    Posts:
    3
    Hello again, after working on my project based on the example number 6 I got the events on my own script but when trying to make it work and setting both a new midiFilePlayer and a MidiStreamPlayer in my own scene I can't make the player to start. it basically loops between 1 and 0 all the time. i thought it may be the speed but now I started it at 1 as it says in the documentation and still stays in the loop. Maybe I am missing a call but I cannot make it start and I was wondering if there is an specific way in the example that I am missing or a place where it is called the function that starts it. Do you have any tip?
     
  44. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello,
    what do you mean with "it basically loops between 1 and 0 all the time" ?
     
  45. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Have you find a solution?
     
  46. CDAfonsoCl

    CDAfonsoCl

    Joined:
    May 18, 2021
    Posts:
    17
    How is the WebGL compatability going? Can someone confirm that it is working without issues using Unity 2023.2.0a23?
     
    Last edited: Oct 3, 2023
  47. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    I tried with the 2023.2.0a14 (alpha), and that was a mess to generate a web version.
    So I'm now waiting for the first official release to make a strong test with webGL.
    Regards
    Thierry
     
    CDAfonsoCl likes this.
  48. CDAfonsoCl

    CDAfonsoCl

    Joined:
    May 18, 2021
    Posts:
    17
    Thank you. I've made some tests myself, but i couldn't even play anything at all :(
     
  49. Edgar_W_

    Edgar_W_

    Joined:
    Aug 29, 2017
    Posts:
    3
    Hi,
    I'm building a prototype on Android, using Maestro plugin to play Midi audio, and using a Android plugin for Bluetooth Low Energy (BLE) to connect to external Midi instrument devices (Midi input device). I could get Maestro to play audio correctly on the Android device, until when there is a BLE connection, the Android's audio suddenly goes to silent.
    After I disconnect the BLE Midi device, the audio comes back. I am using MidiFilePlayer and MidiStreamPlayer. I've checked the Android plugin, the BLE Midi device is connected as a Midi input device, not a Midi output device.
    What could be the problem? Is there some automatic re-routing of Midi playback to the BLE Midi device as a Midi output device?
    I'll be grateful for any help.

    Regards,
    Edgar
     
  50. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    385
    Hello,
    Something I haven't understood.
    There is no Maestro plugin for reading MIDI device on Android (MidiKeyboard works only with MacOS and Windows).
    How did you get MID event in Maestro ?

    Regards
    Thierry