Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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:
    43
    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:
    360
    You're welcome!
     
  3. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    251
    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:
    360
    Hello, could send me (by email if you prefer) your MIDI file ?
     
  5. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    251
    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:
    360
    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:
    360
    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:
    360
    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 :)