Guild icon
Maestro - Midi Player Tool Kit
Salons textuels / your-questions
your question and if possible answer! Every one can answer, of course !
Avatar
Hello there!! A quick question, can I utilize & reproduce 2 midi files at the same time? Thanks, community!
Avatar
Bryan Dempsey 22/08/2021 00:12
I recall seeing somewhere a MPTK script that would allow the MIDI file player to advance a quarter note's worth of ticks. But I haven't been able to find it since. Can someone tell me where it is?
Avatar
Bryan Dempsey 22/08/2021 00:23
I notice that when I do a Note Transpose, it changes the drum kit patch as well. How to prevent or fix this?
Avatar
Avatar
Bryan Dempsey
I notice that when I do a Note Transpose, it changes the drum kit patch as well. How to prevent or fix this?
This was asked about a couple weeks ago in the forum thread; Thierry indicated it would be fixed in the next version.
Avatar
so from what I understand
01:22
midiStreamPlayer can be used for playing from the soundfont loaded in
01:22
midiKeyboard is used to play an open MIDI Out
01:24
but, question about soundfonts (haven't tested this yet)
01:24
which windows audio driver is used I wonder
01:24
WDM, ASIO, WASAPI, MME (edited)
01:24
they have different latencies
01:27
01:27
oh you can use this 'Oboe' asset hmmmm
Avatar
oh that's for android hmm
Avatar
Avatar
Astrah
oh that's for android hmm
Yes!
Avatar
Avatar
Astrah
WDM, ASIO, WASAPI, MME (edited)
MME, I'm afraid 😉
Avatar
Avatar
Matt
This was asked about a couple weeks ago in the forum thread; Thierry indicated it would be fixed in the next version.
Thank Matt, I confirm ... I hope to publish the 2.88.3 in 1 or 2 weeks.
Avatar
Avatar
Thierry
Thank Matt, I confirm ... I hope to publish the 2.88.3 in 1 or 2 weeks.
Bryan Dempsey 22/08/2021 14:33
Hi Thierry, I recall seeing somewhere a MPTK script that would allow the MIDI file player to advance a quarter note's worth of ticks. But I haven't been able to find it since. Can someone tell me where it is? Thanks.
Avatar
Avatar
Thierry
MME, I'm afraid 😉
Oooh okay np, for my sequencer to get low latency I'm just having it require a keyboard w on board sounds atm, because software audio drivers are a nightmare. For example, i don't want to require the user to download an external ASIO driver. But, I want my sequencer to require low latency (edited)
Avatar
Avatar
Bryan Dempsey
Hi Thierry, I recall seeing somewhere a MPTK script that would allow the MIDI file player to advance a quarter note's worth of ticks. But I haven't been able to find it since. Can someone tell me where it is? Thanks.
You use.....
17:52
Midiloader to load the midi file
17:53
Then midiloader has a "ticksperquarternote"
17:53
Value
17:54
Midiloader ticks per quarter note - > midiplayer current time in ticks in the song
Avatar
Avatar
Bryan Dempsey
Hi Thierry, I recall seeing somewhere a MPTK script that would allow the MIDI file player to advance a quarter note's worth of ticks. But I haven't been able to find it since. Can someone tell me where it is? Thanks.
midiFileLoader.MPTK_DeltaTicksPerQuarterNote
Avatar
Avatar
Bryan Dempsey
Hi Thierry, I recall seeing somewhere a MPTK script that would allow the MIDI file player to advance a quarter note's worth of ticks. But I haven't been able to find it since. Can someone tell me where it is? Thanks.
Documentation application programm interface for MIDI player tool kit
Avatar
so MPTK_TickCurrent + MPTK_DeltaTicksPerQuarterNote
Avatar
Jay'Quellin 02/10/2021 00:22
Hello! I was wondering if there was a way to load MIDI files from a folder at runtime? I know you can use the tool in the editor to add them but what if you wanted to let users add their own tracks.
Avatar
Of course, you can use the persistenrdatapath folder for the path (or streaming assets path) and use the midifileloader (I think)
00:24
If midifileloader isn't correct, it's still possible I just forgot how
Avatar
Jay'Quellin 02/10/2021 00:24
I'll do some digging around there then. Thank you for the help!
Avatar
No problem, ask Thibach and look on his website for a full reference guide
00:26
It's very easy to do once you understand the basics of the api
Avatar
Can i use unity built in timeline to control midi Playback?
Avatar
Yes with
14:24
It's a callback
14:24
Onaudiofilter I think?
14:24
In unity they have example code
Avatar
Avatar
Jay'Quellin
I'll do some digging around there then. Thank you for the help!
Hello, thank @Astrah for your help! Yes @Jay'Quellin loading and playing from local device or even web, is possible with the prefab MidiExternalPlay
08:37
See here
08:38
And here, you will be able to find some information how to use this prefab https://paxstellar.fr/midi-external-player-v2/ (edited)
Avatar
Avatar
shage
Can i use unity built in timeline to control midi Playback?
Hi. The current playing position in the MIDI can be read and set with MPTK_Position (in millisecond) and with MPTK_TickCurrent (MIDI tick). So, I think it's possible with a timeline, but i'm not an expert with Unity timeline. (edited)
Avatar
Hi, I would like to know if this plugin works with iOS and Android, Thanks 🙂
Avatar
Hi. Yes, sure ! the known limitation is for webgl app, thread implementation is too weak ... (edited)
Avatar
Jay'Quellin 13/10/2021 00:21
Hello. I just upgraded from 2.84 to 2.89 and some changes to how the playback position is tracked seem to be causing me some issues. I was hoping I could get some help fixing it. I have a midi file that I am loading in using the MidiExternalPlayer. I am trying to start the midi file at an offset of a few seconds ahead of my music track to spawn objects in time for them to line up with what the game needs. The midi file in question doesn't have any notes until about 8 seconds into the track. I am only trying to start the playback position maybe a second or so ahead. But since I updated to the new version, the midi player is treating my file as though I have the Start Play at First Note option set and when I adjust the playback one second forward, it sets the playback position to 8 seconds throwing everything off balance. Is there anything that I can do to fix this?
Avatar
Jay'Quellin 13/10/2021 00:28
I think this method is the culprit. It looks like it's trying to get the position of a midi event in the track, but since the track doesn't have any notes until the previously mentioned 8 second mark it's not working as I would expect
Avatar
Jay'Quellin 13/10/2021 02:18
For context, I am trying to set the position using the MPTK_Position property which uses this method
Avatar
Documentation application programm interface for MIDI player tool kit
08:38
But i am getting this error: MidiFilePlayer - No MIDI loaded - MPTK_ReadMidiEvents canceled
Avatar
Avatar
shage
But i am getting this error: MidiFilePlayer - No MIDI loaded - MPTK_ReadMidiEvents canceled
First thing to check is that you called MPTK_Load(). If you're already doing that, it means it hasn't finished loading yet. There's a callback event I can't remember the exact name of right now because I'm not at my computer but it's something along the lines of midiFilePlayer.OnMidiLoad and you should call whatever you're doing from there. (edited)
Avatar
Avatar
shage
But i am getting this error: MidiFilePlayer - No MIDI loaded - MPTK_ReadMidiEvents canceled
Thank @Matt for your help. But the method MPTK_Load is synchrone. So, when it returns the MIDI is fully loaded ... or an error has been detected when reading the MIDI. Could you check the return of the MPTK_Load ? null if MIDI is not loaded or not well selected with midiplayer.MPTK_MidiIndex. You can also send me the MIDI I will check it.
Avatar
Avatar
Jay'Quellin
For context, I am trying to set the position using the MPTK_Position property which uses this method
hi, not easy to help you even though your issue is well documented. If I well understand, there is any MIDI event before 8 seconds ? For sure, since 2.84 a lot of improvement has been done to the MIDI timing. But the methof MPTK_SearchTickFromTime is quite new, doesn't exists in 2.84 ?
Avatar
Avatar
Thierry
hi, not easy to help you even though your issue is well documented. If I well understand, there is any MIDI event before 8 seconds ? For sure, since 2.84 a lot of improvement has been done to the MIDI timing. But the methof MPTK_SearchTickFromTime is quite new, doesn't exists in 2.84 ?
Jay'Quellin 13/10/2021 18:59
Hi ThiBach. Thank you for responding. That's correct, there are no midi events until about 8 seconds into the track. The song I made uses an mp3 file and I have a midi file for the underlying note track. The song has an intro of 8 seconds where there is no events. I'm not really sure if the MPTK_SearchTickFromTime method existed before 2.84, I can't go back and check because I can no longer download 2.84 but when I upgraded yesterday because I had bought the pro version when I try to start my song at the desired time it skips up right to the first note. It had been working fine before.
Avatar
@Thierry MidiLoad is not null here is the midi
8.39 KB
Avatar
Avatar
Jay'Quellin
Hi ThiBach. Thank you for responding. That's correct, there are no midi events until about 8 seconds into the track. The song I made uses an mp3 file and I have a midi file for the underlying note track. The song has an intro of 8 seconds where there is no events. I'm not really sure if the MPTK_SearchTickFromTime method existed before 2.84, I can't go back and check because I can no longer download 2.84 but when I upgraded yesterday because I had bought the pro version when I try to start my song at the desired time it skips up right to the first note. It had been working fine before.
You are right, MPTK_SearchTickFromTime will return the first MIDI event found at 8 second. Why not insert MIDI event other than NoteOn before, at the right place ? for example a Meta Event of type text ?
Avatar
Avatar
Thierry
You are right, MPTK_SearchTickFromTime will return the first MIDI event found at 8 second. Why not insert MIDI event other than NoteOn before, at the right place ? for example a Meta Event of type text ?
Jay'Quellin 13/10/2021 20:51
That sounds like it could work, can I add that to a midi file that's already loaded programmatically?
20:51
Is there an example of how to do that on your site?
Avatar
Avatar
shage
@Thierry MidiLoad is not null here is the midi
The MIDI feel good, any issue on my side
Avatar
Avatar
shage
@Thierry MidiLoad is not null here is the midi
perhaps an error when you select the MIDI ? YOu could send me all the script with the concern ....
Avatar
Avatar
Jay'Quellin
That sounds like it could work, can I add that to a midi file that's already loaded programmatically?
Sorry, MPTK can't add MIDI event in a MIDI file (perhaps in a future version ?) But it's very easy with a sofware lake cakewalk (and free) https://www.bandlab.com/products/cakewalk (edited)
The next generation of SONAR, the world’s finest and most powerful desktop DAW - now FREE.
Avatar
Jay'Quellin 13/10/2021 21:00
So there is no way to just insert a MPTK_Event with the correct delay to the front after I've loaded it in?
Avatar
Jay'Quellin 13/10/2021 21:09
I don't want to save it to the midi file, I just want it there for telling the engine where to start the track.
Avatar
this could help you :
21:15
or pehaps more simple:
21:16
and launch a counter until the time you want
Avatar
Jay'Quellin 13/10/2021 21:17
The second one sounds like it'd work. Is there a way to convert ticks into milliseconds? I noticed the MPTK_ConvertTimeToTick method was missing after I upgraded (edited)
Avatar
you want a time in ticks ?
Avatar
Jay'Quellin 13/10/2021 21:19
The example you gave shows using midiFilePlayer.MPTK_TickCurrent = 500;
21:20
So I'd need to figure out how to change for example 500 ms into ticks wouldn't I? (edited)
Avatar
midiFilePlayer.MPTK_MidiLoaded.MPTK_ConvertTimeToTick(500)
Avatar
Jay'Quellin 13/10/2021 21:21
Thank you so much!
Avatar
or the inverse
21:22
midiFilePlayer.MPTK_MidiLoaded.MPTK_ConvertTickToTime(1000)
Avatar
Avatar
Jay'Quellin
Thank you so much!
good! now it's time for me to sleep. Bye 🙂 (edited)
Avatar
good night
Avatar
Jay'Quellin 13/10/2021 21:23
Good night!
Avatar
Good night!
Avatar
Jay'Quellin 13/10/2021 22:35
Just wanted to pop back in and say that it worked thank you for all your help
👍 1
Avatar
Legendary Blue 12/11/2021 04:13
Does this plugin also work as a midi player where we are able to designate say specific instruments?
Avatar
Avatar
Legendary Blue
Does this plugin also work as a midi player where we are able to designate say specific instruments?
Silverknight 26/11/2021 16:57
What I am doing with my current project is reading the midi file and sending PatchChange events to 16 keyboard objects I have in my scene and that updates their patch numbers to then show on their displays what instrument they are supposed to mimic when their keys are pressed. The PatchChange event is sent to the synth and that's what actually changes so that all the incoming NoteOn events sent to that channel sound like the instrument they represent. I'm not sure what else you mean based on your question. If you need a screenshot or so I can send one. Sorry this is late, I only joined recently.
17:00
Is there a way to read a whole midi file, determine the note count per channel, and get the midi note average per channel, before it plays? I'm looking for a dynamic way to set octave offsets for my instruments before any midi file is ran so I do not have to listen to everyone of my files and manually set them myself and store it somewhere. (edited)
Avatar
Silverknight 26/11/2021 17:19
I may have found a lead. I'll update this as I continue investigating.
Avatar
Silverknight 29/11/2021 03:00
I was able to build a solution using MPTK and got it working.
Avatar
AhmetSaidOlgun 16/12/2021 11:23
Hi guys, I have a question. I am trying to control channels, I am using "MPTK_ChannelEnableSet(1,false);" . Then I am debugging is it true or false. It says it is false but I can still hear the channel. Does anyone know how to solve it?
Avatar
Avatar
AhmetSaidOlgun
Hi guys, I have a question. I am trying to control channels, I am using "MPTK_ChannelEnableSet(1,false);" . Then I am debugging is it true or false. It says it is false but I can still hear the channel. Does anyone know how to solve it?
Hi, strange. Are you sure that the MIDI events you want to disable are on channel 1 ? Try with the demo PLay Midi with script and with your MIDI
09:29
Avatar
Avatar
Thierry
Hi, strange. Are you sure that the MIDI events you want to disable are on channel 1 ? Try with the demo PLay Midi with script and with your MIDI
AhmetSaidOlgun 17/12/2021 11:42
Yes, it helped me. Thanks alot (edited)
Avatar
AhmetSaidOlgun 23/12/2021 13:31
Hello again, My 3D object is moving and my midi file is playing in the background. Is there any event or way I can solve any synchronization problems that may occur in the future?
Avatar
Avatar
AhmetSaidOlgun
Hello again, My 3D object is moving and my midi file is playing in the background. Is there any event or way I can solve any synchronization problems that may occur in the future?
Hello. Sorry for the delay and on top of that, I don't understand your question!
Avatar
Avatar
Thierry
Hello. Sorry for the delay and on top of that, I don't understand your question!
AhmetSaidOlgun 03/01/2022 18:15
Firstly, happy new year! Secondly, I guess I should be more specific. I have an animation in unity project and midi file is playing in the background. For now, it seems good but I wonder that if any problem occurs in the animation(like lagging) my midi file will be still playing and this can be a synchronization problem. Do you know how can I check that in the scene?
Avatar
Hello, happy new year, if possible better than the last one ! Since the V2, the Midi player in Maestro is playing in a dedicated thread, apart of the main thread of Unity. Also delays or low FPS in Unity have no impact on the MIDI player. Of course, if the CPU is overbooked it's another story ! (edited)
👍 1
Avatar
Jay'Quellin 07/01/2022 03:05
Hello, I'm running into an issue with my application where even though I am pausing my midi file explicity, when I click focus off the window and back on, it resumes playing the midi file leading to synchronization issues in my rhythm game. The issue seems to be coming from these two methods in the MidiFIlePlayer.cs file. private void OnApplicationPause(bool pause) { //Debug.Log("MidiFilePlayer OnApplicationPause " + pause); if (pause && MPTK_PauseOnFocusLoss) watchMidi.Stop(); else if (!watchMidi.IsRunning) watchMidi.Start(); } void OnApplicationFocus(bool hasFocus) { //Debug.Log("MidiFilePlayer OnApplicationFocus " + hasFocus); if (!hasFocus && MPTK_PauseOnFocusLoss) watchMidi.Stop(); else if (!watchMidi.IsRunning) watchMidi.Start(); } I have Pause On Focus loss set but even though I have that checked, the code in the else if (!watchMidi.IsRunning) blocks are still running, causing a few seconds of the midi file to play ahead of my music track. I believe you can replicate this issue by explicitly calling the pause function from code, unfocusing the application window and refocusing it, which will cause the midi to play even though it is supposed to remain paused. (edited)
03:08
Commenting those lines fixed the issue for me but that is obviously not good practice for me to edit your code (edited)
Avatar
Hello, I'm reading your post now, it's a little late for me. I will read this carefully tomorrow.
Avatar
Avatar
Jay'Quellin
Hello, I'm running into an issue with my application where even though I am pausing my midi file explicity, when I click focus off the window and back on, it resumes playing the midi file leading to synchronization issues in my rhythm game. The issue seems to be coming from these two methods in the MidiFIlePlayer.cs file. private void OnApplicationPause(bool pause) { //Debug.Log("MidiFilePlayer OnApplicationPause " + pause); if (pause && MPTK_PauseOnFocusLoss) watchMidi.Stop(); else if (!watchMidi.IsRunning) watchMidi.Start(); } void OnApplicationFocus(bool hasFocus) { //Debug.Log("MidiFilePlayer OnApplicationFocus " + hasFocus); if (!hasFocus && MPTK_PauseOnFocusLoss) watchMidi.Stop(); else if (!watchMidi.IsRunning) watchMidi.Start(); } I have Pause On Focus loss set but even though I have that checked, the code in the else if (!watchMidi.IsRunning) blocks are still running, causing a few seconds of the midi file to play ahead of my music track. I believe you can replicate this issue by explicitly calling the pause function from code, unfocusing the application window and refocusing it, which will cause the midi to play even though it is supposed to remain paused. (edited)
Hello, right there is some issue between pause and focus lost. Below a patch until I publish a new version
09:18
`private bool pauseWhenFocusLost = false; void OnApplicationFocus(bool hasFocus) { //Debug.Log("MidiFilePlayer OnApplicationFocus " + hasFocus); if (MPTK_PauseOnFocusLoss) { if (!hasFocus) { if (!MPTK_IsPaused) { // focus lost, need to be paused pauseWhenFocusLost = true; MPTK_Pause(); } } else { // unpause only if has been paused from a focus lost if (pauseWhenFocusLost) MPTK_UnPause(); } } } `
(edited)
09:22
and in MPTK_UnPause() add the line pauseWhenFocusLost = false; (edited)
09:23
public void MPTK_UnPause() { try { // add this line: pauseWhenFocusLost = false; if (MPTK_CorePlayer) { if (timeMidiFromStartPlay <= 0d) watchMidi.Reset(); // V2.82 watchMidi.Start(); playPause = false; } else { playPause = false; } } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } } (edited)
Avatar
Avatar
Thierry
Hello, right there is some issue between pause and focus lost. Below a patch until I publish a new version
Jay'Quellin 08/01/2022 17:34
Thank you for providing me with a Solution. I'll test it out and let you know
Avatar
AhmetSaidOlgun 13/01/2022 13:53
Hi guys, I have a question. MPTK gives the current tick position for general but I want to access current tick for specific channel. Do you know that how can I access this data?
Avatar
Avatar
AhmetSaidOlgun
Hi guys, I have a question. MPTK gives the current tick position for general but I want to access current tick for specific channel. Do you know that how can I access this data?
Hello, tick is a global parameter for a midi playing, not defined by channel. Luckily, all channels are playing with the same ticks synchronization. Imagine a channel 9 (drum) with a different sync that the guitar ? (edited)
Avatar
Avatar
Thierry
Hello, tick is a global parameter for a midi playing, not defined by channel. Luckily, all channels are playing with the same ticks synchronization. Imagine a channel 9 (drum) with a different sync that the guitar ? (edited)
AhmetSaidOlgun 14/01/2022 09:15
Okay, thanks. Well, do you know how can I access those data especially the name of the note in the current tick?
Avatar
ok, I will answer tomorrow, it's a little late in my TZ 😉
Avatar
Avatar
AhmetSaidOlgun
Okay, thanks. Well, do you know how can I access those data especially the name of the note in the current tick?
Documentation application programm interface for MIDI player tool kit
Avatar
Avatar
AhmetSaidOlgun
Okay, thanks. Well, do you know how can I access those data especially the name of the note in the current tick?
Documentation application programm interface for MIDI player tool kit
07:31
Documentation application programm interface for MIDI player tool kit
07:33
Documentation application programm interface for MIDI player tool kit
Avatar
AhmetSaidOlgun 18/01/2022 14:43
Thanks!
Avatar
sdappster 09/02/2022 00:17
In iOS, we encounter a constant problem with a MPTK app in TestFlight debugging. In an app with a scene that the midstreamplayer prefab has been opened once, if the user leaves the device and minimizes the app idle to the background for awhile, the iOS shows the app has crashed when user comes back to the device again . Also, if the user force quits the app, after the app has been previously minimized once in a scene that midstreamplayer is used, the app crashes after it is closed. There is something in the library that prevents Unity cleanup to clear the memory in time before it is killed by iOS. "Killed by watchdog". How could this be solved? (edited)
Avatar
Hi, I lost my desktop, I need to rebuild it ☹️ perhaps in a few days....
12:52
I let you inform
Avatar
hello, for the midi player there is ths setting:
13:42
13:42
pause when focus loss
13:43
but not for midi stream because there is no background task for playing the midi (edited)
Avatar
you could try something like that in your code
14:41
` void OnApplicationFocus(bool hasFocus) { //Debug.Log("MidiFilePlayer OnApplicationFocus " + hasFocus); if (!hasFocus) midiStreamPlayer.MPTK_StopSynth(); else midiStreamPlayer.MPTK_InitSynth(); }`
Avatar
sdappster 14/02/2022 15:13
Thank you! I will let you know the result.
Avatar
sdappster 18/02/2022 07:48
The approach doesn't make a difference. When a user force quits the app with a scene containing midstreamplayer prefab, everything works fine. But, if the user send the app with the same scene to the background and later force quits the app, the iOS counts as a crash after several seconds. Apparently, Unity clean up function does not work in this case.
07:49
I remember something in MPTK that creates a time delay when synth is stopped. I wonder if that could be the case
Avatar
Hello, have you search some reference in the web ? like ios unity crashes background ?
Avatar
sdappster 18/02/2022 07:52
Yes. This is not a real crash. It is something in the app that is stopping the application to quit within the time limit, so iOS just wipes the app from the memory.
07:54
It is an issue of quiting within the time limit of the iOS. Not a problem with memory size.
07:57
If I open the scene with the prefab and force quit, there is no problem. It only happens when the app has been sent to the background once with this scene and I later force quit the app, even if from a scene not using the prefab. (edited)
Avatar
perhaps the AudioSource associated to the prefab ... It's the only components which run independently of the main Unity loop (Update call)
Avatar
try this in you app:
08:23
void OnApplicationFocus(bool hasFocus) { Debug.Log("TestMidiStream OnApplicationFocus " + hasFocus); if (!hasFocus) { midiStreamPlayer.MPTK_StopSynth(); midiStreamPlayer.CoreAudioSource.enabled = false; } else { midiStreamPlayer.MPTK_InitSynth(); midiStreamPlayer.CoreAudioSource.enabled = true; } }
08:24
the audio source associated to the MidiStream prefab will be disable in background
Avatar
sdappster 18/02/2022 08:24
Thanks, I will report back.
Avatar
sdappster 18/02/2022 08:54
When the Coreaudio Source code is added, there is no sound after refocus.
Avatar
That's ok for me with the Unity editor. Not you ?
Avatar
AhmetSaidOlgun 21/02/2022 10:14
Hello, I am trying to create midi from script. If I give a value less than 40 (for example 36 for G3) the sound is broken. For the values more than 40, everything works properly. Do you know what is wrong?
Avatar
Hello, yes I think that your patch (preset) is not able to play below G3. Which soundfont and preset are you using ?
Avatar
AhmetSaidOlgun 21/02/2022 12:47
Bank Preset Name 0 0 FG460s Pure Gtr 0 1 FG460s Mega Gtr 0 2 Mega Chorus Gtr 0 3 12Str Natural Gtr 0 4 12Str Natural Trm 0 5 Equalized Guitar 0 6 MegaSlider@ 0 7 Rich Pst Gu...
Avatar
by default it's the preset 0 in the SoundFont, here:
13:49
try to load this soundfont in viena
13:50
SynthFont, Viena, VSTSynthFont and SyFonOne are the four main tools provided here for playing with MIDI files and SoundFonts, SynthFont lets you also edit MIDI files while Viena lets you edit SoundFonts. Use SynthFont to create audio files for playback on other devices.
13:50
to see how this preset is configure
👍 1
Avatar
sdappster 21/02/2022 23:36
Hi, in iOS version of editor, if Coreaudiosource is disabled when the application is out of focus, there is no sound when it is enabled again when the application re-enters focus.
Avatar
hi @Thierry I am goldbug, I left a review in the asset store and you asked me to post here. I am also the one that figured out how to compress the font with Vorbis. Here is my feedback:
  • Removing songs is painful. If I have 100 songs in the MIDI file setup, to delete them I have to delete one at a time. Roughly 300 clicks or so. I suggest using a standard multi-select, so I can select them all and click on delete once.
  • The list of files does not highlight the selected file. I can only tell the selected file by looking at the right panel and matching the name in the list, not great usability.
  • The delete button has no label at all in mac, it is just blank, I had to guess which one was the delete button
  • I suggest moving the top-level menu inside Assets. Seems every asset in the asset store wants a top-level menu and it gets really crowded up there.
Thanks for making maestro and providing a free version.
Avatar
Avatar
Thierry
to see how this preset is configure
AhmetSaidOlgun 23/02/2022 22:24
Thanks, I solved my problem by incrementing each value by 12
Avatar
Avatar
goldbug1
hi @Thierry I am goldbug, I left a review in the asset store and you asked me to post here. I am also the one that figured out how to compress the font with Vorbis. Here is my feedback:
  • Removing songs is painful. If I have 100 songs in the MIDI file setup, to delete them I have to delete one at a time. Roughly 300 clicks or so. I suggest using a standard multi-select, so I can select them all and click on delete once.
  • The list of files does not highlight the selected file. I can only tell the selected file by looking at the right panel and matching the name in the list, not great usability.
  • The delete button has no label at all in mac, it is just blank, I had to guess which one was the delete button
  • I suggest moving the top-level menu inside Assets. Seems every asset in the asset store wants a top-level menu and it gets really crowded up there.
Thanks for making maestro and providing a free version.
Hello Paul, thank you for these interesting remarks. Some answers:
  • Removing songs is painful. In fact all MIDI are just files in a folder. So, open the folder (with button Open Folder), remove the .bin (useless to removes the . META. They will automatically removed to the list in Maestro when focus comes back. It's also possible to add directly MIDI files in this folder, they will be added to the MIDI list in Maestro.
(edited)
👍 1
22:26
Avatar
Avatar
AhmetSaidOlgun
Thanks, I solved my problem by incrementing each value by 12
Good !
Avatar
Avatar
goldbug1
hi @Thierry I am goldbug, I left a review in the asset store and you asked me to post here. I am also the one that figured out how to compress the font with Vorbis. Here is my feedback:
  • Removing songs is painful. If I have 100 songs in the MIDI file setup, to delete them I have to delete one at a time. Roughly 300 clicks or so. I suggest using a standard multi-select, so I can select them all and click on delete once.
  • The list of files does not highlight the selected file. I can only tell the selected file by looking at the right panel and matching the name in the list, not great usability.
  • The delete button has no label at all in mac, it is just blank, I had to guess which one was the delete button
  • I suggest moving the top-level menu inside Assets. Seems every asset in the asset store wants a top-level menu and it gets really crowded up there.
Thanks for making maestro and providing a free version.
  • The list of files does not highlight the selected file.
  • The delete button has no label at all in mac,
Ok, I check this point tomorrow on a Mac (it's ok in my desktop)
Avatar
Avatar
goldbug1
hi @Thierry I am goldbug, I left a review in the asset store and you asked me to post here. I am also the one that figured out how to compress the font with Vorbis. Here is my feedback:
  • Removing songs is painful. If I have 100 songs in the MIDI file setup, to delete them I have to delete one at a time. Roughly 300 clicks or so. I suggest using a standard multi-select, so I can select them all and click on delete once.
  • The list of files does not highlight the selected file. I can only tell the selected file by looking at the right panel and matching the name in the list, not great usability.
  • The delete button has no label at all in mac, it is just blank, I had to guess which one was the delete button
  • I suggest moving the top-level menu inside Assets. Seems every asset in the asset store wants a top-level menu and it gets really crowded up there.
Thanks for making maestro and providing a free version.
  • I suggest moving the top-level menu inside Assets. Seems every asset in the asset store wants a top-level menu and it gets really crowded up there.
Sure, that could be better. However, user hhave the habit of this menu 😉 I will find a solution with a setup.
Avatar
Avatar
Thierry
  • The list of files does not highlight the selected file.
  • The delete button has no label at all in mac,
Ok, I check this point tomorrow on a Mac (it's ok in my desktop)
for some reason the delete button is fine now, but this is what the list looks like:
22:31
22:31
as you can see, there is no way to tell which song in the list is selected other than by looking at the name. I would expect the selected song to be highlighted in blue like a normal list.
Avatar
like this ....
Avatar
yeah, that would be great
Avatar
Which version of Unity ?
Avatar
2021.2.8
22:36
let me try with 2021.2.11, one sec...
22:38
yeah, same thing, no highlight.
Avatar
ok, It's late here, I will check this on Mac tomorrow. See you later.
Avatar
ty, bye
Avatar
Avatar
goldbug1
ty, bye
Hi, checked with 2021.2, any issue on Windows, I will test tomorrow on MacOS.
👍 1
Avatar
Checked with MacOS, yes, same issue. It seems there is a problem with the skin. I will publish an update when corrected (for now I dont understand why !)
Avatar
Incredible, I can't find a solution with MacOS. It seems that setting customs style for GUI doesn't work. Nothing about that on the web. I continue finding a solution ... (edited)
Avatar
AhmetSaidOlgun 03/03/2022 12:13
Hello, how can I access the track names? I looked the codes in "Test Midi File Player" but I could not understand.
Avatar
Avatar
goldbug1
for some reason the delete button is fine now, but this is what the list looks like:
that was painful, but now it's ok. The Mac version of Maestro is beautiful 😉
♥️ 1
13:28
13:29
I hope to publish a new version next week 😀
Avatar
Avatar
AhmetSaidOlgun
Hello, how can I access the track names? I looked the codes in "Test Midi File Player" but I could not understand.
Sorry, I miss your demand, have you find ?
Avatar
Avatar
Thierry
Sorry, I miss your demand, have you find ?
AhmetSaidOlgun 06/03/2022 14:14
Nope, I am still trying to do it
Avatar
Avatar
AhmetSaidOlgun
Nope, I am still trying to do it
Track name are just another kind o MIDI event.
19:20
Avatar
Personuo诺 06/03/2022 19:21
Hello, I want to accept input signals from midi devices on ios, android, windows and macos, will this tool work?
Avatar
Avatar
AhmetSaidOlgun
Nope, I am still trying to do it
As usualy you can catch it with MPTKEvent
19:26
midiFilePlayer.OnEventNotesMidi.AddListener(MidiReadEvents); public void MidiReadEvents(List<MPTKEvent> midiEvents) { foreach (MPTKEvent midiEvent in midiEvents) { switch (midiEvent.Command) { case MPTKCommand.MetaEvent: switch (midiEvent.Meta) { case MPTKMeta.SequenceTrackName: infoSeqTrackName += $"Track:{midiEvent.Track:00} '{midiEvent.Info}'\n"; //Debug.LogFormat($"SequenceTrackName Track:{midiEvent.Track} {midiEvent.Value} Name:'{midiEvent.Info}'"); break; } break; } } }
19:26
See full code in Assets\MidiPlayer\Demo\FreeDemos\Script\TestMidiFilePlayerScripting.cs
Avatar
Avatar
Personuo诺
Hello, I want to accept input signals from midi devices on ios, android, windows and macos, will this tool work?
Hello, only from windows and macos. Sorry 😉
Avatar
Personuo诺 06/03/2022 19:27
ok...sad
Avatar
Avatar
Thierry
midiFilePlayer.OnEventNotesMidi.AddListener(MidiReadEvents); public void MidiReadEvents(List<MPTKEvent> midiEvents) { foreach (MPTKEvent midiEvent in midiEvents) { switch (midiEvent.Command) { case MPTKCommand.MetaEvent: switch (midiEvent.Meta) { case MPTKMeta.SequenceTrackName: infoSeqTrackName += $"Track:{midiEvent.Track:00} '{midiEvent.Info}'\n"; //Debug.LogFormat($"SequenceTrackName Track:{midiEvent.Track} {midiEvent.Value} Name:'{midiEvent.Info}'"); break; } break; } } }
AhmetSaidOlgun 07/03/2022 09:18
Okay thanks. Can I access the instrument names with the same method?
Avatar
Avatar
AhmetSaidOlgun
Okay thanks. Can I access the instrument names with the same method?
Yes ! All textual informations. If available 😁
😀 1
Avatar
AhmetSaidOlgun 08/03/2022 20:46
I am using logic pro to create midi files and I have 10 channels and I gave track name for each of them. For example my last channel is classic guitar channel and its track name is also "classic channel". When I play this midi file in maestro, channels order are changing but track names are not changing/matching.(When I debug first channel's track name, it says "voice" but because of the channel order change, it plays classical guitar channel) How can I fix it? (edited)
Avatar
Avatar
AhmetSaidOlgun
I am using logic pro to create midi files and I have 10 channels and I gave track name for each of them. For example my last channel is classic guitar channel and its track name is also "classic channel". When I play this midi file in maestro, channels order are changing but track names are not changing/matching.(When I debug first channel's track name, it says "voice" but because of the channel order change, it plays classical guitar channel) How can I fix it? (edited)
I have 10 channels and I gave track name for each of them Sadly, channels can't have name, only tracks (it's a a MIDI limitation, not Maestro). Tracks are a virtual view of your composition not a real organization of the MIDI events. (edited)
Avatar
Avatar
AhmetSaidOlgun
I am using logic pro to create midi files and I have 10 channels and I gave track name for each of them. For example my last channel is classic guitar channel and its track name is also "classic channel". When I play this midi file in maestro, channels order are changing but track names are not changing/matching.(When I debug first channel's track name, it says "voice" but because of the channel order change, it plays classical guitar channel) How can I fix it? (edited)
channels order are changing channel order is not a MIDI concept! the only order in a MIDI is the order of MIDI event (tick position)
(edited)
Avatar
Avatar
AhmetSaidOlgun
I am using logic pro to create midi files and I have 10 channels and I gave track name for each of them. For example my last channel is classic guitar channel and its track name is also "classic channel". When I play this midi file in maestro, channels order are changing but track names are not changing/matching.(When I debug first channel's track name, it says "voice" but because of the channel order change, it plays classical guitar channel) How can I fix it? (edited)
But, often in a MIDI where you have one instrument by channel, the tracks name are used to defined name of channel.
(edited)
Avatar
Avatar
AhmetSaidOlgun
I am using logic pro to create midi files and I have 10 channels and I gave track name for each of them. For example my last channel is classic guitar channel and its track name is also "classic channel". When I play this midi file in maestro, channels order are changing but track names are not changing/matching.(When I debug first channel's track name, it says "voice" but because of the channel order change, it plays classical guitar channel) How can I fix it? (edited)
Finally, channel 0 is often used to defined "textual" information, channel 1 for the first instrument and so on ... (edited)
02:14
Avatar
AhmetSaidOlgun 09/03/2022 13:49
Thank you for your answers! I am adding channel mannager to my project, this is why I was asking but as I can understand "track names" is not my solution. I will try to access instrunments for each channel
Avatar
Avatar
AhmetSaidOlgun
Thank you for your answers! I am adding channel mannager to my project, this is why I was asking but as I can understand "track names" is not my solution. I will try to access instrunments for each channel
Y es, better!
Avatar
Hello! Had a question - with your plugin, can I play MIDI file/track note-by-note via unity events? For example, each time the user Clicks, a song progresses note-by-note
Avatar
Avatar
Citan
Hello! Had a question - with your plugin, can I play MIDI file/track note-by-note via unity events? For example, each time the user Clicks, a song progresses note-by-note
Hello, yes it's possible but you need to write script. for example, read all the MIDI events (with MidiFileLoader) then playing events with MidiStreamPlayer based on user actions. (edited)
Avatar
Ok, thanks for the clarification
Avatar
@Thierry It would be nice to get rid of these allocations wich happen every single frame
Avatar
Avatar
goldbug1
@Thierry It would be nice to get rid of these allocations wich happen every single frame
Are you using a dedicated package to get these informations ?
Avatar
Avatar
Thierry
Are you using a dedicated package to get these informations ?
I am using the unity profiler
Avatar
I can run it with deep profiler to find out exactly where the allocations are if it would help.
Avatar
the GC is a normal process with a language as C#. That could be problematic if huge volume of data are allocated at each frame or if free is not done correctly. I didn't see any issue like this.
Avatar
Allocations are normal part of c# yes, but they are something you normally want to avoid in unity because the more allocations you do the more GC spikes you get. Especially allocations that happen every frame. That said, you are not allocating a lot in your library, so it is not a big deal. It would be nice if the lib was allocation free, but it is not the end of the world.
Avatar
Hi @Thierry can you please tell how can I change the tempo of the midi that is being played?
Avatar
Avatar
SR EY
Hi @Thierry can you please tell how can I change the tempo of the midi that is being played?
Hello @SR EY, sorry I missed your message. You can't with the current version, only change the speed. So if the tempo is 100, with a MPTK_Speed of 0.8, the tempo will be 80. Sure, it's not satisfying, the new version (in preparation) will be able to change directly the tempo with MPTK_Tempo = 80. Regards (edited) (edited)
Avatar
Thank you so much @Thierry for your reply. It surely saved me alot.
Avatar
chromodyne 08/04/2022 04:40
Is it possible to send output to my hardware synth for playback with Maestro?
Avatar
Avatar
chromodyne
Is it possible to send output to my hardware synth for playback with Maestro?
Hello, yes with Maestro Pro. See here for doc https://paxstellar.fr/class-midikeyboard/
Use your Midi device (synthesizer, keyboard, light console, ...) in your Unity application. Midi Player Tool Kit is your friend :-)
Avatar
FalconEagle 26/04/2022 17:10
I am using URP pipeline on Unity 2021.3 LTS, Windows 10. How to get the examples working with URP. Answer: Used Windows/Rendering/Render Pipeline Converter (edited)
Avatar
Hi @Thierry I've discovered a small issue that you can hear in the video below. At 0:50 and again at 1:04, the woodwinds play and in the silence after you can hear the reverb cut out briefly, then come in again just before the strings start playing. You may need to use headphones to hear it. It seems to happen only with the woodwinds, the reverb does not cut out after the strings play a similar figure. I thought it might be the soundfont's settings, but it happens with all the soundfonts I've tried. For reference, the soundfont being used is GeneralUser GS. https://youtu.be/7vSnMCtIf18 (edited)
Avatar
Avatar
FalconEagle
I am using URP pipeline on Unity 2021.3 LTS, Windows 10. How to get the examples working with URP. Answer: Used Windows/Rendering/Render Pipeline Converter (edited)
Thank for the information!
Avatar
Avatar
JWerner
Hi @Thierry I've discovered a small issue that you can hear in the video below. At 0:50 and again at 1:04, the woodwinds play and in the silence after you can hear the reverb cut out briefly, then come in again just before the strings start playing. You may need to use headphones to hear it. It seems to happen only with the woodwinds, the reverb does not cut out after the strings play a similar figure. I thought it might be the soundfont's settings, but it happens with all the soundfonts I've tried. For reference, the soundfont being used is GeneralUser GS. https://youtu.be/7vSnMCtIf18 (edited)
Hi, strange, surely. Have you the MIDI file ?
Avatar
Avatar
Thierry
Hi, strange, surely. Have you the MIDI file ?
Sure
Avatar
FalconEagle 10/05/2022 01:08
Hi @Thierry, It would be great for Maestro to work in Webgl as more and more projects are being published for the browser. I know that Maestro has been blocked because of Webgl is not multi-threaded. I've been in very indepth discussion with the maker of Unified Midi asset on the asset store and he also has similar issues with making work in webgl. After research, we came upon a great idea that would work and perhaps could also work for Maestro.
01:12
The idea is to use open source JS midi synths with unity in either as: 1. Included JS lib within unity project 2. External JS lib that is included with WebGL html wrapper. With this solution, Unity Webgl only has to just send the soundfonts to the external JS midi synth to play. These external JS midi libs uses Webworkers which is like multithreading.
01:13
Here are more info about this: Webworkers is a solution for single threaded. https://speakerdeck.com/ritz078/web-workers-a-musical-intro
01:14
Light-weight GM mapped WebAudio-JavaScript Synthesizer Engine / MIDI Player - GitHub - g200kg/webaudio-tinysynth: Light-weight GM mapped WebAudio-JavaScript Synthesizer Engine / MIDI Player
Avatar
Avatar
JWerner
Sure
Hi. I heard the MIDI on other MIDI player (cakewalk) and it's the same, there is a silence after the oboe. Same on some video like here https://www.youtube.com/watch?v=R2Wkp5_C_Ho It seems that this silence is part of the score ! But you are right, this silence is quite abrupt in this MIDI. It's not related to reverb but to release time of this instrument (time to play the note after the notoff). Unluckily I can do nothing for this 😦
Avatar
Avatar
FalconEagle
Interesting, have you tried to integrate this tinysynth in a Unity project ?
Avatar
hello there, I've just submitted my app to apple's app store review, but it was rejected because there is no sound. I tested on my iphone via testflight and sound is playing for me. any idea what the problem could be?
Avatar
Avatar
lawson
hello there, I've just submitted my app to apple's app store review, but it was rejected because there is no sound. I tested on my iphone via testflight and sound is playing for me. any idea what the problem could be?
Hi, no sorry. First time I heard something like that.
Avatar
Perhaps, someone here with that bad experience ?
Avatar
Avatar
FalconEagle
Hi @FalconEagle. I tested webgl with the non core mode of Maestro with last version of Unity (2021.3) .... and it runs and plays sound.
22:03
22:04
but the sound is very bad !
22:04
perhaps with some very simple MIDI ....
Avatar
FalconEagle 10/05/2022 22:07
Great that it works in Webgl, but if the sound is very bad that means that it's not useable.
Avatar
sadly
Avatar
FalconEagle 10/05/2022 23:50
Is there a place in your code where the midi can be sent out to other synths?
Avatar
Avatar
FalconEagle
Is there a place in your code where the midi can be sent out to other synths?
Yes, look here. (not tested on Mac OS). https://www.youtube.com/watch?v=NFcYGhI3i3g
20:54
But not directly from the Maestro MIDI sequencer. Work only if you create note from your app with MidiStreamPlayer. For example, MIDI note could be read from the MIDI events OnEventNotesMidi from the MidiFilePlayer prefab. https://mptkapi.paxstellar.com/d7/deb/class_midi_player_t_k_1_1_midi_file_player.html#af15c52b3fef54a544db289fe18b0ffe5 (edited)
Documentation application programm interface for MIDI player tool kit
20:58
Documentation application programm interface for MIDI player tool kit
Avatar
FalconEagle 11/05/2022 21:01
What is the best way to be able to send midi notes to an external JS midi synth. Essentially sending messages from unity webgl to javascript in the browser.
21:06
Here is a way to call from unity into js libs that's in the browser. . Here' a demo: http://clb.confined.space/dump/CallJSFromCSharp_build_webgl/ From this thread. https://forum.unity.com/threads/call-javascript-function-in-index-html-from-webgl.625480/ (edited)
21:07
Ordinarily the JS library has to be inside of unity. The above example shows how an external JS lib that is in the browser can be called from unity.
Avatar
FalconEagle 12/05/2022 02:19
Update: I got Tone.js and TinySynth working in unity's HTML wrapper.
Avatar
FalconEagle 12/05/2022 02:26
Can play everyone of these examples: https://tonejs.github.io/
02:30
02:30
Screen capture sound is not good. However it plays exactly like the examples on the tonejs page.
Avatar
FalconEagle 12/05/2022 03:16
Tonejs also has a great sampler: https://tonejs.github.io/docs/14.7.77/Sampler
Avatar
Avatar
FalconEagle
Click to see attachment 🖼️
It's a monophonic synth and limited capabilities for playing varied instruments. Ok, for a simple music behind a game. But in this case, the most easier will be to used the Unity component 😆
Avatar
I read carefully the post how to communicate from C# Unity to a JS. Very interesting. So you need to find a JS lib with an API able to play a note from Maestro. why not tonejs for a simple player ? (edited)
07:08
Look at this Maestro example how to get all MIDI events from the Maestri MIDI Player. https://mptkapi.paxstellar.com/d7/deb/class_midi_player_t_k_1_1_midi_file_player.html#af15c52b3fef54a544db289fe18b0ffe5 (edited)
Documentation application programm interface for MIDI player tool kit
07:09
In the NotesToPlay function (it's a callback function from the Maestro MIDI sequencer) call the JS API to play notes could be easy. Have a try ? (edited)
07:11
Don't forget to add a MIdiFilePlayer to your project and UNcheck the "Core Player" and "Send to synth" (edited)
07:14
07:15
Thank for your search about this complex subject. Say me if this approach works for you. Regards
Avatar
FalconEagle 12/05/2022 17:39
Will try it out, btw, is there a Json format that can be sent to JS. Also how to send the soundfont info to the external synth. (edited)
Avatar
FalconEagle 12/05/2022 18:21
Unity 2021.3 LTS URP, windows 10: I am testing Pro version in different platforms with the example scenes. On Android, TestMidiReader, getting errors (edited)
18:22
Avatar
FalconEagle 12/05/2022 20:17
Eucledian demo on Webgl:
20:21
20:21
Seems like a lot of examples are not working for me. Can you check on your side.
Avatar
FalconEagle 12/05/2022 20:46
Also tested on 2021.2.8f1 and same problems. No sound playing.
Avatar
Avatar
FalconEagle
Click to see attachment 🖼️
TestMidiReader is not compatible with Android and IOS: the plugins MidiKeyboard works only with Windows and MacOS
Avatar
Avatar
FalconEagle
Eucledian demo on Webgl:
Maestro is not compatible with WebGL ...
Avatar
Avatar
Thierry
Maestro is not compatible with WebGL ...
FalconEagle 12/05/2022 22:22
I didn't export the project, only in the editor, are the errors because of the platform is set to Webgl? If it is the case, what is it in Maestro that is causing the error in unity editor with webgl platform setting. (edited)
Avatar
Avatar
Thierry
TestMidiReader is not compatible with Android and IOS: the plugins MidiKeyboard works only with Windows and MacOS
FalconEagle 12/05/2022 23:30
Ah, makes sense because that example needs a keyboard.
Avatar
FalconEagle 12/05/2022 23:52
Btw, to be clear. What platform does midi functionality work with Maestro Pro?
Avatar
FalconEagle 13/05/2022 02:47
I just started a fresh project and imported Maestro Pro and then Maestro Free. I'm getting this error. Windows 10 URP, 2021.3 LTS (edited)
Avatar
Avatar
FalconEagle
Ah, makes sense because that example needs a keyboard.
Yes ! rhe MidiKeyboard plugins (connect to a external MIDI port) is available only for Windows and MacOS
Avatar
Avatar
FalconEagle
Btw, to be clear. What platform does midi functionality work with Maestro Pro?
All but not external MIDI keyboard
Avatar
Avatar
FalconEagle
I just started a fresh project and imported Maestro Pro and then Maestro Free. I'm getting this error. Windows 10 URP, 2021.3 LTS (edited)
Sure ! Pro is an extension of Free, why doing the inverse ? No need trying import Free after a Pro !
Avatar
FalconEagle 13/05/2022 08:55
I tried installing Free before Pro but the soundfonts didn't show up properly for the examples.
08:57
Perhaps you can test the demos and examples and install in a fresh project to see the problems I am facing.
Avatar
Avatar
FalconEagle
I tried installing Free before Pro but the soundfonts didn't show up properly for the examples.
Mixing free and pro is not a good idea ! Please, create a fresh project only with the pro
Avatar
FalconEagle 13/05/2022 18:45
I will now try it with the latest 2022.1.0f1 and see. Perhaps you can test your packages on newer versions of Unity to make sure it works. (edited)
18:52
18:53
Platform is Windows, this is warning on import. Let's see how the examples work.
18:54
18:54
Already there is no sound fonts setup. So this is why I was using the soundfonts from the free package.
Avatar
FalconEagle 13/05/2022 19:15
After importing the soundfonts from the free package. Some demos work. Here are the ones that do not work. FreeDemos: 1. TestMidiFilePlayerMulti works but has errors 2. TestMidiFileLoad has error when clicking button "Read midi events from tick..." 3. Test midi stream works but with errors: GUI Error: Invalid GUILayout state in GameView view. Verify that all layout Begin/End calls match UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) ProDemos: 1. TestMidiInReader 2. TestExternalMidiPlay
19:15
Please do your own testing and see if you have the same issues.
Avatar
Falcon, stop doing this, don't install the free version after the pro and the inverse is not a good idea also.
19:30
Please, read carrefully this page wich explains how setup a soundfont :https://paxstellar.fr/setup-mptk-add-soundfonts-v2/
What is a SoundFont? The MPTK synthesizer is based on SoundFonts. It’s a kind of library which contains the samples associated to each instruments (as piano, sax, drum, …). The description of how to use each sounds for each keys, velocities, effects, controllers is quite complex. Happily the complexity is hidden by Maestro! A SoundFont […]
19:30
I can't support you if you are doing some "experiments", sorry
19:32
I'm going away for 3 days, I will not respond.
Avatar
Avatar
Thierry
Falcon, stop doing this, don't install the free version after the pro and the inverse is not a good idea also.
FalconEagle 13/05/2022 20:01
I didn't install the free version, only imported the soundfonts from the free package.
20:02
Probably better to include the soundfonts in the pro version so that it's ready to play the examples correctly. Best is for you to start with a fresh project and install the pro version and then see for yourself exactly what happens.
20:03
The user will open the demo scene and nothing is working. So they have to go download soundfonts somewhere.
20:04
I am not doing any "experiments" at this stage, only testing to see how your asset works in the latest version of Unity and to see if there are any issues before I can use it in my project.
20:05
I am spending precious time testing your asset wherein this should have been your responsibility.
20:06
Btw, the pro version comes with the Free demos already installed. The user will also test these examples. If you don't want that, better to not include these examples with the pro version.
Avatar
FalconEagle 14/05/2022 00:44
That's exactly what I did. Took the soundfonts from your free asset.
00:45
Btw, I got most of your examples working in unity editor with Android and Webgl platform. The fix was changing to: sampleSettings.loadType = AudioClipLoadType.DecompressOnLoad;
00:48
And for the TestExternalMidiFile, the player setting of : "Allow downloads over Http" = Always allow.
Avatar
Avatar
FalconEagle
Btw, I got most of your examples working in unity editor with Android and Webgl platform. The fix was changing to: sampleSettings.loadType = AudioClipLoadType.DecompressOnLoad;
I'm astonished. You played MIDI on a an android device with webGL and the sound is correct ? not only on the editor ?
Avatar
FalconEagle 14/05/2022 19:06
Only tested in editor
19:13
I thought that only webgl is not working.
Avatar
FalconEagle 14/05/2022 22:24
Does maestro work on mobile?
Avatar
Avatar
Thierry
Click to see attachment 🖼️
FalconEagle 15/05/2022 08:06
I tried this and for some reason it didn't log the notes. I used your working demos and added the custom onNoteEvent script. I see other logs but not from that custom script. Have you tried testing this? (edited)
Avatar
Avatar
FalconEagle
Does maestro work on mobile?
Yes!
Avatar
Avatar
FalconEagle
I tried this and for some reason it didn't log the notes. I used your working demos and added the custom onNoteEvent script. I see other logs but not from that custom script. Have you tried testing this? (edited)
playing MIDI on webgl ? Uncheck the core mode to get the MIDI sequencer working. try this : https://discord.com/channels/837590830423736331/855372183086170152/974177743765930014 But, on webgl the sound is not very good and the accuracy of the notes not garantee. (edited)
Avatar
FalconEagle 16/05/2022 20:11
I tested the demo TestMidiGenerator with SendToSynth on and Core off to webgl. Result, can see the note traces in the browser console, but do not hear any sounds. Also tested onEventNotesMide in the editor with TEstMidiGenerator. midiFilePlayer.OnEventNotesMidi.AddListener(NotesToPlay); This only works when midifileplayer is MidiExternalPlay and not MidiFilePlayer. Do you know why this is the case? (edited)
20:12
Avatar
FalconEagle 17/05/2022 02:46
I've been testing your TestExterMidiPlay demo and on the Core synth the sound starts to break up whereas unity Audio sounds perfect. Can you check this.
Avatar
FalconEagle 17/05/2022 03:03
Seems like the sounds of many examples have a strange stuttering effect. It could be from the change in how the sound files are imported. AudioClipLoadType.DecompressOnLoad. I tested further and this does seem to be the case. (edited)
03:03
Avatar
No problem, on my side. You have changed the load type to DecompressOnLoad? The default with Maestro is CompressedInMemory (and recommanded) and works well!
Avatar
Avatar
lawson
hello there, I've just submitted my app to apple's app store review, but it was rejected because there is no sound. I tested on my iphone via testflight and sound is playing for me. any idea what the problem could be?
Hello @ggga, have you find a solution ?
Avatar
I'm getting a warning during compilation when using Unity 2021.3.2f1. At first I thought it was due to upgrading my project from an earlier Unity version, but I'm getting it in a newly created project. This is just an FYI, the warning is in the Unity Editor functions and doesn't impact anything I'm using. Assets\MidiPlayer\Scripts\Editor\NoErrorValidation.cs(17,9): warning CS0618: 'CompilationPipeline.assemblyCompilationStarted' is obsolete: 'Use compilationStarted, compilationFinished or assemblyCompilationFinished instead. Note that using any of these functions to do time measurements is a bad idea as they run async to actual compilation.' (edited)
Avatar
@Thierry Is there an easy way to create a MidiFileWriter2 object from a List of MPTKEvents? From what I see in the API, I'll have to write my own conversion that uses the MPTK_Add* methods of MidiFileWriter2. Not a big deal to do, but it seems like that functionality should be part of the API, since MPTKEvents are so central. But maybe I've overlooked something?
Avatar
Hello everyone! At our company we are migrating a current Windows Standalone project to UWP and i'm having issues with MidiExternalPlayer. Anyone have done it before?
Avatar
Avatar
JWerner
I'm getting a warning during compilation when using Unity 2021.3.2f1. At first I thought it was due to upgrading my project from an earlier Unity version, but I'm getting it in a newly created project. This is just an FYI, the warning is in the Unity Editor functions and doesn't impact anything I'm using. Assets\MidiPlayer\Scripts\Editor\NoErrorValidation.cs(17,9): warning CS0618: 'CompilationPipeline.assemblyCompilationStarted' is obsolete: 'Use compilationStarted, compilationFinished or assemblyCompilationFinished instead. Note that using any of these functions to do time measurements is a bad idea as they run async to actual compilation.' (edited)
Exact, I will correct this warning for the next version. I confirm no impact on Maestro.
Avatar
Avatar
JWerner
@Thierry Is there an easy way to create a MidiFileWriter2 object from a List of MPTKEvents? From what I see in the API, I'll have to write my own conversion that uses the MPTK_Add* methods of MidiFileWriter2. Not a big deal to do, but it seems like that functionality should be part of the API, since MPTKEvents are so central. But maybe I've overlooked something?
You are right, that's a good idea. I add this function in the backlog 🙂
Avatar
sdappster 10/07/2022 13:04
👍 👍
Avatar
Hello ! I recently bought Maestro Pro and I'd like to know if it's possible to associate different soundfonts to multiple midi file players, and made them play together ?
Avatar
Also, it seems I can't add some Soundfont in the Setup Soundfont... the files are in the right format ".sf2", but the files are not imported at all... Is it a bug or did I missed something ?
Avatar
Hi guys. Quick question, I'm trying to download midi files from a server at runtime. I'm downloading them fine but it looks like this library preps the midi files and converts them when you open the MidiFileSetup window in the editor. Is there anyway I can do this prep at runtime?
Avatar
Sorry, im in holidays with low access to Internet. I try answer your questions next week.
15:15
Perhaps someone here could help you?
Avatar
AhmetSaidOlgun 05/08/2022 10:49
@Thierry MPTK midi events do not produce sound after starting native iOS audio together with Unity Audio. Do you know how can I solve it?
Avatar
Avatar
AhmetSaidOlgun
@Thierry MPTK midi events do not produce sound after starting native iOS audio together with Unity Audio. Do you know how can I solve it?
Quite hard to answer! Can you produce music with just a MidiFilePlayer ?
Avatar
Avatar
Holoman
Hello ! I recently bought Maestro Pro and I'd like to know if it's possible to associate different soundfonts to multiple midi file players, and made them play together ?
Hello, sorry for the delay to answer. No, only one soundfont can be activated at a time for all midifileplayers.
Avatar
Avatar
Holoman
Also, it seems I can't add some Soundfont in the Setup Soundfont... the files are in the right format ".sf2", but the files are not imported at all... Is it a bug or did I missed something ?
Have you an error ?
Avatar
Avatar
Ezzune
Hi guys. Quick question, I'm trying to download midi files from a server at runtime. I'm downloading them fine but it looks like this library preps the midi files and converts them when you open the MidiFileSetup window in the editor. Is there anyway I can do this prep at runtime?
Hello. Are you using the MidiExternalPlayer ? (pro version) (edited)
Avatar
Hello @Thierry , I have a problem with MidiSpatializer (Pro version). I have a scene with a menu in which I select a midi file from an external folder. I go to the next scene and the midi file is played from a byte array in MidiSpatializer by tracks. So far everything is perfect, it reproduces the spatialized midi and with 30 Synth id separated by track. I go back to the menu and select another midi, I go to the scene where the MidiSpatializer is and everything is correct. But the fourth time I go to the menu to select a midi and go to the scene where the MidiSpatializer is, it only loads 7 Synth id (it only plays the first 7 tracks of the midi). And the fifth time I do this process it no longer loads any Synth id and the midi doesn't play. Even selecting the same midi the fourth time only loads 7 synth ids and then none, and all this switching between these two scenes. Is there a process that I should stop when going between scenes? It seems as if only 97 Synth id can be loaded when spatializing by tracks while unity is running. (edited)
Avatar
misterix8009 02/10/2022 13:29
Hi @Thierry Jens here from Berlin. I didn't use Maestro in a whileand now I have a strange phenomenon. I have a smple script playing five notes that works with MidiStreamPlayer. I have Oboe installed, too for future development, but haven't activated it yet in Player Settings. When I compile the script for an Oculus Quest (Android device), the sounds don't play. When I then try to start the project in the Editor again I get an Error warning: Maestro Error Object reference not set to an instance of an object UnityEngine.Debug:LogWarning (object) MidiPlayerTK.MidiPlayerGlobal:ErrorDetail (System.Exception) (at Assets/MidiPlayer/Scripts/MPTKGameObject/MidiPlayerGlobal.cs:998) MidiPlayerTK.MidiStreamPlayer:MPTK_PlayEvent (MidiPlayerTK.MPTKEvent) (at Assets/MidiPlayer/Scripts/MPTKGameObject/MidiStreamPlayer.cs:152) HandController:PlaySound (int,int) (at Assets/Scripts/HandController.cs:226) HandController:Start () (at Assets/Scripts/HandController.cs:76) I don't know what is going wrong. If I import the MidiStreamPlayer again from the Prefab, it is working again in the Editor. Any ideas? Kind regards!
Avatar
Avatar
Dregal
Hello @Thierry , I have a problem with MidiSpatializer (Pro version). I have a scene with a menu in which I select a midi file from an external folder. I go to the next scene and the midi file is played from a byte array in MidiSpatializer by tracks. So far everything is perfect, it reproduces the spatialized midi and with 30 Synth id separated by track. I go back to the menu and select another midi, I go to the scene where the MidiSpatializer is and everything is correct. But the fourth time I go to the menu to select a midi and go to the scene where the MidiSpatializer is, it only loads 7 Synth id (it only plays the first 7 tracks of the midi). And the fifth time I do this process it no longer loads any Synth id and the midi doesn't play. Even selecting the same midi the fourth time only loads 7 synth ids and then none, and all this switching between these two scenes. Is there a process that I should stop when going between scenes? It seems as if only 97 Synth id can be loaded when spatializing by tracks while unity is running. (edited)
Hi @Thierry About my previous question. I've tried everything and I can't find a solution, I tried to do the same with the TestSpatializerFly demo and the same thing happens to me. As long as unity is open I can only play the midi four times before the synths won't load anymore. I attach a video of what happens to me, In the video you can see that when I delete midi MidiSpatializer and paste it again it works correctly. But after a few times it doesn't work anymore. I hope it can be fixed or know if I'm doing something wrong. Thank you very much. (edited)
Avatar
Hi all, I just started playing with Maestro - I am using the free version for playback of streamed notes for background music looping until you progress and sound effects. I have one issue - when my scripts get recompiled when game is actively playing in the editor, something breaks, and when sending any subsequent notes, I get: SoundFont not yet loaded, Midi Event cannot be processed Code:NoteOn Channel:0 ... MidiPlayerTK.MidiStreamPlayer:MPTK_PlayEvent (MidiPlayerTK.MPTKEvent) (at .../MidiStreamPlayer.cs:148) MPTK_ChannelBankGetIndex returns -1 when in the error state. Re-running MPTK_InitSynth doesn't fix the sound, although MPTK_ChannelBankGetIndex returns 0 after running it. I'm not familiar with SoundFonts, how do I reload it and perhaps what causes it to unload? (edited)
Avatar
Hi I'm interested in getting this Asset for a project but I am not sure if it corresponds to what I need 🙂 I want to generate synth sounds from input in Unity, ideally I would like to control my external Synth (VST) where I already have lots of presets created. So a concrete case would be for example:
  • opening a standalone synth (let's say Massive)
  • starting my Unity App
  • choosing my Unity App as the MIDI input device in Massive
  • start doing stuff in my Unity App then Massive plays some sounds etc.
I am not sure Maestro would let me do such stuff, I saw that it manages receiveing data from an external keyboard for example. But can it also send MIDI signal, or even better be used as a MIDI device? Thanks for your time 🙂 Cheers
Avatar
Avatar
Reaw
Hi I'm interested in getting this Asset for a project but I am not sure if it corresponds to what I need 🙂 I want to generate synth sounds from input in Unity, ideally I would like to control my external Synth (VST) where I already have lots of presets created. So a concrete case would be for example:
  • opening a standalone synth (let's say Massive)
  • starting my Unity App
  • choosing my Unity App as the MIDI input device in Massive
  • start doing stuff in my Unity App then Massive plays some sounds etc.
I am not sure Maestro would let me do such stuff, I saw that it manages receiveing data from an external keyboard for example. But can it also send MIDI signal, or even better be used as a MIDI device? Thanks for your time 🙂 Cheers
I have not used this asset a lot and I don't have pro version yet but I see this may be what you are looking for https://paxstellar.fr/class-midikeyboard/ You can write midi to a device, and you can use virtual midi loop device which can be used as input to VST like https://www.tobias-erichsen.de/software/loopmidi.html
Avatar
Avatar
sebi
I have not used this asset a lot and I don't have pro version yet but I see this may be what you are looking for https://paxstellar.fr/class-midikeyboard/ You can write midi to a device, and you can use virtual midi loop device which can be used as input to VST like https://www.tobias-erichsen.de/software/loopmidi.html
Interesting approach I will try that out, thanks a lot 🙂
Avatar
Hello @everyone , it seems I have miss some notifications from Discord. Could you make me a refresh on your questions or issues ? Thank @sebi for your answer.
Avatar
Avatar
sebi
Hi all, I just started playing with Maestro - I am using the free version for playback of streamed notes for background music looping until you progress and sound effects. I have one issue - when my scripts get recompiled when game is actively playing in the editor, something breaks, and when sending any subsequent notes, I get: SoundFont not yet loaded, Midi Event cannot be processed Code:NoteOn Channel:0 ... MidiPlayerTK.MidiStreamPlayer:MPTK_PlayEvent (MidiPlayerTK.MPTKEvent) (at .../MidiStreamPlayer.cs:148) MPTK_ChannelBankGetIndex returns -1 when in the error state. Re-running MPTK_InitSynth doesn't fix the sound, although MPTK_ChannelBankGetIndex returns 0 after running it. I'm not familiar with SoundFonts, how do I reload it and perhaps what causes it to unload? (edited)
when my scripts get recompiled when game is actively playing in the editor, something breaks, and when sending any subsequent notes I confirm, you need to stop playing when you scripts is recompiled.
(edited)
Avatar
Robin Brooks 28/11/2022 10:19
I'd like to write a Metronome app. But I'm not sure where to start. Is there some functionality already there for this? Thanks
Avatar
Hello @Robin Brooks, welcome to Maestro app! You could get inspiration from these demos: (edited)
👍 1
10:25
No prefab is used, all stuffs defined by the script.
Avatar
How can I controlle volume of a MPTKEvent? tried using Velocity, but it does not always work. (some instruments is always max)?
Avatar
Or how do I control channel volume? (also when saved to midi file)
15:09
I have four grids that can play an instrument each, and I want a volume control on each grid.
Avatar
Avatar
Rune
How can I controlle volume of a MPTKEvent? tried using Velocity, but it does not always work. (some instruments is always max)?
Velocity should work for all instruments. Valid values are 0 to 127, any value greater than 127 will probably be treated as max volume.
Avatar
Avatar
Rune
I have four grids that can play an instrument each, and I want a volume control on each grid.
Channel volume is controlled using Control Change events. There are two controls, Volume (controller number 7) and Expression (controller number 11). A Volume control change event is used at the beginning of almost every track in a typical MIDI file. Expression control events are rare, but are occasionally used for crescendos/decrescendos. Like Velocity, valid values are 0 to 127. (edited)
👍 1
👏 1
Avatar
Avatar
JWerner
Velocity should work for all instruments. Valid values are 0 to 127, any value greater than 127 will probably be treated as max volume.
It might work, but some instrument are loud even at low velocity. I will try using channel volume.
Avatar
Thanks for the help, got it all working now (using channel volume)
👍 1
👏 1
Avatar
Robin Brooks 22/12/2022 12:22
Puzzled. New Project from Pro version. Import sound font, new midi file. Throws this error.
12:22
IndexOutOfRangeException: Index was outside the bounds of the array. MidiPlayerTK.MidiSynth.OnAudioFilterRead (System.Single[] data, System.Int32 channels) (at Assets/MidiPlayer/Scripts/MPTKGameObject/MidiSynth.cs:3106)
12:23
Can't seem to get any of the demo's working even on a clean project file
Avatar
Avatar
Robin Brooks
IndexOutOfRangeException: Index was outside the bounds of the array. MidiPlayerTK.MidiSynth.OnAudioFilterRead (System.Single[] data, System.Int32 channels) (at Assets/MidiPlayer/Scripts/MPTKGameObject/MidiSynth.cs:3106)
Hello, I'm looking for your issue. Thank for the well documented case, but I can't reproduce this error. Could you send me your MIDI file ?
10:43
Also, could you reload the demo directly from the "Load Demonstration" menu?
Avatar
Deleted User 25/12/2022 17:16
I'm curious about one particular midi that doesn't play well. Zora's Domain. For some unkown reason it cannot keep up with the fast strings. It's the only track that has this problem. Will upload it sometime later today.
Avatar
Avatar
Deleted User
I'm curious about one particular midi that doesn't play well. Zora's Domain. For some unkown reason it cannot keep up with the fast strings. It's the only track that has this problem. Will upload it sometime later today.
Hello, yes ! Send me this midi. Which soundfont are you using ?
Avatar
Deleted User 25/12/2022 21:19
Just one. I will send over that one as well
15:46
15:47
Immediately after the intro it goes wrong. You'll notice the issue, especially when comparing with YouTube.
Avatar
Avatar
Deleted User
Immediately after the intro it goes wrong. You'll notice the issue, especially when comparing with YouTube.
well received,I will check it ASAP
Avatar
Avatar
Thierry
Hello, I'm looking for your issue. Thank for the well documented case, but I can't reproduce this error. Could you send me your MIDI file ?
Hi, I got the same error. I tried reloading the demo directly with "Load Demonstration" but it did not work. Note that I am using Unity version 2021.3.13f1 URP.
Avatar
Avatar
nomy0000
Hi, I got the same error. I tried reloading the demo directly with "Load Demonstration" but it did not work. Note that I am using Unity version 2021.3.13f1 URP.
Hi, Just checked with this version of Unity on MacOS ... no issue ! Have you migrated from the free version ? sometimes, there is issue when updating Free --> Pro Maestro. You could try restart with a fresh version: new unity project, download of Maestro Pro. Other check, have a look to the synth settings: (edited)
11:35
11:36
The better is to use the Unity settings
11:37
but you could try with setting above
Avatar
Avatar
Thierry
Hi, Just checked with this version of Unity on MacOS ... no issue ! Have you migrated from the free version ? sometimes, there is issue when updating Free --> Pro Maestro. You could try restart with a fresh version: new unity project, download of Maestro Pro. Other check, have a look to the synth settings: (edited)
Thank you for your reply. I imported the free version in a new project and loaded the demo scene and it worked. When it didn't work, I imported the same way. Maybe something is wrong with the project settings.
Thierry started a thread. 27/12/2022 12:24
Thierry started a thread. 27/12/2022 18:38
Avatar
_loretta_ 28/12/2022 14:26
Hello. I have a weird sound on android Samsung A10 (A107F). But on PC and android Xiaomi 6A sound sounds good. Original: https://www.youtube.com/watch?v=NXNY9_k_SmE How can i fix this problem? (edited)
Avatar
Avatar
_loretta_
Hello. I have a weird sound on android Samsung A10 (A107F). But on PC and android Xiaomi 6A sound sounds good. Original: https://www.youtube.com/watch?v=NXNY9_k_SmE How can i fix this problem? (edited)
Strange! could you send me the MIDI file ?
19:50
and wich SoundFont are you using ?
Avatar
Avatar
Thierry
Strange! could you send me the MIDI file ?
_loretta_ 28/12/2022 20:15
Sure. I got similar result on my pc when set sample rate to 24k
Avatar
Avatar
Thierry
and wich SoundFont are you using ?
_loretta_ 28/12/2022 20:19
built-in (automatically) i think
Thierry started a thread. 28/12/2022 22:15
Avatar
Avatar
Thierry
Hello, I'm looking for your issue. Thank for the well documented case, but I can't reproduce this error. Could you send me your MIDI file ?
Robin Brooks 29/12/2022 13:12
So. I imported the free version over the top of the pro version. Didn't work. quit the program. Reload. It started working. Go figure......??
13:14
Thanks. For the help. What mad people we are on this forum programming over the holiday period ;=) . Happy New Year to you. Make all you compiles run first time in 2023 :=)
Avatar
Deleted User 29/12/2022 16:10
Fixed it. Thanks ThiBach. You pinpointed the issue for me 😄
👏 1
Avatar
Avatar
Deleted User
Fixed it. Thanks ThiBach. You pinpointed the issue for me 😄
Good to known! thank you to inform me! I was wondering, are you the creator of this MIDI ? Also the SoundFont ? (edited)
Avatar
Deleted User 30/12/2022 05:54
Yes
Avatar
Deleted User 30/12/2022 06:03
But the midi is simply pulled straight from the game. Only thing I did was change the instrument id number to match my soundfont and selecting the fast notes, then all simultaniously increasing their duration. The soundfont itself took longer to get right. I have merged, Majora's Masks instruments with it as well. And also one instrument from Twilight princess. It's two programs I used really. Polyphone and Sekaiju (edited)
😁 1
06:06
The great thing is, polyphone can add new instrument presets but also keeps track of when it uses the same samples. So I could easily track down duplicates and get rid of them to save filesize.
Avatar
Hello! Has anybody tried maestro on HoloLens? If so, does the midi keyboard connection work?
Avatar
Avatar
mpelika
Hello! Has anybody tried maestro on HoloLens? If so, does the midi keyboard connection work?
Hello, I could answer. Unluckily, I think perhaps no! Sorry this answer is not really helpful. The midi keyboard connection plugin works (and has been tested) only on desktop with Windows and MacOS. For Windows, it's a DLL built from C++ using this library https://learn.microsoft.com/en-us/windows/win32/api/mmeapi/ perhaps this is available with hololens? (edited)
Avatar
and the Visual Studio setup
11:20
Without testing, it's hard to be confident. (edited)
Avatar
Avatar
Robin Brooks
Thanks. For the help. What mad people we are on this forum programming over the holiday period ;=) . Happy New Year to you. Make all you compiles run first time in 2023 :=)
Just one word: Passion 🙂 Have a Nice New Year.
Sixtoes_yuan started a thread. 02/01/2023 09:10
Avatar
Hello hello! Is there an ability to play different Midis each with its own soundfont loaded? I guess to take a step back: is it possible to play different MIDIs at the same time? From the looks of it, MidiPlayerGlobal manages soundfont, which doesn't sound promising for this case. Surely there is a way to have each midi play with a different sf, right?? For now I found a WAR: merge soundfonts and override channels on different MIDIs. Ideally, the solution is to allow multiple soundfonts to be loaded. (edited)
Avatar
Hello and welcome! There is only one soundfont selected at once for all midi player. Yes the good approach is to create your own soudfont by merging presets from different soundfont. Polyphone or viena are perfects for this task. Then you have to select the preset you want by channel in your midi.
Avatar
And, yes multiple player can be run at the same time but with no sync between them.
Avatar
Thanks! Any pointers on how to try to synchronize them?
Avatar
Also have to say that this plugin is very impressive and well documented. Merci beaucoup :)
Avatar
Avatar
Slash
Thanks! Any pointers on how to try to synchronize them?
That could be tricky with the current Maestro version. From my point of view there is two possible issues: not sync at load time and when running. Loading: I could add a new static method able to start playing multiple MIDIs and synchronize the flag to really start the reading when all are ready Running: All MIDI players are obviously using the same timer based on the system timer. But what about a long run ? Clearly, I can't be confident before trying!
Avatar
Avatar
Slash
Also have to say that this plugin is very impressive and well documented. Merci beaucoup :)
Thank you a lot, yes it's a lot of works! I would also appreciate it if you would leave a comment on the Unity store for the free or/and pro Maestro 😁 I need to keep my 5 stars! (edited)
Avatar
Hi! Im surprised that MidiFileWriter2 initialized from a MidiFilePlayer does not inherit all the changes that happened to the midi file. For example: midiFilePlayer.MPTK_ChannelVolumeSet(15, 0.00001f); string filename = Path.Combine(Application.persistentDataPath, midiFilePlayer.MPTK_MidiName + "2.mid"); MidiFileWriter2 mfw = new MidiFileWriter2(midiFilePlayer.MPTK_DeltaTicksPerQuarterNote, 1); mfw.MPTK_LoadFromMPTK(midiFilePlayer.MPTK_MidiEvents, midiFilePlayer.MPTK_TrackCount); mfw.MPTK_WriteToFile(filename); Debug.Log("saved file " + filename); Channel 15 still has its normal volume. Is there any way to change this? (edited)
Avatar
Avatar
Slash
Hi! Im surprised that MidiFileWriter2 initialized from a MidiFilePlayer does not inherit all the changes that happened to the midi file. For example: midiFilePlayer.MPTK_ChannelVolumeSet(15, 0.00001f); string filename = Path.Combine(Application.persistentDataPath, midiFilePlayer.MPTK_MidiName + "2.mid"); MidiFileWriter2 mfw = new MidiFileWriter2(midiFilePlayer.MPTK_DeltaTicksPerQuarterNote, 1); mfw.MPTK_LoadFromMPTK(midiFilePlayer.MPTK_MidiEvents, midiFilePlayer.MPTK_TrackCount); mfw.MPTK_WriteToFile(filename); Debug.Log("saved file " + filename); Channel 15 still has its normal volume. Is there any way to change this? (edited)
Hello, sadly, no. Set volume of a channel is not a MIDI command so it can't be save in a MIDI file. MPTK_ChannelVolumeSet has an effect only on already loaded MIDI.
Avatar
You could try to change the velocity of all MIDI note-on (filtered by the channel) on the MIDI then save it. (edited)
Avatar
@Thierry Hello. I opened and ran a scene of TestMidiFilePlayer and noticed that the sound sometimes breaks up. Do you have any idea what the problem might be? The Unity version is 2021.3.13f1 URP.
Avatar
Avatar
nomy0000
@Thierry Hello. I opened and ran a scene of TestMidiFilePlayer and noticed that the sound sometimes breaks up. Do you have any idea what the problem might be? The Unity version is 2021.3.13f1 URP.
Hello. Could you check the Unity audio setting ? (Project Setting / Audio).
Avatar
Avatar
Thierry
Hello. Could you check the Unity audio setting ? (Project Setting / Audio).
Unity audio setting is shown here.
Avatar
ok, it's the default setting. I just checked with this version (2021.3) and there is no break.
Avatar
Avatar
Thierry
ok, it's the default setting. I just checked with this version (2021.3) and there is no break.
Thank you for confirming. Maybe it is a device issue since I'm using M1 Mac. I will build it and check if it works without problems on mobile devices.
Avatar
Avatar
Thierry
ok, it's the default setting. I just checked with this version (2021.3) and there is no break.
It worked fine on my Android device. It seems to be a compatibility issue between MPTK and M1 Mac audio devices.
Avatar
Could you try to build an app (with this demo) from the Unity editor and test it outside the editor ?
Avatar
Avatar
Thierry
Could you try to build an app (with this demo) from the Unity editor and test it outside the editor ?
I built it for mac and the audio breaks has improved. It was just a problem running in Editor. Thank you for taking the time to discuss this.
Avatar
However, it's strange! Maestro works perfectly also in editor mode. Perhaps have you some plugins loaded or other assets which could slowdown the editor? A good test would be to start a unity project from start with only Maestro ....
Avatar
Avatar
Thierry
However, it's strange! Maestro works perfectly also in editor mode. Perhaps have you some plugins loaded or other assets which could slowdown the editor? A good test would be to start a unity project from start with only Maestro ....
I have confirmed that the same problem occurs when introduced to an empty project. Also, the error I mentioned before seems to happen when connecting to Bluetooth audio (Airpods) in Editor mode. https://discord.com/channels/837590830423736331/855372183086170152/1057240158266736722 I suppose the hardware changes the behavior in Editor mode.
Avatar
It's clear, bluetooth audio seems the cause. Thanks for this test.
👍 1
Avatar
Let me ask the question again. I would like to synchronize multiple MIDIs and AudioSource. Is there any effective way to do this?
Avatar
Please, give me me details, what do you want to synchronize ? what the audiosource is doing ? playing a single short sound and multiple time ? playing a background music ?
07:40
sync the time to start ? sync specific position in the playing ?
Avatar
Avatar
Thierry
Please, give me me details, what do you want to synchronize ? what the audiosource is doing ? playing a single short sound and multiple time ? playing a background music ?
I would like to synchronize the sound of an AudioSource to a specified number of beats in the BGM. Currently, I'm using MPTK_TickCurrent and MPTK_DeltaTicksPerQuarterNote to calculate the number of beats and generate the event. However, I was having trouble with the TickCurrent updates seeming to arrive somewhat late (sometimes not updating), causing the timing to be off by 200ms or more. I would like to know how to play AudioSource and MIDI sounds in a way that is tightly aligned with the MIDI of BGM.
Avatar
BGM ?
Avatar
Avatar
Thierry
BGM ?
Oops, sorry, BGM stands for Background Music.
Avatar
MPTK_TickCurrent is updated only when a MIDI event is read from the MIDI thread (it's immediate, no delay). But if you are readin this value in your Update() method, delat is dependant of the Unity frame rate. Rather try https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html
08:03
Other possibility: add "fake" MIDI event in your MIDI (note on with velocity =0 or MIDI event like META + Text
08:03
at the sync point that you want
08:08
to detect your "fake" MIDI event and do what you want in your Unity app
Avatar
Avatar
Thierry
to detect your "fake" MIDI event and do what you want in your Unity app
I see, so it is due to the frame rate of Update. Thank you for suggesting a solution. Do you mean embedding fake notes directly into the MIDI of the background music? Is it possible to prepare MIDI with fake notes only and synchronize it with the MIDI of the background music?
Avatar
Hi I have a problem with the MidiStreamPlayer. I cannot seem to play the same note repeatedly. Here is an example code with a repro private static void example(MidiStreamPlayer player) { List<MPTKEvent> notes = new List<MPTKEvent>(); for (int i = 0; i < 5; i++) { notes.Add(new MPTKEvent() { Command = MPTKCommand.NoteOn, Value = 60, Channel = 0, Duration = 1000, Velocity = 100, Delay = i * 1000, }); } player.MPTK_PlayEvent(notes); }
Avatar
Avatar
mcmuffin
Hi I have a problem with the MidiStreamPlayer. I cannot seem to play the same note repeatedly. Here is an example code with a repro private static void example(MidiStreamPlayer player) { List<MPTKEvent> notes = new List<MPTKEvent>(); for (int i = 0; i < 5; i++) { notes.Add(new MPTKEvent() { Command = MPTKCommand.NoteOn, Value = 60, Channel = 0, Duration = 1000, Velocity = 100, Delay = i * 1000, }); } player.MPTK_PlayEvent(notes); }
ok, I will check ... ASAP !
👍 1
Avatar
Avatar
mcmuffin
Hi I have a problem with the MidiStreamPlayer. I cannot seem to play the same note repeatedly. Here is an example code with a repro private static void example(MidiStreamPlayer player) { List<MPTKEvent> notes = new List<MPTKEvent>(); for (int i = 0; i < 5; i++) { notes.Add(new MPTKEvent() { Command = MPTKCommand.NoteOn, Value = 60, Channel = 0, Duration = 1000, Velocity = 100, Delay = i * 1000, }); } player.MPTK_PlayEvent(notes); }
It's because it's the same note. Try with this setting
15:09
uncheck Release Same Note
Avatar
Avatar
Thierry
It's because it's the same note. Try with this setting
Thank you!! That fixed it
👏 1
Avatar
Hello, I have a question that's also related to the "Release Same Note" Setting in MidiStreamPlayer: Now I can play the same note simultaneously, is it somehow possible to keep track of the played notes? I saw in the documentation that MPTKEvent has Index, Source, Tag, IdSession, ... but it is not very clear which one (and how) can be used together with MPTK_PlayEvent to identify a note so that one could later stop exactly that note with MPTK_StopEvent. Is this even possible?
Avatar
Avatar
PaXu
Hello, I have a question that's also related to the "Release Same Note" Setting in MidiStreamPlayer: Now I can play the same note simultaneously, is it somehow possible to keep track of the played notes? I saw in the documentation that MPTKEvent has Index, Source, Tag, IdSession, ... but it is not very clear which one (and how) can be used together with MPTK_PlayEvent to identify a note so that one could later stop exactly that note with MPTK_StopEvent. Is this even possible?
Hello, stopevent can be used to stop the note. I will answer more in depth soon.
Avatar
Avatar
PaXu
Hello, I have a question that's also related to the "Release Same Note" Setting in MidiStreamPlayer: Now I can play the same note simultaneously, is it somehow possible to keep track of the played notes? I saw in the documentation that MPTKEvent has Index, Source, Tag, IdSession, ... but it is not very clear which one (and how) can be used together with MPTK_PlayEvent to identify a note so that one could later stop exactly that note with MPTK_StopEvent. Is this even possible?
Documentation application programm interface for MIDI player tool kit
18:53
Clearly, it's not obvious, I will update this entry. MPTK_StopEvent take into parameter an instance of the class MPTKEvent which is used to produced a note from MPTK_PlayEvent Example: void Update() { if (Input.GetKeyDown(KeyCode.Space)) { // Assign our "Hello, World!"-equivalent note (using MPTKEvent's defaults plus Value = 60 for C5. // HelperNoteLabel class could be your friend) mptkEvent = new MPTKEvent() { Value = 60 }; // Start playing our "Hello, World!"-equivalent note midiStreamPlayer.MPTK_PlayEvent(mptkEvent); } else if (Input.GetKeyUp(KeyCode.Space)) { // Stop playing our "Hello, World!"-equivalent note midiStreamPlayer.MPTK_StopEvent(mptkEvent); } } (edited)
18:55
you can found this example here: Assets\MidiPlayer\Demo\FreeMVP\TheSimplestMidiGenerator.cs
Avatar
Great! That's exactly what I needed, thanks a lot! I didn't realise you can pass the same reference that was used for MPTK_PlayEvent.
20:43
@Yi have a look to this demo and source code: Assets\MidiPlayer\Demo\FreeMVP\MidiLoop.cs void Start() { // Find existing MidiFilePlayer in the scene hierarchy // --------------------------------------------------- midiFilePlayer = FindObjectOfType<MidiFilePlayer>(); // ... // triggered when MIDI starts playing (Indeed, will be triggered at every beginning of loop) midiFilePlayer.OnEventStartPlayMidi.AddListener(StartPlay); // ... } /// <summary>@brief /// Start playing MIDI: MIDI File is loaded and Midi Synth is initialized, but so far any MIDI event has been read. /// This is the right time to defined some specific behaviors. /// </summary> /// <param name="midiname"></param> public void StartPlay(string midiname) { // Enable or disable MIDI channel for (int channel = 0; channel < 16; channel++) midiFilePlayer.MPTK_ChannelEnableSet(channel, channel == ChannelSelected || ChannelSelected == -1 ? true : false); // ... } (edited)
Avatar
Hello! I've been working for a while now with the MPTK and overall I'm super happy and could implement most of the features I needed but one limitation is causing me some troubles and I don't know how to get around that. My game is heavily based on MidiStreamPlayer which dynamically generates sounds for various events, and all events are tied to some object in the game (in fact ALL music is generated with it). The problem is now that everything is based on channels (like volume, spatialization, ...) . I understand that it makes sense from a MIDI perspective but it's quite cumbersome to work with (it would be way easier to tie it to GameObject's) and I have more than 16 objects to handle concurrently. For instruments that's fine, I don't need more that 16 at the same time, but for manually controlling volume for example I would need way more than that. So now my questions:
  • Is there a specific reason why MPTK bypasses the Unity audio system and doesn't use e.g. AudioSource?
  • I didn't dive yet into the code but would it be possible to route the output to an AudioSource so I could integrate it with all the standard Unity audio stuff? Basically I would need then a MidiSynth/MidiStreamPlayer per AudioSource I guess? ...it could be just raw wave data without any effects or so - just playing the right sample from the SoundFont.
I saw in the code that you are using FluidSynth? I haven't worked with it yet but from reading the API docs it would need to use fluid_sequencer_register_client for creating audio sinks for each AudioSource, pass then the audio data to it in the callback and use fluid_event_set_dest for sending the MIDI event.
  • Any chances this is planned for a future release or something I could also implement myself in a reasonable amount of time (I have 15+ years of DAW programming experience)?
Avatar
Avatar
PaXu
Hello! I've been working for a while now with the MPTK and overall I'm super happy and could implement most of the features I needed but one limitation is causing me some troubles and I don't know how to get around that. My game is heavily based on MidiStreamPlayer which dynamically generates sounds for various events, and all events are tied to some object in the game (in fact ALL music is generated with it). The problem is now that everything is based on channels (like volume, spatialization, ...) . I understand that it makes sense from a MIDI perspective but it's quite cumbersome to work with (it would be way easier to tie it to GameObject's) and I have more than 16 objects to handle concurrently. For instruments that's fine, I don't need more that 16 at the same time, but for manually controlling volume for example I would need way more than that. So now my questions:
  • Is there a specific reason why MPTK bypasses the Unity audio system and doesn't use e.g. AudioSource?
  • I didn't dive yet into the code but would it be possible to route the output to an AudioSource so I could integrate it with all the standard Unity audio stuff? Basically I would need then a MidiSynth/MidiStreamPlayer per AudioSource I guess? ...it could be just raw wave data without any effects or so - just playing the right sample from the SoundFont.
I saw in the code that you are using FluidSynth? I haven't worked with it yet but from reading the API docs it would need to use fluid_sequencer_register_client for creating audio sinks for each AudioSource, pass then the audio data to it in the callback and use fluid_event_set_dest for sending the MIDI event.
  • Any chances this is planned for a future release or something I could also implement myself in a reasonable amount of time (I have 15+ years of DAW programming experience)?
Hello, thanks for your kind comments! Your app seems appealing. Have you the goal to publish? Yes, I know this MIDI limitation of 16 channels is sometimes annoying. Perhaps you could overcome this limitation: in fact every MidiStreamPlayer is an autonomous synthesizer with its own channels, wavetable, settings ... You could have many MidiStreamPlayer in your project, each one associated to a gameobject (but stay reasonable if you target low CPU devices!). MidiFilePlayer works the same, each MidiFilePlayer is an autonomous MIDI synth, look at the demo (pro) #13 Channel Spatialization. Your questions about the MPTK architecture (competitors, don't look at this 😁 ): The strength of MPTK is precisely to use the Unity audio system: each MidiStreamPlayer builds the results samples (thanks to the wonderful fluidsynth) and send it to an AudioSource. (edited)
Avatar
FluidSynth in MPTK, has been rewrited to be fully integrated in MPTK and Unity. Using directly the binary (choice of other competitors) could be possible but with the loss of all the interaction with Unity and your app. By the way, "only" the wave synth of FluidSynth is used. (edited)
07:47
The AudioSource is a component of the prefab MidiStreamPlayer, so you will have one AudioSource for each MidiStreamPlayer with a behavior of an autonomous synth. You could make some change in this prefab but you will lost the compatibility with future version of MPTK. (edited)
07:48
but this one is not used (here only for compatibility reason) (edited)
Avatar
Thanks a lot for the answer, very insightful! ...I wasn't aware that it's possible to have multiple instances of MidiStreamPlayer, for some reason I always thought of it more like a singleton. Yes, I definitely plan to publish my game but it may take a few years - unfortunately I can't work on it full time (yet). I can let you know when I have a prototype though;) Having multiple MidiStreamPlayer instances could be a solution, what do you think is a reasonable amount of instances? And is there a way to reduce CPU usage? The challenge is that a scene may have potentially several hundred GameObjects that can produce a sound (but not all of them playing concurrently). Hmmm, I could maybe create a cache system for it then...
Avatar
Avatar
PaXu
Thanks a lot for the answer, very insightful! ...I wasn't aware that it's possible to have multiple instances of MidiStreamPlayer, for some reason I always thought of it more like a singleton. Yes, I definitely plan to publish my game but it may take a few years - unfortunately I can't work on it full time (yet). I can let you know when I have a prototype though;) Having multiple MidiStreamPlayer instances could be a solution, what do you think is a reasonable amount of instances? And is there a way to reduce CPU usage? The challenge is that a scene may have potentially several hundred GameObjects that can produce a sound (but not all of them playing concurrently). Hmmm, I could maybe create a cache system for it then...
Hello what do you think is a reasonable amount of instances Hard to answer, CPU usage is really dependent of the sound playing concurrently. Having 50 sounds in one instance or 1 sound in 50 instances is almost the same for the CPU usage. Another point: the MPTK MIDI synth already use a cache of the preset used in each instance, so it's better to use the same preset in the same instance.
20:59
MPTK pro demo Midi spatialiser is using a dynamic creation of instance of MidiFilePlayer to apply a dynamic 3D position of each sound: by channel or by track. Have a look (if you have the pro), you will see all the instances. (edited)
21:02
Avatar
Thanks again, this was exactly what I needed!
Avatar
You're welcome!
Avatar
How can I generate a game object when a midi note is played using a MidiStreamPlayer?
Avatar
Avatar
mcmuffin
How can I generate a game object when a midi note is played using a MidiStreamPlayer?
Hello, the callback Unity events defined by OnEventNotesMidi is executed only from the MIDI player (MidiFilePlayer) not with MidiStreamPlayer which is an immmediate player By the way, MidiStreamPlayer .MPTK_PlayDirectEvent(MPTKEvent) play the note immediately. So, you don't need an event for this, you just have to create your gameobject after in your script. (edited)
👍 2
Avatar
Avatar
Thierry
Hello, the callback Unity events defined by OnEventNotesMidi is executed only from the MIDI player (MidiFilePlayer) not with MidiStreamPlayer which is an immmediate player By the way, MidiStreamPlayer .MPTK_PlayDirectEvent(MPTKEvent) play the note immediately. So, you don't need an event for this, you just have to create your gameobject after in your script. (edited)
Thank you for the info!
Avatar
Hey guys, a bit new to unity. I just made a game for school where you use your keyboard to play chords just like how you would play them on a guitar.
16:28
In my game you can play along with songs and get a score, the problem is that implementing a songs takes a really long time because you have to specify every chords position in the song (the program needs to know when and what chord is going to play)
16:28
I was wondering if any of you could help me get an output of when wich note from a specific instrument is played
16:29
thank you in ahead
Avatar
Silverknight 27/03/2023 18:01
The midi event has channel and midi note number. You can probably get what you are looking for from those.
18:02
My Eeveelution Band gets notes from the MIDI file and then act out them playing it.
Avatar
Avatar
Silverknight
The midi event has channel and midi note number. You can probably get what you are looking for from those.
😄 1
Avatar
Avatar
Thierry
Silverknight 27/03/2023 19:07
Thank you ThiBach! I have not been very active with the project the past year, but I plan to do more with it this year. I've already created a new model for one of my characters that will control a lot more MIDI stuff going on with the Band.
19:09
https://cdn.discordapp.com/attachments/900617478412054558/1085325651457888296/image.png This one will control things like global MIDI volume, individual channel volume, individual channel patch selection, and more.
😁 1
Avatar
Thanks Silverknight, gonna try to figure it all out well done on your project!
Avatar
Avatar
manutje_
Thanks Silverknight, gonna try to figure it all out well done on your project!
Hi, as said @Silverknight you could use MIDI file. You can create a MIDI file with for example MidiEditor, or use already made songs. Then with Maestro, you will be able to play these MIDI files and display what you want when note are read by the MIDI sequencer. Look at the demo CatchMusic in Maestro free, that could help you.
Avatar
I have some MPTKEvent in a list, when I call play event on Start() of a gameobject I don't hear a sound. Only when I hook it up to a trigger or a button will it play sound
08:51
Am I doing something wrong
Avatar
Avatar
mcmuffin
I have some MPTKEvent in a list, when I call play event on Start() of a gameobject I don't hear a sound. Only when I hook it up to a trigger or a button will it play sound
Hello It's related to the order unity start each game objects. Surely the midi player is not yet ready.
👍 1
Avatar
Hi! I was wondering if the MIDI input / output functionality of the PRO version works with iOS and Android devices?
21:34
I would like to connect a MIDI keyboard to an iPhone / iPad, and use the input from the MIDI keyboard to play the game. Would this be possible?
Avatar
Hello, unfortunately no. Sorry. But perhaps someone here have a solution ?
Avatar
I see, thanks for the reply!
Avatar
Hi, I'm having an issue that I believe is related to MPTK. If I load several scenes in quick succession (such as a game character going in and back out through a door), the game stops with an error message (see image) that points to a couple scripts from MTPK. This only happens when I play the game in the editor, the game doesn't crash if I do this same thing in a built version. Still, it's a bit annoying sometimes. Is this a known issue? Is there a fix for it?
Avatar
Hello, when loading a scene with mptk maestro, the midi synth is initialized in à thread. Perhaps the reason. I try to propose you à solution.
09:30
Asap
Avatar
Avatar
Drippy
Hi, I'm having an issue that I believe is related to MPTK. If I load several scenes in quick succession (such as a game character going in and back out through a door), the game stops with an error message (see image) that points to a couple scripts from MTPK. This only happens when I play the game in the editor, the game doesn't crash if I do this same thing in a built version. Still, it's a bit annoying sometimes. Is this a known issue? Is there a fix for it?
At line 1032 in MidiSynth.cs, try to add this:
20:33
But, I haven't be able to reproduce your issue. Could you send me a simplified package?
Avatar
Hi, changing that line in MidiSynth.cs fixed the problem. I'll try to see if I can replicate the error in a different project. I'm using Unity version 2019.4.3f1. Could that be the source of the issue?
Avatar
Okay, I've reproduced the issue in a different project. If I swap between two scenes quickly and at least one of them has a MidiStreamPlayer object in it, the issue from earlier occurs. Again the error is fixed if I change the line of code in MidiSynth.cs (edited)
Avatar
Avatar
Drippy
Okay, I've reproduced the issue in a different project. If I swap between two scenes quickly and at least one of them has a MidiStreamPlayer object in it, the issue from earlier occurs. Again the error is fixed if I change the line of code in MidiSynth.cs (edited)
Thank for your check, I will integrate this change in the next version (will come soon!). To be honest I forgetter testing quick succession of scenes loading. I will be interested by your light package to add it in the list of testing. Could you send me this package? Perhaps I will find others issues ... I test Maestro from the 2019.4.36, but I'm confident that 2019.4.3 works also.
Avatar
Avatar
Drippy
Thank's !
Avatar
Silverknight 30/04/2023 04:25
I updated to 2.90 after removing the old version in my project and now some of the instruments in the standard soundfont do not play. I'm not sure what's causing this. This is in Unity 2022.2.17. There was no change in how my code interacted with the MPTK before and after the update. Any ideas as to why this might be happening? Test track is the Aqua - Lollipop Candy Man. Several instruments are not playing, such as this Square Lead. Thank you in advance. @Thierry (edited)
04:30
All volumes are up, so I'm pretty sure it's not just a channel or two being zero volume or muted.
04:33
Some of the songs seem to be undefined too.
Avatar
Silverknight 30/04/2023 04:42
Some of the drums/percussion is missing in the soundfont too.
Avatar
Hello @Silverknight. There is clearly a regression. Try this change in the prefab inspector (MIdiFilePlayer or MidistreamPlayer)
16:24
Set the cut off volume to the minimum (edited)
Avatar
Silverknight 30/04/2023 16:27
I changed that to the minimum and there was no difference.
Avatar
Increasing velocity factor in the last version has given a better dynamics to the music ... but with this regression
Avatar
Silverknight 30/04/2023 16:29
All 3 of these channels are not playing anything and some of the drums are still missing from playing.
16:29
No sound from Synth Bass 1
16:29
Or Saw Lead
Avatar
even with track the Aqua - Lollipop?
Avatar
Silverknight 30/04/2023 16:30
I'll try the Aqua track now.
16:30
No sound from Aqua track. This Square Lead isn't playing any sound.
Avatar
with the default SoundFont GS1471 ?
Avatar
Silverknight 30/04/2023 16:32
These are the settings I'm using right now.
Avatar
Avatar
Thierry
with the default SoundFont GS1471 ?
Silverknight 30/04/2023 16:32
Yes.
16:32
I only have the default soundfont that came with it.
Avatar
Ok, i check more deeper
Avatar
Silverknight 30/04/2023 16:33
All channel volumes are maxed as well as the Stream Player volume.
Avatar
Have you change the cutoff on the MidiStreamPlayer?
Avatar
Silverknight 30/04/2023 16:36
Yes I changed it to the 0.01 you suggested. I posted a picture of those settings above. There didn't seem to be any difference. (edited)
16:37
But just right now I cranked my physical computer volume up a lot and I very faintly heard the Square Lead.
16:37
So they might be playing, but extremely quietly.
Avatar
I will show you how to restore the previous value of the volume factor
16:41
in Assets\MidiPlayer\Scripts\FluidSynth\fluid_conv.cs
16:41
16:41
line 59
16:42
set FLUID_ATTEN_POWER_FACTOR to -531.509
16:45
-531.509f
Avatar
Silverknight 30/04/2023 16:45
I also reset the 0.01 back to the 0.05 and the Volume back to 0.5 from 1. I changed that file back to that value and I am running some tracks. It seems to be fully resolved.
16:46
All drums are back and all channels seem to be playing again.
16:46
Yeah it seems to be fixed.
16:46
Thank you ThiBach.
16:47
Avatar
Thank to you to inform me! it seems I need to push a new version ASAP ! (edited)
16:50
You can let the cutoff to 0.01
16:50
I will set to 0.001 in the next version (after good tests !)
Avatar
Silverknight 30/04/2023 16:51
Ok. So far I've been using all the default settings in the prefab, so that's why I changed the cutoff back to the 0.05. I'll mess around with it and hear how it sounds at different values.
Avatar
Ouch! I have compared the sound between 2.8.9 and 2.9, how I missed that?
Avatar
Silverknight 30/04/2023 17:08
It looks like we will be seeing a 2.9.1 here soon lol.
Avatar
I was so focus on the MIDI Editor I forgot the main features
Avatar
Silverknight 30/04/2023 17:09
The MIDI editor does look impressive though, so great job on that.
Avatar
You like it? it's a very light version but I hope to add features sson
Avatar
Silverknight 30/04/2023 17:11
I have not made many MIDI edits so far for my project. Any edits I've done was through MidiEditor. I'm still a big novice at it, so I've only done light edits.
17:11
Avatar
Yes, it's a very good tool, I got inspiration from it to keep it simple
17:12
DAW are too much complex
Avatar
Silverknight 30/04/2023 17:13
I do not have much experience with developing UI elements, so seeing you made your editor in Unity like that impressed me.
17:13
Way more complex than what I've made so far.
17:14
It took me a while to figure out how to dynamically add buttons into a scrollable list based on the number of tracks added into the Maestro add file menu.
17:14
My simple music selector.
Avatar
I lost my last hair 😉
😆 1
Avatar
Silverknight 30/04/2023 17:15
lol
Avatar
imGUI is not so complex but with a not usual working mode
17:17
I spent my time finding workaround
Avatar
Silverknight 30/04/2023 17:17
Interesting
17:19
This is extremely bad UI design, but it's all development UI for me. I'm going to build something much more proper later on.
Avatar
Unity push to use their UI Toolkit
17:21
That could be more straightforward
Avatar
Silverknight 30/04/2023 17:22
The latest thing I've been looking for is how to curve and bend UI for World Space use. Ideally I want a Canvas/Panel that will be bendable and apply it's distortion to elements below it. I have several curved console screens that I want the UI to fit in.
17:23
I was able to get a simple make of it for the character's keyboards, but it needs to be much more developed for my latest model.
17:23
Avatar
Not possible with imGUI and UI Toolkit
Avatar
Silverknight 30/04/2023 17:24
I want this to have 3 curved panels that will have tabs, buttons, texts, and more. It's been a struggle to find something that will work for this.
Avatar
Avatar
Thierry
Not possible with imGUI and UI Toolkit
Silverknight 30/04/2023 17:25
I faintly remembered looking at UI Toolkit and I think I saw it would probably not be possible with those kits.
Avatar
HAve you tried with TextMeshPro in a canvas ?
Avatar
Silverknight 30/04/2023 17:27
My current text objects are TextMeshPros, but if I recall correctly they do not natively support being curved without using this registry.
17:27
17:27
This is how I got the initial curved texts on the keyboard screens.
17:29
https://www.instructables.com/Creating-Curved-UI-in-Unity-for-Virtual-Reality/ I found it initially from a Google search on how to make curved UI for Unity.
Creating Curved UI in Unity for Virtual Reality: If your looking for a free and easy solution to create a curved user interface for your Virtual Reality Application or VR Game your at the right place. In this blog you will learn to create a curved ui element in unity using the Unity UI Extensions.…
17:29
But this only supports one level of curved UI, not anything a child of it.
17:30
In that picture you would need to curve the button and then separately curve the button text.
Avatar
interesting, I will have a look
Avatar
Silverknight 06/05/2023 02:42
Playing the Fire Emblem 3 - Theme produces this warning and a wrong instrument sound is played. (edited)
02:44
It's the default soundfont I'm using.
Avatar
Avatar
Silverknight
Playing the Fire Emblem 3 - Theme produces this warning and a wrong instrument sound is played. (edited)
Hello. There is a new feature since the 2.9 but I didn't communicate about it: capabilities to manage bank with the two MIDI Controller messages 0 (BankSelectMsb) and 32 (BankSelectLsb). Previous version was using only BankSelectMsb that was not fully compliant with MIDI norm. Now BankSelectLsb is also processed. (edited)
12:05
Sadly, there is no real standard how these messages must be processed. It's a mess between each main manufacturers. So I have choosen (with a good help of a MIDI specialist!) a method that seems popular and compliant with previous version of Maestro : banknum = BankSelectMsb * 128 + BankSelectLsb (edited)
12:07
On top of that, some MIDI's has been built for a specific synth and soundfont, so bank could be not available on some cases ... this the case with Fire Emblem 3, there is no preset 29 in the bank 128.
12:08
I added a warning message to inform when a preset is not found in the selected SoundFont.
Avatar
I am loading a list of MIDI events using MidiFileLoader. When I pass these to MidiStreamPlayer.MPTK_PlayEvent(myEvents), it plays all the notes at the same time. How do I fix it?
10:49
I want to do things like edit the tempo or the key with these MIDI events, which is why I am trying to use MidiStreamPlayer
Avatar
Avatar
mcmuffin
I am loading a list of MIDI events using MidiFileLoader. When I pass these to MidiStreamPlayer.MPTK_PlayEvent(myEvents), it plays all the notes at the same time. How do I fix it?
Hi Normal! MidiStreamPlayer is able to play individual note/instrument not a MIDI file. You have to use MidiFilePlayer for this. (edited)
👍 1
Avatar
Look here for more information about Maestro use case
👍 1
Avatar
if I am using MidiFIlePlayer, is there a way to trigger a UI event when a note is played? Or alternatively, should I write something that looks at the events and maybe use a coroutine to display a note at the same time?
10:12
I am trying to show a note when a MIDI event is played
Avatar
Avatar
mcmuffin
I am trying to show a note when a MIDI event is played
Yes! That's one of the best feature of Maestro!
🥹 1
Avatar
Ah thank you, i misread the documentation.
Avatar
I have some questions about looping. I've hacked together a short test looping a four on the floor beat, and it seems like there's a little bit of a delay introduced every loop. I think in your notes you say there may be a frame delay. I'm guessing that this is inherent in the system?
05:09
I'm basically trying to create a looping sequencer. Maybe the way to go is to double the pattern and manually jump to the right place "ahead" on the frame that it passes the loop point?
05:10
also, i noticed that if the last note of the sequence is before the loopto point, it will loop before the loopto point. not sure if that was your intention.
05:10
i do need to figure out how to get a clean loop so any help appreciated, thanks! (i just bought the pro version btw)
Avatar
I guess one solution is to keep adding to the end, then reset everything rarely
Avatar
Hello Blinko, It's more related how Maestro detect the end of the playing (or the end of the loop, which is the same). (edited)
08:11
StopNoWaiting StopWhenAllVoicesReleased StopWhenAllVoicesEnded This delay is dependent of the instrument. A drum has a short release phase, a piano a medium delay, a tubullar bells a very long delay. (edited)
08:13
Here how to change this setting in a MidiFilePlayer
08:17
That will also be possible with the next version 2.9.2 to experiment directly in the Midi Editor (for the lucky one who bought the Pro 😁 ) (edited)
08:18
SPOILER
Image attachment
Avatar
i forgot to mention that i did have this line in there: midiPlayer.MPTK_ModeStopVoice = MidiFilePlayer.ModeStopPlay.StopNoWaiting;
Avatar
my basic setup is 500 ticks per quarter note, 500 tick notes, 0-2k loop, notes at 0, 500, 1000, 1500. i had to put a note at 2000+ to get it to loop around there
11:13
playing with notelength 490 and 510 to see if it changes anything (i saw the note about the last event being noteon
11:14
using 100bpm, if i start it and start a metronome, it is slightly off over time
11:15
does the loop functionality "look ahead" back to the beginning when looping?
11:19
i guess i'm not sure if its my setup or not. if looping isn't 100% on time due to the potential frame delay, i think i can minmize it to the point of not being an issue if i just continually add to the end and only restart when it gets too long or the sequence changes
Avatar
have you tried with
18:50
midiPlayer.MPTK_ModeStopVoice = MidiFilePlayer.ModeStopPlay.StopWhenAllVoicesReleased
Avatar
no let me try now
18:55
yes it still goes out of sync. i tried with note length 490 and 500.
18:57
on loop, does it compensate for the frame time and "fast forward" into the restart the correct number of ticks? not sure this would be the issue
18:59
i hacked up one of your files to test this, here's the code i'm using just to test
Avatar
I will check, but let me a few days. I 'm quite overwhelmed!
Avatar
no prob, i believe i can just add to end for now. thanks for the help!
Avatar
In fact, I'm starting to integrate your example, but I can't promise an answer today 🥱 (edited)
Avatar
Ok, I can reproduce. I will continue tomorrow.
Avatar
thanks so much! is there a way to get a callback when a note is played? i've gone through the docs / demos a few times but not sure if i'm missing something
Avatar
i'm sorting through on midiPlayer.OnEventNotesMidi.AddListener, this is fine
👍 1
Avatar
fyi - on the loop accuracy, i tried start the loop start and loop end a bit later later to see if not calling the preset change would help. with MidiFilePlayer.ModeStopPlay.StopWhenAllVoicesReleased, the looping had a hitch, as if it was still going to 0. with MidiFilePlayer.ModeStopPlay.StopNoWaiting, it still seems to be a little off on the loop as if looping from 0. not sure if this helps.
Avatar
one more thing i've noticed. i have it now so i can dynamically add and remove notes from the sequencer like mfw.MPTK_MidiEvents.Insert(0, noteEvent); mfw.MPTK_StableSortEvents(); but i've noticed that even with the midiPlayer.MPTK_ModeStopVoice = MidiFilePlayer.ModeStopPlay.StopNoWaiting; , if i insert a new note towards the end of the sequence, it feels like the new note waits so it extends the time in between notes.
Avatar
for reference, here it is, you can see how it extends the loop when i put the later notes in. great asset so far this has been pretty quick to get here.
Thierry started a thread. 07/06/2023 06:30
Avatar
Hi @Thierry I know WebGL is limited but I wanted to give a shot. I receive this error when I want to start a midi playing: fluid_synth_alloc_voice - Clip Grand-Piano-Dd5 not ready to play Loading UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:LogFormat(LogType, String, Object[]) UnityEngine.Debug:LogWarningFormat(String, Object[]) MidiPlayerTK.MidiSynth:fluid_synth_alloc_voice(HiSample, Int32, Int32, Int32, Int32) MidiPlayerTK.MidiSynth:synth_noteon(MPTKEvent) MidiPlayerTK.MidiSynth:MPTK_PlayDirectEvent(MPTKEvent, Boolean) MidiPlayerTK.<ThreadLegacyPlay>d__137:MoveNext() <CancelWith>d__4:MoveNext() MEC.Routine:Update() Added the screenshot from MidiSynth.cs that throws this error.
  • I disabled Core Player
  • I made all audioclips "Decompress on Load"
I guess it can't load audiosource. It always stuck in "Loading" state. Any idea why?
Avatar
Avatar
ctech
Hi @Thierry I know WebGL is limited but I wanted to give a shot. I receive this error when I want to start a midi playing: fluid_synth_alloc_voice - Clip Grand-Piano-Dd5 not ready to play Loading UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:LogFormat(LogType, String, Object[]) UnityEngine.Debug:LogWarningFormat(String, Object[]) MidiPlayerTK.MidiSynth:fluid_synth_alloc_voice(HiSample, Int32, Int32, Int32, Int32) MidiPlayerTK.MidiSynth:synth_noteon(MPTKEvent) MidiPlayerTK.MidiSynth:MPTK_PlayDirectEvent(MPTKEvent, Boolean) MidiPlayerTK.<ThreadLegacyPlay>d__137:MoveNext() <CancelWith>d__4:MoveNext() MEC.Routine:Update() Added the screenshot from MidiSynth.cs that throws this error.
  • I disabled Core Player
  • I made all audioclips "Decompress on Load"
I guess it can't load audiosource. It always stuck in "Loading" state. Any idea why?
Hello, I will make a try. What are you using, MidiFilePlayer or MidiStreamPlay prefab? Which version of Unity?
Avatar
I have also to say that I'am awaiting the official version 2023 for a more in depth look for the WebGL. There is good enhancement useful for Maestro 😁
Avatar
Avatar
Thierry
Hello, I will make a try. What are you using, MidiFilePlayer or MidiStreamPlay prefab? Which version of Unity?
Midifileplayer
Thierry started a thread. 09/06/2023 06:32
Avatar
FYI doing iOS build had to comment out the AssetDatabase reference in MidiJoinAndImport as i think its editor only?
Avatar
Avatar
Jeffo
FYI doing iOS build had to comment out the AssetDatabase reference in MidiJoinAndImport as i think its editor only?
Yes, it's an error with the Last version. Now corrected. Thx to inform me. (edited)
👍 1
Avatar
If i want to maintain "state" between two different midi sequences, is it best to have one midifileplayer and reconfigure it upon switching, or can i have two and enable / disable them? (edited)
Avatar
Avatar
Jeffo
If i want to maintain "state" between two different midi sequences, is it best to have one midifileplayer and reconfigure it upon switching, or can i have two and enable / disable them? (edited)
What do you mean with state?
Avatar
For example if I wanted to have two sequencers which take turns playing, where two players keep modifying the sequencers but only one is playing at a time.
Avatar
Avatar
Jeffo
For example if I wanted to have two sequencers which take turns playing, where two players keep modifying the sequencers but only one is playing at a time.
MidiPlayers can run at the same time, you can load MIDI, pause and play each one independently. You can use the MidiWriter2 class (see demo) to change the MIDI events at run-time. (edited)
👍 1
Avatar
dejimarquis 19/06/2023 06:46
Hello @Thierry, I use the pro version (2.9.1 Pro) and I might have noticed a bug. The last note of a midi file doesn't log to the debugger but the sound is heard in the code in the image. I tried to nail down the bug as much as possible and I have a feeling the bug stems from how the midiEvents are dequeued. These are the steps I took:
  • I verified that ALL the notes are enqueued by putting a log statement right above the enqueue operation in MidiSynth.cs
  • I verified that the last note is not present when the notes are dequeued by putting a log statement right below the dequeue operation in MidiFilePlayer.cs
  • I repeated these steps with two different MIDI songs and validated the same issue I would appreciate any pointers you might have.
Avatar
Avatar
dejimarquis
Hello @Thierry, I use the pro version (2.9.1 Pro) and I might have noticed a bug. The last note of a midi file doesn't log to the debugger but the sound is heard in the code in the image. I tried to nail down the bug as much as possible and I have a feeling the bug stems from how the midiEvents are dequeued. These are the steps I took:
  • I verified that ALL the notes are enqueued by putting a log statement right above the enqueue operation in MidiSynth.cs
  • I verified that the last note is not present when the notes are dequeued by putting a log statement right below the dequeue operation in MidiFilePlayer.cs
  • I repeated these steps with two different MIDI songs and validated the same issue I would appreciate any pointers you might have.
Hello, thanks for this detailed information. I will have a look and will keep you inform.
Avatar
dejimarquis 19/06/2023 06:51
Thank you!
Avatar
Avatar
dejimarquis
Thank you!
I can't reproduce this issue with the MidiFIlePlayer when running directly. Are you got this issue with a demo in particular?
Avatar
dejimarquis 19/06/2023 07:12
I'm using my own midi files. Let me see if I get the same issue with the sample midi files
Avatar
You could also change this setting:
Avatar
FYI I'm having a similar issue: midiPlayer.OnEventNotesMidi.AddListener((List<MPTKEvent> events) => { foreach (MPTKEvent mptkEvent in events) if (mptkEvent.Command == MPTKCommand.NoteOn) foreach (INotePlayedListener listener in notePlayedListeners) { listener.OnNotePlayed(); Debug.Log("Note played at tick " + mptkEvent.Tick); } }); where the last note's event doesn't get logged sometimes. It seems to happen sporadically when using Stop When All Voices Released. Stop No Waiting it happens more, and Stop When All Voices Ended seems to never skip the last event
Avatar
Avatar
Jeffo
FYI I'm having a similar issue: midiPlayer.OnEventNotesMidi.AddListener((List<MPTKEvent> events) => { foreach (MPTKEvent mptkEvent in events) if (mptkEvent.Command == MPTKCommand.NoteOn) foreach (INotePlayedListener listener in notePlayedListeners) { listener.OnNotePlayed(); Debug.Log("Note played at tick " + mptkEvent.Tick); } }); where the last note's event doesn't get logged sometimes. It seems to happen sporadically when using Stop When All Voices Released. Stop No Waiting it happens more, and Stop When All Voices Ended seems to never skip the last event
Thanks @Jeffo I found an issue that could explain this random issue That will be corrected in the next version. Have your say also @dejimarquis if it's urgent. (edited)
Avatar
dejimarquis 20/06/2023 20:25
Not urgent. As far as there's a fix within the next month that's fine.
Avatar
Same here, thanks!
Avatar
@Jeffo @dejimarquis It's corrected, I hope to publish soon a new version. (edited)
Avatar
dejimarquis 21/06/2023 06:56
Ohh wow! Thanks for the quick turnaround
Avatar
You could also add a silent note at the end of the MIDI with the MIDI editor like in this demo
Avatar
Great, thank you!
Avatar
I am currently having an issue with sending controller messages to use a sustain pedal. At the moment, I am able to successfully get sustain on, but when I take my foot off of the pedal, the sustain continues. I've even tested with these settings just to get it to send a "sustain off" This isn't the functional code but it is what I use to send the message. Also to be clear, the channel is being passed from a variable in the function so it's not apart of the MidiPlayer.tk namespace SustainOn = new MPTKEvent { Command = MPTKCommand.ControlChange, Controller = MPTKController.Sustain, Channel = channel, Value = 0 }; SustainOn = new MPTKEvent { Command = MPTKCommand.ControlChange, Controller = MPTKController.Sustain, Channel = channel, Value = 127 }; value of the command yet it still sustains. (edited)
Avatar
I have checked with this demo, works well!
07:43
07:49
07:50
So, try to change the value for your MIDI message controller
Avatar
Avatar
Thierry
I have checked with this demo, works well!
I'll try using a different midi controller.
Avatar
I didn't notice the demonstration menu. I've just been diving through the API to figure things out. The comments are also super helpful. ! I've been going about this all wrong lol
Avatar
Is it possible to use MidiFilePlayer.OnMidiNotesEvent with MidiFilePlayer.MPTK_Play( MidiFileWriter2 notes stuff)? I noticed that the OnMidiNotesEvent doesn't get all the notes events
Avatar
Avatar
mcmuffin
Is it possible to use MidiFilePlayer.OnMidiNotesEvent with MidiFilePlayer.MPTK_Play( MidiFileWriter2 notes stuff)? I noticed that the OnMidiNotesEvent doesn't get all the notes events
Hello, yes of course. MidiFilePlayer loads the MIDI created from MidiFileWriter2 as a MIDI file. Have you example of MIDI events not processed by OnMidiNotesEvent ?
Avatar
I am not sure if it is user error at this point but I cannot get the sustain to trigger off to the synth. This only seems to be an issue with the sustain message. I have tested using other events like modulation, all notes of, ect. but sustain is only activating and this getting stuck in that sustained state. I will share a video of code and example tomorrow for reference. The odd thing is that things work on the Midi stream demo, but won't work in my case even with the same events copy and pasted.
Avatar
Avatar
TeAiris
I am not sure if it is user error at this point but I cannot get the sustain to trigger off to the synth. This only seems to be an issue with the sustain message. I have tested using other events like modulation, all notes of, ect. but sustain is only activating and this getting stuck in that sustained state. I will share a video of code and example tomorrow for reference. The odd thing is that things work on the Midi stream demo, but won't work in my case even with the same events copy and pasted.
Have you make a try with the demo Midi Stream Player?
Avatar
Avatar
Thierry
Hello, yes of course. MidiFilePlayer loads the MIDI created from MidiFileWriter2 as a MIDI file. Have you example of MIDI events not processed by OnMidiNotesEvent ?
I am generating a list of random MPTK_Events like this new MPTKEvent() { Command = MPTKCommand.NoteOn, Value = midiNote, Length = 96, Velocity = Random.Range(80, 127), Tick = i * 96, } And then I create a MidiFileWriter2 variable from this list of MPTK events. Then I call MidiFilePlayer.MPTK_Play(midiFileWriter2)
07:04
And I copied adding a function to AddListener like so MidiFilePlayer.OnEventNotesMidi.AddListener(NotesToPlay);
Avatar
Avatar
mcmuffin
And I copied adding a function to AddListener like so MidiFilePlayer.OnEventNotesMidi.AddListener(NotesToPlay);
and wich events are missing from OnMidiNotesEvent? (the last MIDI events could be "forget", that will be corrected with the next version) (edited)
Avatar
Avatar
Thierry
Have you make a try with the demo Midi Stream Player?
That sounds like a great way to test it. I will insert my class directly into a copy of the demo script and see how it responds. Thanks!
👍 1
Avatar
Avatar
Thierry
@Jeffo @dejimarquis It's corrected, I hope to publish soon a new version. (edited)
Silverknight 25/06/2023 17:44
I've been busy and haven't been able to work on my project very much, but I also have been experiencing problems where the last note of a bunch of my (and asset included) midi files are not played. The bug might be related to this, so I hope the new version will fix it.
Avatar
Avatar
Silverknight
I've been busy and haven't been able to work on my project very much, but I also have been experiencing problems where the last note of a bunch of my (and asset included) midi files are not played. The bug might be related to this, so I hope the new version will fix it.
Sure ! just need time !
Avatar
Avatar
Thierry
and wich events are missing from OnMidiNotesEvent? (the last MIDI events could be "forget", that will be corrected with the next version) (edited)
Pretty much all of them 😦
06:31
I don't see anything showing up in Debug.Log
Avatar
I am debugging the code, is it because this overload comes from ExtFilePlayerPro? MPTK_Play(MidiFileWriter 2.... I don't see any calls to OnEventNotesMidi in ExtFilePlayerPro.cs
06:44
oh maybe not.. i see ThreadInternalMidiPlaying goes back to MidiFilePlayer. I will keep debugging in the meantime
06:46
the OnEventNotesMidi is defined for all class/prefab
06:47
In the MIDI pre processing
Avatar
also, look at: Maestro\MidiPlayer\Assets\MidiPlayer\Demo\ProDemos\Script\TestMidiExternalPlayer.cs
Avatar
QueueMidiEvents count is 0
07:06
in MidiFilePlayer.cs
Avatar
midiExternalPlayer.OnEventNotesMidi.AddListener(ReadNotes);
07:09
I just checked this demo, the OnEventNotesMidi works perfectly
Avatar
I really don't know what I'm doing wrong at this point. I have tested sustain on and off using the demo but the code doesn't work even when I used it directly in the demo script. Here's a bare-bones script I made to test my calls with UI Buttons. (I connected them with Unity Events in the inspector so not in the script.) If possible, could you please review to see if it is anything that I am missing? Thank you. using System.Collections; using System.Collections.Generic; using UnityEngine; using MidiPlayerTK; public class SustainTest : MonoBehaviour { [SerializeField] public MidiStreamPlayer midiStreamPlayer; public void SustainOn() { midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent() { Command = MPTKCommand.ControlChange, Controller = MPTKController.Sustain,Channel = 0, Value = 127 }); } public void SustainOff() { midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent() { Command = MPTKCommand.ControlChange, Controller = MPTKController.Sustain, Channel = 0, Value = 0 }); } public void NoteOn() { midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent() { Command = MPTKCommand.NoteOn, Channel = 0, Value = 60, Velocity = 100 }); } public void NoteOff() { midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent() { Command = MPTKCommand.NoteOff, Channel = 0, Value = 60, }); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } } In this example, I press a button for note on, as the note plays I press the sustain on button. I then press the sustain off button yet nothing happens. Thanks in advance!
07:23
Avatar
Avatar
TeAiris
Click to see attachment 🖼️
It's because sustain is not applied on playing notes but to the next notes
07:40
Set sustain On play note Set Sustain off
07:40
interesting discussions here
👍 1
07:40
On a real piano, if one releases a key and then quickly depresses the sustain pedal, the remaining vibrations from that note will be sustained. A midi keyboard I have simulates that behavior. Howev...
Avatar
Avatar
Thierry
It's because sustain is not applied on playing notes but to the next notes
I can see why this is an issue caused by pedal technique. That may explain whats happening. Its funny reading the MidiCC64 spec explanation. That's how I implemented a work around for now. I created a list of MPTK events and a item is added when a note off is triggered. Then use bools to stop note off even from being triggered. Then when the pedal is released, the list is cleared and the process resets. My only issue is that I would get clips in the audio so I wanted to get sustain to work in the command instead. Now that I look at it, I may be better to just use a int list. I also used this technique in unreal engine a while back with success.
Avatar
@Thierry I have a repro where OnEventNotesMidi is not triggered all the time. I added a test case where only one note event is added to MidiFileWriter2 in TestMidiGenerator.cs. This is the test case I added
08:34
private MidiFileWriter2 CreateMidiStream_one_note_ticks() { // In this demo, we are using variable to contains tracks and channel values only for better understanding. // Using multiple tracks is not mandatory, you can arrange your song as you want. // But first track (index=0) is often use for general MIDI information track, lyrics, tempo change. By convention contains no noteon. int track0 = 0; // Second track (index=1) will contains the notes, preset change, .... all events associated to a channel. int track1 = 1; int channel0 = 0; // we are using only one channel in this demo long absoluteTime = 0; // Create a Midi file of type 1 (recommended) MidiFileWriter2 mfw = new MidiFileWriter2(); mfw.MPTK_AddTimeSignature(0, 0, 4, 4); // 240 is the default. A classical value for a Midi. define the time precision. int ticksPerQuarterNote = mfw.MPTK_DeltaTicksPerQuarterNote; // Some textual information added to the track 0 at time=0 mfw.MPTK_AddText( track0, 0, MPTKMeta.Copyright, "Simple MIDI Generated. 4 quarter at 120 BPM" ); // Define Tempo is not mandatory when using time in ticks. The default 120 BPM will be used. //mfw.MPTK_AddBPMChange(track0, 0, 120); mfw.MPTK_AddNote( track1, absoluteTime, channel0, UnityEngine.Random.Range(41, 80), 50, ticksPerQuarterNote ); // mfw.MPTK_AddSilence(track1, absoluteTime, channel0, ticksPerQuarterNote * 2); return mfw; }
Avatar
Avatar
mcmuffin
private MidiFileWriter2 CreateMidiStream_one_note_ticks() { // In this demo, we are using variable to contains tracks and channel values only for better understanding. // Using multiple tracks is not mandatory, you can arrange your song as you want. // But first track (index=0) is often use for general MIDI information track, lyrics, tempo change. By convention contains no noteon. int track0 = 0; // Second track (index=1) will contains the notes, preset change, .... all events associated to a channel. int track1 = 1; int channel0 = 0; // we are using only one channel in this demo long absoluteTime = 0; // Create a Midi file of type 1 (recommended) MidiFileWriter2 mfw = new MidiFileWriter2(); mfw.MPTK_AddTimeSignature(0, 0, 4, 4); // 240 is the default. A classical value for a Midi. define the time precision. int ticksPerQuarterNote = mfw.MPTK_DeltaTicksPerQuarterNote; // Some textual information added to the track 0 at time=0 mfw.MPTK_AddText( track0, 0, MPTKMeta.Copyright, "Simple MIDI Generated. 4 quarter at 120 BPM" ); // Define Tempo is not mandatory when using time in ticks. The default 120 BPM will be used. //mfw.MPTK_AddBPMChange(track0, 0, 120); mfw.MPTK_AddNote( track1, absoluteTime, channel0, UnityEngine.Random.Range(41, 80), 50, ticksPerQuarterNote ); // mfw.MPTK_AddSilence(track1, absoluteTime, channel0, ticksPerQuarterNote * 2); return mfw; }
Thanks for this well detailed case. With the current version, the last (last absoluteTime/tick) MIDI event is not always send to the OnEventNotesMidi. Try to add some silent note after the last tick of your note. Of course, that will be corrected with the next version.
👍 1
Avatar
Okay sounds good, thank you
Avatar
Avatar
Thierry
It's because sustain is not applied on playing notes but to the next notes
I was surprised to read this and was concerned at first. But sustain does work as I would expect, sustaining notes that are currently playing when sustain is turned on. (Unless a recent update has changed things. I'm still using 2.89) I made a file to test acoustic grand piano and string ensemble 1. Each plays a C chord for four beats with sustain applied at beat three. Sustain is held two beats after note offs. Each voice was sustained for the expected six beats. (edited)
Avatar
Avatar
JWerner
I was surprised to read this and was concerned at first. But sustain does work as I would expect, sustaining notes that are currently playing when sustain is turned on. (Unless a recent update has changed things. I'm still using 2.89) I made a file to test acoustic grand piano and string ensemble 1. Each plays a C chord for four beats with sustain applied at beat three. Sustain is held two beats after note offs. Each voice was sustained for the expected six beats. (edited)
Hello, thanks for this information. I made a quick check with your MIDI and MIDI Stream Music demo. You are right! (edited)
Avatar
Sustain is applied on current notes playing (on the same channel) and on the next notes until sustain is set to off (value 0). This feature exists since the start (5 years now which could explain my mistakes). Thank a lot for thos correction.
👍 1
Avatar
@Thierry I'm preparing the first release of the MIDI editor I've been working on. But I'm unsure of what's legally required for Maestro since it uses FluidSynth under GNU LGPL v2. Are there attributions or copyright notices that should be included? I'm assuming I don't have to make my source code available, or able to link to an alternate version of the library.
Avatar
Avatar
JWerner
@Thierry I'm preparing the first release of the MIDI editor I've been working on. But I'm unsure of what's legally required for Maestro since it uses FluidSynth under GNU LGPL v2. Are there attributions or copyright notices that should be included? I'm assuming I don't have to make my source code available, or able to link to an alternate version of the library.
Hello, good news! I will be happy to see that. Yes, Fluidsynth is under the GNU Lesser General Public License v2.1 which is less restrictive than GPL). You have no need to share your source code (in fact, Maestro Pro is not a free program, you can't share it). However you could add a link to the Maestro pro to the unity store where all references are already done (fluidsynth)
Avatar
I was planning to link to Maestro on the app's itch.io page, and on Steam as well. I definitely want to give you credit, you've done great work. I'll also add a review in the Unity store. I'd been planning to do that for some time now, but I wanted to include a link to a free demo of my app to show what Maestro is capable of. Just to be clear though, are you saying that linking to Maestro and its references also satisfies any legal requirements?
Avatar
I think so. You are using maestro, not directly fluidsynth and maestro have reference to fluidsynt on the unity store. I will able also to share your product links on the paxstellar site. Thank by advance for your future review.
Avatar
Avatar
Thierry
I think so. You are using maestro, not directly fluidsynth and maestro have reference to fluidsynt on the unity store. I will able also to share your product links on the paxstellar site. Thank by advance for your future review.
I've finally published my new app, Euterpe. I've reviewed Maestro Pro on the unity store as well. I'm currently looking for ways to promote it, and still working on the itch.io site. https://unawaregames.itch.io/euterpe I do have one demo video. https://youtu.be/oO0KAv7_3SY (edited)
A musical sketchpad / MIDI player & editor
Avatar
Robin Brooks 09/08/2023 21:00
Well done! I know how hard it is to complete a project thats good enough to publish. Full respect.
🙏 1
Avatar
Incredible! I'm very impressed. You have done a great job and all this stuff with Unity? The UI API is so complex. Are you using the UI Toolkit?
Avatar
Avatar
Thierry
Incredible! I'm very impressed. You have done a great job and all this stuff with Unity? The UI API is so complex. Are you using the UI Toolkit?
Yes, I am using the UI toolkit, although at times that feels like a bad decision. Although it's an improvement over uGUI, it lacks a lot of basic functionality. There is a big gap between what is usable in the editor and what is available for the Unity engine in the LTS release. I am having to create a lot of basic functionality in my own code. I haven't used a UI toolkit this frustrating in decades.
Avatar
Avatar
JWerner
Yes, I am using the UI toolkit, although at times that feels like a bad decision. Although it's an improvement over uGUI, it lacks a lot of basic functionality. There is a big gap between what is usable in the editor and what is available for the Unity engine in the LTS release. I am having to create a lot of basic functionality in my own code. I haven't used a UI toolkit this frustrating in decades.
Perhaps a package to be added to the Unity store? If you have good improvement with UI Toolkit that could be great!
10:06
Thank to Euterpe, I discover that the Maestro MIDI Editor v2.10 didn't take care of the denominator of the time signature. It's corrected (I hope, I'm not confident with the difference between beat and quarter 😁 )
Avatar
Silverknight 29/08/2023 02:29
When I load all the default MIDIs, the console gets spammed with a lot of these warnings. Is this a bug? This is version 2.10.0.
Avatar
Silverknight 29/08/2023 03:32
The drum channel is now not setting correctly anymore and is very inconsistent.
Avatar
Of course, it's not normal. And you get all these messages with the default MIDI and soundfont ?
Avatar
Silverknight 29/08/2023 14:18
Yes.
Avatar
Silverknight 29/08/2023 14:36
I deleted the entire midi player folder, told the package manager to update the midi player in its UI, and then I downloaded and imported the new 2.10.0 midi player into my project. It only has the default midis and soundfont. (edited)
Avatar
Silverknight 29/08/2023 14:55
Unity version 2022.2.21f1.
Avatar
ok, I will test from Unity store.
Avatar
I'm sorry, I can't reproduce your issues. I created a fresh project, downloaded the package from the Unity store. Maestro Free is ok
18:47
for the Pro, I do the same and import the same SOundFont and MIDIs, no issue. (edited)
18:48
Have you this issue with all the MIDI ? Have you tried MidiStream (no MIDI in input) ?
Avatar
These tests has been done on Mac OS and Windows, no issue.
Avatar
Silverknight 29/08/2023 21:15
The issue is with all MIDIs. I usually use MidiFilePlayer (with play at start and send to synth unchecked) and MidiStreamPlayer. (edited)
21:16
I'll try a few things here to see if I can get it to work.
Avatar
Silverknight 29/08/2023 21:35
I'm still getting the problem. I removed the FilePlayer and StreamPlayer objects from the scene, deleted the whole thing, saved and closed, opened Unity back up, redownloaded and reimported MPTK, readded the FilePlayer and StreamPlayer objects, clicked run, the console spammed a lot of warnings, the drum channel isn't working. I went to a new scene and just used the FilePlayer with no changes. It worked on run. I added the StreamPlayer. No problems so far. I added a new MIDI and one warning came up.
21:35
21:36
Avatar
Avatar
Silverknight
Click to see attachment 🖼️
No issue with it
02:57
tested with the unity package downloaded from the store (edited)
03:03
Avatar
Silverknight 30/08/2023 03:22
I'm looking at it again. I've noticed something. Channel 9, drums, is being set to the PatchChange specified in the midi file. Looking at various midis in the Maestro > Midi File Setup, most of them are set to Stereo Grand but they are being ignored and are instead using Standard for drums. Is that what the Channel Exception is on the prefab inspector?
03:23
Because if that is the channel to ignore patch changes, it doesn't seem to be working now. It's set to channel 9 in both the MidiFilePlayer and MidiStreamPlayer and it's still not ignoring channel 9 patch changes.
03:24
03:24
This one is set to Bright Grand.
03:24
03:24
This one is set to Stereo Grand.
03:25
03:25
03:26
03:26
Avatar
channel 9 is associated by default to the soundfont bank 128
03:33
changing patch will only changing the type of drum (a drum patch is special, each note play a different instrument)
03:34
In any case, if preset is changed on channel 9, you will get a drum kit which sound differently, not an error. (edited)
Avatar
Silverknight 30/08/2023 03:37
I send a MPTKEvent of PatchChange to Channel 9 and it's changing its instrument (sending it to MidiStreamPlayer). It's matching the same logic for the other channels. Do I need to do something different for channel 9? (edited)
Avatar
could you make a screen shot as the mine of the soundfont configuration?
Avatar
Silverknight 30/08/2023 03:38
03:39
Avatar
ok perfect
03:39
load the demo MIDI stream music (edited)
03:40
and try this:
03:42
03:42
03:42
you normally get an information message from the demo script (edited)
Avatar
Silverknight 30/08/2023 03:43
Which Scene is that?
Avatar
Silverknight 30/08/2023 03:44
Ah it looks like it is TestMidiStream scene. (edited)
Avatar
yes!
03:45
it's 3h45 here, I'm quite tired 😉
Avatar
Silverknight 30/08/2023 03:45
Oh wow.
03:45
Ok I'm carefully looking over the screenshots and am trying to replicate it.
03:47
Avatar
try the free preset change
Avatar
Silverknight 30/08/2023 03:48
Avatar
these messages are from Maestro to inform you that this preset is not available (edited)
03:51
simply, with MidiFilePlayer, preset change on channel 9 are disabled .... if enabled in the inspector
03:51
it's because a few of MIDI are not compliant with the standard
03:52
it's very rare
Avatar
Silverknight 30/08/2023 03:52
So with this set to channel 9, that means preset changes should be ignored, correct?
Avatar
yes
Avatar
Silverknight 30/08/2023 03:54
I have this piece that listens to MidiFilePlayer events. It switches over the event command.
03:54
Here's the PatchChange part.
03:55
I store the MPTKEvent in a timer wrapper class.
03:55
Here's the wrapper class.
03:56
After the timer expires, send the MPTKEvent to the MidiStreamPlayer stored in my TrackManager.
03:57
And that's it. I'm not sure how it's changing channel 9 to be something else.
Avatar
oh, sorry, I made a mistake
03:58
03:58
exception is only for the transpose
03:59
so with this setting, transpose will not be applied on drum (which is better !)
03:59
that was one the first feature I developed .. 5 years ago! (edited)
Avatar
Silverknight 30/08/2023 03:59
Interesting
Avatar
Sorry, I need to sleep a few
04:01
we will continue this talk tomorrow if possible
Avatar
Silverknight 30/08/2023 04:01
Ok. Well thanks for your time so far. It's still a mystery to me. (edited)
04:02
It's basically reading the events, waiting 3 seconds, and then just sending them to the stream player.
Avatar
and you get error?
Avatar
Silverknight 30/08/2023 04:03
No console error, but drum channel not setting correctly. There are also a ton of console warnings on incorrect microsecond conversion and forcing 120 tempo. This is before I play anything.
Avatar
ok, we will see tomorrow, bye
Avatar
Silverknight 30/08/2023 04:07
I do use a MidiFileLoader to read all the files and get all their NoteOn values for character playing placement offsets (basically if there's a high-pitched instrument like a piccolo flute or a low-pitched instrument like a tuba, their paws always play on the high or low end of the keyboards and can often go off their visual scales if I don't force a octave or 3 offsets up or down to "re-center" where they play on the keyboard). (edited)
04:07
But I don't do anything with the events afterwards and use the MidiFilePlayer to read a selected file and use the MidiStreamPlayer to play the events.
Avatar
Avatar
Silverknight
I do use a MidiFileLoader to read all the files and get all their NoteOn values for character playing placement offsets (basically if there's a high-pitched instrument like a piccolo flute or a low-pitched instrument like a tuba, their paws always play on the high or low end of the keyboards and can often go off their visual scales if I don't force a octave or 3 offsets up or down to "re-center" where they play on the keyboard). (edited)
Sorry, no news on my side. I did'nt understand why you have so many messages, I can't reproduce. The only difference is the Unity version. Could you try with a LTS version of Unity and a fresh Maestro project? It's always better because these versions are actively maintain by Unity. Have a look here: https://unity.com/releases/editor/qa/lts-releases (edited)
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal players.
Avatar
Silverknight 30/08/2023 21:03
I'll go ahead and try that.
Avatar
Silverknight 30/08/2023 21:29
Updated my project to 2022.3.8f1 LTS and the issue still exists. I'll create a new empty Unity project in this version and try out Maestro in that.
Avatar
Silverknight 30/08/2023 23:49
I was able to replicate the drum problem in an empty new project matching similar basic logic of what my stuff does. I'm now looking into the console spam replication. (edited)
Avatar
Silverknight 31/08/2023 00:18
I was able to replicate the console spam problem.
00:24
00:25
00:25
I also noticed these do not match in number.
00:30
Try this. If it's missing too many things I'll make a new package.
00:30
To replicate:
00:32
Unity setup: 1. Create a new empty project in unity LTS 2022.3.8f1 2. Download and import the free Maestro from the package manager. 3. Import this custom package. 4. Go to the BrokenDrumScene scene.
Avatar
Silverknight 31/08/2023 00:39
Broken Drums: 1. Verify the MidiFilePlayer, MidiStreamPlayer, and SceneController objects exist. 2. On the MidiFilePlayer, verify Play At Startup and Send To Synth are both unchecked. Everything else should be default. 3. Verify the MidiStreamPlayer is all default settings. 4. Click Unity Run. 5. Click the MidiFilePlayer object and click its Play button. 6. Wait 3 seconds and see the MidiObject(Clone)s populate and process. 7. Confirm if the drums are playing correctly (they should at this moment). 8. Click the MidiFilePlayer's Stop button and wait for all sounds to stop. 9. Click the Select MIDI and click the 2 - All Night Long. 10. After several seconds, listen to the drums and hear if it's not correct. 11. Click the Stop button and wait until all sounds are over. 12. Select the 4 - Aqua - Lollipop Candy Man track and wait for it to play. 13. Listen to the drums and hear if it's not correct as well. 14. Click the Stop button and wait until all sounds are over. 15. Play the default track again, Bobby Blue Band - A Touch Of Blues (it might not be number 49, but 21 now). 16. Listen to the drums and hear if it's not correct. 17. Close the Select menu and stop Unity Play.
00:41
Console spam: 1. Go to the LoadMidiSpamScene. 2. Verify the MidiFileLoader and SceneController objects exist. 3. On the MidiFileLoader, verify all settings are default in the Inspector. 4. Click Unity Run. 5. Verify if the console prints over a thousand warnings. 6. Stop Unity Run.
Avatar
Silverknight 31/08/2023 01:04
Let me know if it's just something simple I'm missing.
Avatar
Avatar
Silverknight
Let me know if it's just something simple I'm missing.
Awesome! I will do ASAP
Avatar
Perfect, I'm able to reproduce the issues. I will investigate for finding the cause (that could take some time) (edited)
Avatar
A quick answer to the community after private talks with @Silverknight. Thank to him, that help to make Maestro better. 1) when a bank change is done on the channel 9, the default percussion bank (128, in general) can be overridden ... also drum hit can be replaced by piano for example. It's why we have MPTK_EnablePresetDrum : to disable this behavior. But the evil is in the details: with MidiFilePlayer, MPTK_EnablePresetDrum is set to false by default but set to true with MidiStreamPlayer. You have to decide what behavior you want! Access to this attribut will be easier with the next version. 2) in the documentation, the class MidiLoad is flagged "not recommended to instanciate directly this class" now it's clearly no more possible. MidiLoad is an internal class use by all the prefab to ... load a MIDI. It's in the documentation to give information about interesting attributs available when a MIDI is loaded. It's now better to use MidiFilePlayer prefab to load a midi. Look at MPTK_MidiLoaded attribut of MidiFilePlayer (or MidiExternalPlayer, MidiInReader, ...), you will retrieve all information about the MIDI loaded. https://mptkapi.paxstellar.com/d7/deb/class_midi_player_t_k_1_1_midi_file_player.html#af88e454905bf7b1e9f2bc227beb961de (edited)
Documentation application programm interface for MIDI player tool kit
Avatar
Also the prefab MidiFileLoader will be deprecated. The MidiFilePlayer have all the features required, so that will be easy to replace it. (edited)
Avatar
Newbie question: Is there a way to archive a similar sound as midimaker.io ? (if generate a MIDI file there, it sounds very different when played back in mptk)
Avatar
Avatar
Rune
Newbie question: Is there a way to archive a similar sound as midimaker.io ? (if generate a MIDI file there, it sounds very different when played back in mptk)
Hello, interesting app! That will be hard to have similar sounds. midimaker.io is based on it's own synthesizers (for what I have seen, Frequency Modulation) and Maestro is based on SoundFont synths. Perhaps, try to build a music with instruments available in a soundfont (piano, sax, ... but i did'nt found how to select an instrument) and add preset changes corresponding to the instruments on the generated music with your prefered Midi Sequencer for each channels. (edited)
18:28
With Maestro free, you have the list of instruments here
18:28
18:29
if you have Maestro pro you can import your own soundfont.
Avatar
Thanks for the detailed answer, I do have pro and I am using it in a few educational games already. And yes a really cool app they have, That is why I wondered if there was a way to use Maestro for a similar playback experience 🙂
Avatar
misterix8009 19/09/2023 12:58
Hello everybody! I have a question concerning the MidiPlayerTK.MidiSynth class. It says in the documentation, that it is not meant for direct use. So as i understand it, it can only be accessed throught the MTPKEvent() class. So is it possible to access basic parameters like MPTK_ApplySFChorus[get, set] or MPTK_ApplySFReverb[get, set] as I only want to use the soundfont effects? I`d also like to manipulate the detailed parameters like: float MPTK_ChorusDelay[get, set] float MPTK_ChorusDepth[get, set] float MPTK_ChorusDryMix[get, set] float MPTK_ChorusRate[get, set] (edited)
12:59
Is that possible, or can I only go via MTPK_ModifySynthParameter(fluid_gen_type... method?
Avatar
Avatar
misterix8009
Hello everybody! I have a question concerning the MidiPlayerTK.MidiSynth class. It says in the documentation, that it is not meant for direct use. So as i understand it, it can only be accessed throught the MTPKEvent() class. So is it possible to access basic parameters like MPTK_ApplySFChorus[get, set] or MPTK_ApplySFReverb[get, set] as I only want to use the soundfont effects? I`d also like to manipulate the detailed parameters like: float MPTK_ChorusDelay[get, set] float MPTK_ChorusDepth[get, set] float MPTK_ChorusDryMix[get, set] float MPTK_ChorusRate[get, set] (edited)
Hello I'm sorry, it's an unclear explanation. Yes, you can use all attributes and methods available from this class (when they start with MPTK_). In fact, MidiFilePlayer or MidiStreamPlayer inherits from the class MidiSynth. Just you can't instantiate directly it with something like: MidiSynth midisynth=new MidiSynth () I will correct the documentation. (edited)
20:36
MTPK_ModifySynthParameter is a funny class, useful to change the sound in real-time 😉 but playing with sound effect are better. As MidiFilePlayer or MidiStreamPlayer inherits from the class MidiSynth, you have access to MPTK_ChorusDelay (for example) with an instance of them, like midiFilePlayer.MPTK_ChorusDelay=0.2 (edited)
Avatar
I hope this is more clear: (edited)
20:59
Avatar
Sometimes when I play algorithmically generated midi sequences through buttons, the sounds overlap. Other times when I press the buttons it will stop the previous sound before playing the new sound. How can I prevent the sounds from overlapping?
Avatar
Nevermind, I figured out. I was accidentally adding additional listeners to the buttons
06:55
😂 2
Avatar
Good! There is also a case where a previous note is stopped by another note: when it's the same note. it's like on a real piano, you cant' play the same note at the same time. It's also possible to disable this default behavior with Maestro.
😮 1
Avatar
In case of, this seeting is here:
👍 1
09:20
Available also by script (edited)
Avatar
essencescape 23/10/2023 19:35
Greetings, If I want to create patterns within a scale, I can jump degrees with this[index] 0 being Tonic, 1 being ii, 2 being iii , etc?
Avatar
Avatar
essencescape
Greetings, If I want to create patterns within a scale, I can jump degrees with this[index] 0 being Tonic, 1 being ii, 2 being iii , etc?
Hello, yes with Maestro Pro, you have some methods to create chords. An example is available with the demo "Midi Stream Music" (edited)
20:52
20:55
20:56
or from lib
20:56
20:57
Avatar
essencescape 23/10/2023 21:11
Yea, that’s helpful but not what I need just yet. what I mean is like if I want to do like a melody that goes D F A B C E G, can I use the scale with an index (edited)
21:13
if I have Bb Major scale , and I want to do a fourth from any note, then I add 4 to the index and it plays that next note
21:15
What I want to do: 1. Choose a scale 2. Use numeric patterns to choose or control the notes inside that scale
21:20
Example: C d e f g e c a ,d e f g a f d b, e f g a b d c a f d
21:21
1 2 3 4 5 3 1 6, 23456427, etc
Avatar
Avatar
Thierry
Click to see attachment 🖼️
essencescape 23/10/2023 21:24
I think these settings probably do what I want but not sure
21:25
( I don’t have access to internet right now on my laptop, so I can’t test any of my ideas xD, need to install unity and the tool) (edited)
22:09
22:10
Play all notes from a scale in a loop. Or from intervals is possible. (edited)
22:14
each scales are defined in a txt file
22:15
Avatar
essencescape 25/10/2023 02:55
yea i just add the interval on the ecart
02:55
hahahahaha
02:55
i mean, interesting
02:56
a bit hard to follow
02:56
finally bought the full version
03:03
can i edit the gamme file to have more octaves?
Avatar
Avatar
essencescape
can i edit the gamme file to have more octaves?
finally bought the full version
Thanks for your support!
Avatar
Avatar
essencescape
a bit hard to follow
a bit hard to follow
sure, I did'nt got a lot of requests about chord and range, for the last 5 years. So in fact it's like a first version! That could change with your help. The TestMidiStreamPlayer is quite huge and finally not efficient for demonstration. It's why I created MVP demo
(edited)
07:47
07:47
I just added the MVP for range
07:48
Instructions inside the cs script
07:49
07:52
can i edit the gamme file to have more octaves?
Sure, but you will lost your change if you want to update Maestro. Generally, it's better to not change or add something inside Assets/MidiPlayer folder Or send me what you want to add/modify, I will update the official version.
Avatar
essencescape 25/10/2023 12:48
12:48
Got it
12:48
Thanks, will work my way from here, managed to randomize within the scale
12:54
What is the suggested way to keep a firm tempo with midistream events
Avatar
essencescape 25/10/2023 14:09
Almost perfect, managed to do the first iteration of procedural melody with note values. If you want me to do an explanation/post code/ or do a better version, let me know.
Avatar
Bravo! Excellent!
What is the suggested way to keep a firm tempo with midistream events
Avoid IMGUI, perfect for quick devel and demo, but time accuracy is quite random and the worse, huge garbage collector operation wich freeze all process for a very perceptible time. Prefer using UI Toolkit. https://docs.unity3d.com/Manual/UIElements.html
17:12
Also, use the FixedUpdate() to perform all MidiStream play events.
17:15
If you want me to do an explanation/post code/ or do a better version, let me know.
Sure! I'm also interested if you have concern about music theory for scale and chord and what I can improve with Maestro 😁
Avatar
essencescape 25/10/2023 23:32
Thanks, the theory is pretty good. I’m used to intervals/progressions/jazz harmony. Just trying to understand the indexes and parameters
23:33
There are parameters and things that are needed to know to do certain things, I think the documentation can improve in that sense. But not many people will need some of that info xD so idk
23:34
I could use inversions and voice leading but I feel that is semi advance to benefit the most amount of people
23:34
So I don’t think it’s need to be added if it doesnt benefit the majority of users
23:36
As it can be done with custom scripts
Avatar
Avatar
Thierry
Bravo! Excellent!
What is the suggested way to keep a firm tempo with midistream events
Avoid IMGUI, perfect for quick devel and demo, but time accuracy is quite random and the worse, huge garbage collector operation wich freeze all process for a very perceptible time. Prefer using UI Toolkit. https://docs.unity3d.com/Manual/UIElements.html
essencescape 26/10/2023 00:11
I take it custom code is responsible to keep time of beats with stream, or is there a function or call that can be used to calculate bpm (edited)
Avatar
is there a function or call that can be used to calculate bpm
No, this kind of algos are not enough reliable. The best way is using your custom code (done with the demo Euclidean Rhythm)
(edited)
07:48
I realize that I made a mistake with this class name: MPTKRangeLib. That will be renamed to MPTKScaleLib with the next version. (edited)
Avatar
Hi everyone! I'm having a problem exporting my game for meta quests with Midi Maestro. I'm convinced that the problem is Midi Maestro because I tried to do a build without Midi Maestro and everything works correctly. Is there any step to export for Android that perhaps I absentmindedly skipped? Thank you
Avatar
Avatar
Matteo
Hi everyone! I'm having a problem exporting my game for meta quests with Midi Maestro. I'm convinced that the problem is Midi Maestro because I tried to do a build without Midi Maestro and everything works correctly. Is there any step to export for Android that perhaps I absentmindedly skipped? Thank you
Hello Matteo. I have no skills with Meta Quests. Do you want to deploy a VR game for Occulus ?
Avatar
Hey, yes
Avatar
To be honest, I never checked Maestro with Meta Quests. Have you some information how to check the compatibly? A technical document from Meta? What kind of error have you ?
Avatar
Sorry for my late reply, there are errors attached. Here is the unity meta quest documentation: https://developer.oculus.com/documentation/unity/unity-gs-overview/
5.38 KB
Overview topic that summarizes the process to get started with Meta Quest app development in Unity
Avatar
Thanks for these information. I'm so newbies with VR, I did'nt understand that the issue is when you upload from Unity to the device. I thought that was when uploading in the Meta store. Some questions:
  • which Unity version are you using?
which Maestro version? which model of oculus are you using? Bellow the settings for deploying on Android.
(edited)
Avatar
Settings with Unity 2021.3
Avatar
Thank you! I'll try it later
Avatar
Hello everyone! I have a question: I'm currenclty trying to put the whole Maestro Pro Kit into a Assembly definition but it leads to waird errors (building and in editor) For example, I'm not able to acess settings from MPTK (see image for example) What assemblies does MPTK need to work correctly? (edited)
Avatar
Avatar
Artibex
Hello everyone! I have a question: I'm currenclty trying to put the whole Maestro Pro Kit into a Assembly definition but it leads to waird errors (building and in editor) For example, I'm not able to acess settings from MPTK (see image for example) What assemblies does MPTK need to work correctly? (edited)
Hello @Artibex Good synchronization! I just added Assembly Definition to maestro. That will be for the next version, so not before 1 or 2 months. I could guide you how-to in a private chat, if you want ... (edited)
Avatar
Hello, I'm thinking of upgrading to Pro, but can I use SFZ files with it? Or does it have to be Sf2 files? And if so, is there any way to convert them? (edited)
Avatar
Avatar
jojogilx
Hello, I'm thinking of upgrading to Pro, but can I use SFZ files with it? Or does it have to be Sf2 files? And if so, is there any way to convert them? (edited)
Hello, I apologize for that, but Maestro is not compliant with SFZ format. It's on the backlog but not yet planned because there is good tool like polyphone for doing that:https://www.polyphone-soundfonts.com/documentation/en/manual/soundfont-editor/editing-pages/instrument-editor
Polyphone is a free and open-source software for editing sf2, sf3, sfArk and sfz soundfonts. A clean interface and convenient tools have been implemented to efficiently deal with small or big instruments. Polyphone is available in different languages for Windows, Mac OS X, Linux and comes with a forum and a detailed documentation.
Avatar
Avatar
Thierry
Hello, I apologize for that, but Maestro is not compliant with SFZ format. It's on the backlog but not yet planned because there is good tool like polyphone for doing that:https://www.polyphone-soundfonts.com/documentation/en/manual/soundfont-editor/editing-pages/instrument-editor
So if i buy Pro i can load sf2, right?
Avatar
yep
Avatar
alright thank you! i will use polyphone for converting then
👍 1
Avatar
ChatGPT answer: Sure, you can convert a soundfont from SFZ format to SF2 using the following methods: Polyphone: This is a software that can be used to convert an SFZ file to an SF2 file. Here is the command you can use in Polyphone: polyphone -1 -i your-soundfont.sfz
🙏🏻 1
Avatar
Hi all. I'm new to Unity game development and been trying to find some help with game music. I've been told to check out Maestro by more than one person. Im making a top down action RPG, not a rhythm game. So would Maestro be a good fit to dynamically change or add instruments based on different characters on screen in non-linear gameplay? For example, one enemy type would cause a guitar to play the melody or another type would cause a flute and maybe both enemies on screen would be both. Would Maestro be overkill for this? Any advice would be appreciated and sorry if this is not the right place for this question.
Avatar
Sounds like a decent use case for maestro to me. Your tracks can be midi, you can change the instrument to a different one in your soundfont bank via code
👍 1
Avatar
That has been the most helpful response I've had all day. Thank you. I'll give it a shot. Now I just need to learn Unity and Maestro. 😁
Avatar
No problem, just start simple and build it up from there. It shouldnt be too hard to prototype what you want to do so you have a proof of concept. Also, chatgpt can help with some boilerplate code.
😁 1
Avatar
Hi @Thierry - really optimistic about using Maestro for a rhythm game. 2 things: 1. The docs site (paxstellar.fr) seems to be down. Am crawling my way through internet archive but it's slooooow 2. I've managed to build a project for iOS that uses Maestro to play some midi in a scene (using a Prefab Player) and time some animations off it. When I play the game, the animations work which suggests that Maestro is running but I can't get audio to play at all - are there common gotchas for why it works in Unity editor but not on iOS?
Avatar
Avatar
klang
Hi @Thierry - really optimistic about using Maestro for a rhythm game. 2 things: 1. The docs site (paxstellar.fr) seems to be down. Am crawling my way through internet archive but it's slooooow 2. I've managed to build a project for iOS that uses Maestro to play some midi in a scene (using a Prefab Player) and time some animations off it. When I play the game, the animations work which suggests that Maestro is running but I can't get audio to play at all - are there common gotchas for why it works in Unity editor but not on iOS?
Hello @klang No issue on my side: https://paxstellar.fr/news/
Info 12 December 2023 Version 2.11.1 is available on the Unity store with two fix: Info 4 December 2023 Version 2.11.0 available on the Unity store! Change Maestro MPTK attained the age of maturity. This new version is mainly focused Read more…
18:15
Play music in your Unity games or applications from Midi files. Thank to SoundFont for adding hundred sounds of instruments for playing Midi files.
18:16
Documentation application programm interface for MIDI player tool kit
18:18
are there common gotchas for why it works in Unity editor but not on iOS?
18:20
Hard to answer! There is no known issue with iOS. Have you some way to get the log when running?
18:25
Sure, it's not obvious to get log from iOS.
Avatar
Hi thanks for getting back to me - tbh had spent all day waiting ages for Internet archive to load the docs / banging my head against it so had hoped it was a common config issue and reached out! I'll try again tomorrow now the docs seem to be up and when I have the patience 😅 great asset and great choice of sample music 😉
Avatar
Thanks a lot for your comment 😁
19:03
check here in the MidiFilePlayer inspector:
19:04
and try different settings in Unity Audio project settings: (edited)
19:06
mainly related to the DSP buffer size
Avatar
That's a really good lead thanks! I'll try first thing tomorrow 🙂
Avatar
Avatar
Thierry
and try different settings in Unity Audio project settings: (edited)
Working! For some reason there was something that overrode the DSP buffer size settings and changing it back and forth fixed it 🙏
👍 1
Avatar
Hi! Is it possible to convert a MIDI file I made using the plugin to an audio file (like wav or mp3)?
17:49
Id like to use the audio file so I can then use that to upload to soundcloud directly from the app
Avatar
Hello, No, sorry, this feature is not available with Maestro. The reason is there are a lot of excellent DAWs, often for free, which are doing perfectly this action!
Avatar
hmm, do you have any idea how I could achieve this?
18:47
Thanks for the quick reply as well!
Avatar
try this search on your favorite search engine: cakewalk, how generate MP3 from MIDI
18:56
And here with ChatGPT: (edited)
🙌 1
18:57
Avatar
An open source/free way to convert MIDI to WAV/MP3 is VideoLAN. It uses FluidSynth, so the output is close to Maestro. It's also possible to use the same soundfont. However, the mix may need adjusting. FluidSynth seems to be using a logarithmic volume, which can result in some instruments having a very soft output (or none at all). (edited)
20:36
To specify the soundfont in VideoLAN, open Preferences and check the 'All' button under 'Show settings' in the lower left corner. In the settings list, select 'Input / Codecs' -> 'Audio codecs' -> 'FluidSynth'. There's a place to browse for the soundfont, plus a few other settings. (edited)
Avatar
It's also possible to create a WAV directly in Unity, using the OnAudioFilterRead message callback. I recently added this to my MIDI creation/editing app. I based the code on information found here: https://evanxmerz.com/post/recording-in-game-audio-in-unity But some significant changes were necessary. This is not a perfect solution. The MIDI file has to be recorded from Maestro's playback in real-time, instead of rendering directly to a stream, which would be faster and more reliable. But it works well enough for now. It may also be possible to convert to MP3 or Vorbis within Unity, but I haven't looked into it.
Recently I began doing a second pass on my synthesizers in the Google Play store. I think the core of each of those synths is pretty solid…
Avatar
Avatar
JWerner
It's also possible to create a WAV directly in Unity, using the OnAudioFilterRead message callback. I recently added this to my MIDI creation/editing app. I based the code on information found here: https://evanxmerz.com/post/recording-in-game-audio-in-unity But some significant changes were necessary. This is not a perfect solution. The MIDI file has to be recorded from Maestro's playback in real-time, instead of rendering directly to a stream, which would be faster and more reliable. But it works well enough for now. It may also be possible to convert to MP3 or Vorbis within Unity, but I haven't looked into it.
Wow!! Thanks a lot, will look more into it since converting directly in Unity would be perfect for what im trying to do
Avatar
Thanks al lot @JWerner for these excellent recommendations. @fcarrasc you can find the OnAudioFilterRead in Assets\MidiPlayer\Scripts\MPTKGameObject\MidiSynth.cs around the line 3069 and add the "stream save" at the end, for exemple, after the loop for (int i = 0; i < FLUID_BUFSIZE; i++). Be careful, any delayed time in the OnAudioFilterRead will produce bad sounds. Of course, if you update Maestro with a new version you will lost your change 😉
Avatar
Avatar
Thierry
Thanks al lot @JWerner for these excellent recommendations. @fcarrasc you can find the OnAudioFilterRead in Assets\MidiPlayer\Scripts\MPTKGameObject\MidiSynth.cs around the line 3069 and add the "stream save" at the end, for exemple, after the loop for (int i = 0; i < FLUID_BUFSIZE; i++). Be careful, any delayed time in the OnAudioFilterRead will produce bad sounds. Of course, if you update Maestro with a new version you will lost your change 😉
Hi @Thierry, I didn't mean to suggest something that could cause performance issues. I didn't modify MPTK to record the audio. I created an object with an OnAudioFilterRead callback in the display thread, and minimized any display updates during recording. This works well with little chance of interfering with MPTK performance.
Avatar
@JWerner @fcarrasc I'm very busy with a new version of MPTK and also new Unity package. When they will published I will make some tries with your proposals.
Avatar
kidtaicho 09/02/2024 19:53
Hello, I've run into this problem twice now working on my project, I make use MPTK to play a midi file and fire events for each note that's played. I've been able to get it working with no problems in general, but somewhere along my development process the audio stops playing and I get some variation of this error as it attempts to play the music "Cannot get data on compressed samples for audio clip "Shenai-Ad3". Changing the load type to DecompressOnLoad on the audio clip will fix this. UnityEngine.AudioClip:GetData (single[],int)". I've tried re-download the package and it doesn't seem to fix things, any guidance you can provide would be great, also happy to move this somewhere else if there's a better place for, can provide full stack trace if needed
Avatar
Hello, I've the feeling you have an issue with the soundfont. Which soudfont are you using? A link to be able to check it?
Avatar
kidtaicho 09/02/2024 21:47
I'm not sure, where would I find that information? I currently have version 2.11.1 for MPTK and I believe I wiped everything out and did a fresh install
Avatar
@kidtaicho the MPTK Free ?
Avatar
I not able to reproduce your issue with the preset 111 (Shenai)
07:30
Could you provide me more contextual info to reproduce? MPTK Free or Pro? MacOS or Windows? perhaps your MIDI? (edited)
Avatar
kidtaicho 10/02/2024 14:29
Sure, I'm unfortunately not sure how to reproduce either. Everything was working fine and as I continued to work on my project eventually this error just started occurring. I'm running the free version, on windows, I'm just using a sample midi file right now. And I'm only making use of the midifileplayer.
Avatar
Avatar
fcarrasc
Hi! I was wondering if the MIDI input / output functionality of the PRO version works with iOS and Android devices?
Yort_Draeb 15/02/2024 16:31
did you ever get a response on this? i couldnt find one and i have the same question. the asset page doesnt explain that very well
Avatar
Avatar
Yort_Draeb
did you ever get a response on this? i couldnt find one and i have the same question. the asset page doesnt explain that very well
Hello, clearly no ! The MidiKeyboard integration is available only on MacOS and Windows, not on smartphone. Known limitations: Tested with: Windows 10 or higher, CPU 64 bits. MacOS 10.1 or higher, CPU Intel/AMD CPU or Apple Silicon (M1, M2, ..). Not available on Android and IOs. Not able to process Sysex messages (perhaps in the future if there is a need!)
18:40
In your case, the properties RealTime of each MPTKEvent was not useful? Nope, because MIDI player can be paused, seeked at different time and its...
18:40
search post from EdgarW
18:41
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
18:42
Sadly, I did'nt get time to check this solution. (edited)
10:38
Can you use Maestro to trigger animations like this in Unity?
10:39
trigger anim events from a midi file
Avatar
Hello! Sure, by script and you have to create your animations and trigger them with MIDI events.
10:42
When a MIDI events is read from the MIDI file (thru the Maestro MIDI sequencer) this MIDI events can also be send to your script
Avatar
groundHog 18/02/2024 10:44
Great. Thanks for the fast response! Can you point me to any examples of this workflow? Youtube videos or existing threads in this discord channel of how that set up looks?
10:46
I'm very familiar with Unity and creating animations etc. But I use Playmaker so I'm not the best at wrting scripts.
10:47
My hope is that Maestro is easy to use even for someone who isn't great at coding but is familiar. (edited)
Avatar
Get the Maestro - Midi Player Tool Kit - Free package from MusIT and speed up your game development process. Find this & other Audio options on the Unity Asset Store.
10:49
and the demo Catch Music
10:51
10:52
In MusicView.cs:
10:52
// add event on each MIDI events midiFilePlayer.OnEventNotesMidi.AddListener(NotesToPlay);
10:52
and the handler for each events where you could trigger animations based on the type of MIDI event and the value (note, instrument, ...) (edited)
Avatar
groundHog 18/02/2024 10:53
Excellent Ill check it out!
Avatar
But, I encourage you to read the MAestro doc!
👍 1
10:55
Info 12 February 2024 Version 2.11.2 will be soon available on the Unity store with technical improvement and a new feature: Info 12 December 2023 Version 2.11.1 is available on the Unity store with two fix: Info 4 December 2023 Read more…
Avatar
groundHog 18/02/2024 10:57
Thank you!
Avatar
MatterLinx 21/03/2024 21:01
How can I get MidiNotePlayer to play the midi file note by note?
Avatar
Avatar
MatterLinx
How can I get MidiNotePlayer to play the midi file note by note?
omg i just joined discord to ask the same question
Avatar
Avatar
MatterLinx
How can I get MidiNotePlayer to play the midi file note by note?
have you found anything?
Avatar
Avatar
youseaf
have you found anything?
MatterLinx 23/03/2024 02:28
public class MidiNotePlayer : MonoBehaviour { public MidiStreamPlayer midiStreamPlayer; public string midiName = "Animal Crossing"; private List<MPTKEvent> midiEvents; private int currentNoteIndex = 0; void Start() { LoadMidiEvents(); } void LoadMidiEvents() { var midiLoad = new MidiLoad(); midiLoad.MPTK_Load(midiName); midiEvents = midiLoad.MPTK_ReadMidiEvents(); } public void PlayNextNote() { if (midiStreamPlayer == null) { Debug.LogError("MidiStreamPlayer is not assigned!"); return; } if (midiEvents == null || midiEvents.Count == 0) { Debug.Log("No MIDI events loaded."); return; } bool notePlayed = false; // Start a loop to handle simultaneous notes while (currentNoteIndex < midiEvents.Count) { MPTKEvent midiEvent = midiEvents[currentNoteIndex]; if (midiEvent.Command == MPTKCommand.NoteOn && midiEvent.Velocity > 0) { midiStreamPlayer.MPTK_PlayEvent(midiEvent); notePlayed = true; } currentNoteIndex++; if (currentNoteIndex >= midiEvents.Count) { currentNoteIndex = 0; if (notePlayed) break; } else if(notePlayed && (currentNoteIndex >= midiEvents.Count || midiEvents[currentNoteIndex].RealTime != midiEvent.RealTime)) { break; } } } } (edited)
❤️ 1
02:29
Don't know if this this the proper approach, but it works (edited)
Avatar
@MatterLinx @youseaf exact! Of course all notes will be played at the same times.
Avatar
Avatar
Thierry
@MatterLinx @youseaf exact! Of course all notes will be played at the same times.
MatterLinx 24/03/2024 04:28
This method doesn't seem to be switching instruments, when I play it with the MidiFilePlayer it sounds different. Any solutions? (edited)
Avatar
Yes, remove the test with noteon
07:49
And velocity
Avatar
replace if (midiEvent.Command == MPTKCommand.NoteOn && midiEvent.Velocity > 0) { midiStreamPlayer.MPTK_PlayEvent(midiEvent); notePlayed = true; } (edited)
08:05
by just midiStreamPlayer.MPTK_PlayEvent(midiEvent); notePlayed = true; (edited)
Avatar
when will mptk pro go on sale/discount, do you plan bringing it on sale sometime
Avatar
As a publisher, i'm not able to decide for discount. It's always a Unity team's proposal. I can just accept or decline. In general, Unity propose a discount at the end of year.
Avatar
how do i select, copy and paste notes in the midi editor
Avatar
Avatar
Wowsie
how do i select, copy and paste notes in the midi editor
there is no function to copy/paste a group of notes
Avatar
It's always in the backlog
06:52
You want to create your MIDI music directly in the Unity Editor? You are on the right page! The goal of the Maestro MIDI editor is not to replace available DAW, often free, often incredibly complex, but to propose an Read more…
06:56
My current priorities is to enhance the MIDI player to be as close as possible as the original Fluidsynth sound.
06:56
... and it's quite complex. But very good improvement are already available! (edited)
Avatar
How do i play random instrument note in C# (edited)
Avatar
Avatar
Wowsie
How do i play random instrument note in C# (edited)
with a random function 😁
20:39
Example from TestMidiStream.cs
20:44
CurrentNote = UnityEngine.Random.Range(StartLoopingNote, EndLoopingNote); CurrentDuration = UnityEngine.Random.Range(0.1f, 2f); private void MaestroPlayOneNote() { NotePlaying = new MPTKEvent() { Command = MPTKCommand.NoteOn, Value = CurrentNote, // note to played, ex 60=C5. Use the method from class HelperNoteLabel to convert to string Duration = Convert.ToInt64(CurrentDuration * 1000f), // millisecond, -1 to play indefinitely }; midiStreamPlayer.MPTK_PlayEvent(NotePlaying); }
20:44
and for selecting a randam instrument, it's quite the same
20:45
midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent() { Command = MPTKCommand.PatchChange, Value = CurrentPreset, Channel = StreamChannel, });
20:46
for changing the instrument on a channel
20:46
with CurrentPreset= UnityEngine.Random.Range(0, 127);
Avatar
where do i put this code, i got an error (edited)
22:47
Avatar
Add this script in your project, create an empty gameobject in your scene, add this script (read carefuly the header comments) ... and play! Look at the Update() method how to detect key stroke and play random music. (edited)
05:30
05:34
This demo works with any MPTK prefab added in the scene (the prefab is automatically created at start). But you can also add a MidiStream prefab in the scene if you want to change settings in the inspector. (edited)
05:35
Other version with a prefab in the scene: (edited)
Avatar
david-morales 10/05/2024 16:47
We have a need for a 15 track midi song, with different BPM's per track/instrument. Is it possible to have individual BPM control per track? I wasn't able to find anything in the documentation.
Avatar
Avatar
david-morales
We have a need for a 15 track midi song, with different BPM's per track/instrument. Is it possible to have individual BPM control per track? I wasn't able to find anything in the documentation.
Sadly no. By design with MIDI music, BPM is related to all the tracks and channels (so, it's not a MPTK limitation 😁 ). Yes, you could have 15 MIDI files playing simultaneously with 15 different BPMs with 15 MidiFilePlayers prefab ... if you are not too demanding about the synchronization between each MIDI files. Or build a special MIDI player that splits all tracks into threaded MIDI players. But that might be hard to develop.
Avatar
... and what about other MIDI messages? Like preset change wich apply on a specific channel but for all tracks?
14:24
Perhaps, a good approach will be to split by channel (max 16).
14:25
and have a threaded MIDI sequencer for each channel with its own BPM ... associated with the same synth. Of course, the MIDI file has to be created with all these restrictions in mind. (edited)
Avatar
Hi! How do I change the drum instrument for the MidiFilePlayer? I see a property called Drum Preset Change, but instead of setting 808 drums for example, it sets like a guitar or a normal instrument:
19:40
I can change the drums for the MidiStreamPlayer without problems with this:
Avatar
Hello, try to check :
21:00
Have you a recent MPTK version?
Avatar
Avatar
Thierry
Hello, try to check :
Yeah, I check that box, but when I do, it changes the instrument to one that does not belong to drums but to a normal instrument instead. I have version 2.11.2 (Latest one) (edited)
21:53
21:54
It does a PatchChange on channel 9 (drums), but instead of setting the proper drum instrument for index 24, it sets the one for normal instruments (Nylon guitar)
Avatar
Strange. Could you send me your MIDI? In private if you prefer. I will have a look tomorrow (10:25 PM for me)
Avatar
Sure. Also, I constructed the MIDI file with MidiFileWriter, and this is how I save the drum preset change:
Avatar
Ok, I'm able to reproduce the issue. Let me finding a solution. I will inform you.
Avatar
A quick workaround:
21:39
21:39
21:40
comment line channel.ForcedBank = -1;
Avatar
Avatar
fcarrasc
Sure. Also, I constructed the MIDI file with MidiFileWriter, and this is how I save the drum preset change:
I will propose a better correction with the next version.
Avatar
Looks like that works, but does commenting that not mess up anything else? Thanks a lot for the help!!
Avatar
No problem, if you are not using the ForcedBank feature, quite a stupid feature from a stupid dev (me!)
21:53
The correction is too complex to make a quick patch and I need serious testing. (edited)
Avatar
Sounds good, ill do the quick fix since I dont use the forced bank feature. Again, thanks a lot! This was extremely helpful.
Avatar
You're welcome
Avatar
Hello, someone for help?
Hello! I'm Varun, a VR Developer. Is anyone working with Maestro - Midi Player Tool Kit for Stand-Alone VR?
https://discord.com/channels/837590830423736331/869831722135588924/1243532007250595933
(edited)
Avatar
DogeAnimator75 27/05/2024 18:30
@Thierry quick question, are you able to play a midi in a script using the midi's index number instead of using the name of the midi?
Avatar
Avatar
DogeAnimator75
@Thierry quick question, are you able to play a midi in a script using the midi's index number instead of using the name of the midi?
Documentation application programm interface for MIDI player tool kit
Avatar
DogeAnimator75 27/05/2024 19:17
okay thanks
19:17
and this one with the pro version
Avatar
DarkSky42 29/05/2024 09:43
Hi @Thierry I'm having a small problem. The package has been installed and I'm able to get it to work on Android (VR) without problems. However, I cant seem to play any other audio sources. Any idea about this? I tested it in 2 projects, and as i Mentioned earlier, no issues with the MIDI implementation itself.
09:44
When i add an external audiosource in Any other scene, I cant get to play it. or rather, it plays, but the Output is not heard
09:45
Really appreciate it if you could provide some pointers. Thanks!
Avatar
Avatar
DarkSky42
Hi @Thierry I'm having a small problem. The package has been installed and I'm able to get it to work on Android (VR) without problems. However, I cant seem to play any other audio sources. Any idea about this? I tested it in 2 projects, and as i Mentioned earlier, no issues with the MIDI implementation itself.
OK, I will have a look. Are you using other component?
Avatar
DarkSky42 29/05/2024 11:05
I just added another AudioSource in the scene, and tried to play it
Avatar
Avatar
Thierry
OK, I will have a look. Are you using other component?
DarkSky42 29/05/2024 11:06
Sorry I am not sure if I understood your queston 😅
12:36
For example oboe or VR package
12:36
The best would be to send me a package example in private.
Avatar
DarkSky42 29/05/2024 12:36
Ah, I havent imported oboe yet. Just Maestro, and built a simple instrument
12:36
for VR
Avatar
Avatar
Thierry
The best would be to send me a package example in private.
DarkSky42 29/05/2024 12:37
I think we can do that, Yes!
👍🏻 1
Avatar
Avatar
DarkSky42
I think we can do that, Yes!
DarkSky42 29/05/2024 12:39
DM'd you!
Avatar
Senne (Little Chicken Game Co) 30/05/2024 14:30
Hi! I'm currently researching a solution for generative music and your package seems quite awesome. Can you tell me if it's compatible with Nintendo Switch?
Avatar
Hello, Never tested,sorry. There are too much plate-forme with unity to test all. But you could check quickly with the free version. The euclidean rythme demo will be perfect.
Avatar
Hello! I'm trying to get the BPM from a midi file that is loaded from the local storage. The midi file in question is 78 BPM. When running the code I always get 120 BPM. The midi file was created with Ableton live 11/12. Any idea what I'm doing wrong here?
718 bytes
Avatar
Avatar
Artibex
Hello! I'm trying to get the BPM from a midi file that is loaded from the local storage. The midi file in question is 78 BPM. When running the code I always get 120 BPM. The midi file was created with Ableton live 11/12. Any idea what I'm doing wrong here?
Easy to answer with MPTK 😁 Because there is no tempo change, so the default tempo is applied (120). Look at your MIDI with "MIDI File Setup": (edited)
17:55
Another point perhaps. If you want playing drums, use the channel 9 (starting from 0, can be 10 in other DAW whcih start counting channel from 1) (edited)
Avatar
Avatar
Thierry
Easy to answer with MPTK 😁 Because there is no tempo change, so the default tempo is applied (120). Look at your MIDI with "MIDI File Setup": (edited)
My setup is a little bit different then a usual rhythm game. I have a folder that contains all files (drums, synths as .wav files) and seperate .midi files just for getting the rhythm events into the game. It looks like I need to store the BPM seperate to comply with the issue from ableton but in the long run it's possibly easier to get songs loaded into the game I hope. I build a dynamic soundtrack out of all the .wav files playing and I only need the rhythm events from MPTK and not all the other stuff like soundfonts and instruments etc.
👍🏻 1
Avatar
Hello World 07/07/2024 07:03
Hey guys, I just want to make sure of one thing before buying this package. Is it possible for me to send MIDI to Ableton via this asset to control the slider in Ableton?
Avatar
Hi, MPTK is able to sent Midi sequence to MIDI port available on your device (MacOS and Windows). Ableton is able to read Midi sequence from MIDI port. https://www.sweetwater.com/sweetcare/articles/connect-midi-keyboard-ableton-live/
❤️ 1
08:36
Not tested, but why not ...
Avatar
How can I load a midi at runtime that is in a resource folder inside the assets folder?
Avatar
Hello, You can load and play MIDI file from the device or from a web site with the MifiExternalPlayer prefab. https://paxstellar.fr/midi-external-player-v2/ (edited)
22:15
But don't forget that files in the asset folder are not deployed in a build (reason to have a MIDI DB). They are only available with the Unity editor. (edited)
Avatar
Yes, that makes sense. I'm actually going to be using the unity cloud services for my game, and loading content through there will mean I can not use the MIDI DB. I've been trying to load a midi as a Unity Adressable but so far no luck.
22:21
I was also going to try the StreamingAssets folder, but it appears Unity suggests not using that anymore.
22:21
So, time to learn about addressables I guess, and figure out if I can use the MidiExternalPlay with it?
Avatar
I have no skill with unity cloud. Perhaps there is a service to download a file to temp folder on the device ?
22:23
Sorry, I need to leave.
Avatar
I asked to Copilot if there is some solutions to download from a Unity Cloud Services ... answer is clear: No !
08:03
You will have to manage your own web server (for low volume as MIDI, there are free solutions) for hosting your MIDI files. Then using MidiExternalPlayer for downloading and playing MIDI. (edited)
08:06
Sorry, I'm on a trip with low capabilities for testing 😉
Avatar
Hi, can Maestry supports other audio formats also, just like mp3, wav, ogg or others
Avatar
Avatar
mmar58
Hi, can Maestry supports other audio formats also, just like mp3, wav, ogg or others
Hello, thanks for your interest for Maestro MPTK. MPTK is fully oriented MIDI and SoundFont for playing music. But not able to play directly a MP3, ogg or wav samples as a music. It's quite straightforward with Unity 😉 The advantage of MIDI is an incredible interaction with your game play, and why not, generate your music by algo which is not possible with samples whatever the format. (edited)
Avatar
DarkSky42 08/08/2024 11:51
Hello! how would i implement the MIDI loop functionality with the MIDI External Player?
11:53
from what i see, the MIDILoad function does not apply to the MIDI External Player... How would i go about setting the Looping mode if i am working with the MIDI External Player?
11:56
11:56
Hi @Thierry here's the script. Ive literally just spun it off the MidiLoop script
Avatar
Hello, ok I will soon have a look
Avatar
Not tested, but if you set the midiExternalPlayer.MPTK_InnerLoop attributes (Enabled, Start, ...) before loading your external MIDI file that will works like for the midiFilePlayer. Look at the demo Demo\FreeDemos\Script\TestMidiFilePlayerScripting.cs for OnGUI_InnerLoop() that will noramlly works also with external.
21:15
I will check tomorrow with the demo Demo\ProDemos\Script\TestMidiExternalPlayer.cs. In Play() just before midiExternalPlayer.MPTK_Play() to set the innetloop attribute.
Avatar
Finally I found some energy to test ... and this is not the solution. I will digger further tomorrow. (edited)
Avatar
Avatar
Thierry
Finally I found some energy to test ... and this is not the solution. I will digger further tomorrow. (edited)
DarkSky42 08/08/2024 21:43
Thank you so much! Will wait for your response!
Avatar
My curiosity was stronger than my tiredness 😉 I found a solution: just set the InnerLoop attributes with the OnEventStartPlayMidi event. (edited)
21:57
private void Start() { .... midiExternalPlayer.OnEventStartPlayMidi.AddListener(StartPlay); .... } public void StartPlay(string midiname) { Debug.Log("Start Midi " + midiname + " Duration: " + midiExternalPlayer.MPTK_Duration.TotalSeconds + " seconds"); midiExternalPlayer.MPTK_InnerLoop.Enabled = true; midiExternalPlayer.MPTK_InnerLoop.Start = 10000; midiExternalPlayer.MPTK_InnerLoop.Resume = 10000; midiExternalPlayer.MPTK_InnerLoop.End = 10200; midiExternalPlayer.MPTK_InnerLoop.Log = true; // midiExternalPlayer.MPTK_Speed = 1f; // midiExternalPlayer.MPTK_Transpose = 0; } (edited)
Avatar
DarkSky42 09/08/2024 12:58
Hi @Thierry Thank you for the help! I will try this out. Should i replace the existing TestMidiExternalPlayer with this script and try?
Avatar
Avatar
DarkSky42
Hi @Thierry Thank you for the help! I will try this out. Should i replace the existing TestMidiExternalPlayer with this script and try?
Yes, you can!
Avatar
or the test inner loop. Works the same with a external MIDI player
Avatar
DarkSky42 10/08/2024 08:57
Hi @Thierry Thank you! That solution worked wonderfully!
Avatar
DarkSky42 10/08/2024 11:24
I have another question. When i programatically set the channel and sound bank, it seems to have no effect on the MIDI. I am specifically trying to get the drums to play, but when i set the channel = 9 and the sound bank to the one that contains the drums, there is no output. Am i doing something wrong? PS: Also tried MPTK_EnableDrumPreset
Avatar
Avatar
DarkSky42
I have another question. When i programatically set the channel and sound bank, it seems to have no effect on the MIDI. I am specifically trying to get the drums to play, but when i set the channel = 9 and the sound bank to the one that contains the drums, there is no output. Am i doing something wrong? PS: Also tried MPTK_EnableDrumPreset
DarkSky42 10/08/2024 14:44
I went through some previous chats and seemed to find a solution. Thanks!
👍🏻 1
Avatar
DarkSky42 13/08/2024 10:55
Hi @Thierry, How can i convert a Bar to Tick position with a MidiExternalPlayer?
10:56
MPTK_MidiLoaded.MPTK_NumberBeatsMeasure is null with MidiExternalPlayer
10:58
I am trying to set the Start Tick, Resume and End Tick for the MidiExternalPlayer Innerloop
Avatar
DarkSky42 13/08/2024 15:08
Also, is the start bar counted from 0 or 1?
Avatar
Avatar
DarkSky42
Also, is the start bar counted from 0 or 1?
Hello, Ok, I will look asap
Avatar
Avatar
DarkSky42
Also, is the start bar counted from 0 or 1?
MidiExternalPlayer is also a MidiFIlePlayer by heritage. So all properties available in MidiFIlePlayer are also available with MidiExternalPlayer . Example in Assets\MidiPlayer\Demo\ProDemos\Script\TestMidiExternalPlayer.cs, method update add this log: // Display current measure and beat value of the last MIDI event read by the MIDI sequencer. Debug.Log($"MPTK_NumberBeatsMeasure: {midiExternalPlayer.midiLoaded.MPTK_NumberBeatsMeasure} MPTK_CurrentMeasure: {midiExternalPlayer.MPTK_MidiLoaded.MPTK_CurrentMeasure}.{midiExternalPlayer.MPTK_MidiLoaded.MPTK_CurrentBeat} - Last measure: {midiExternalPlayer.MPTK_MidiLoaded.MPTK_MeasureLastNote}");
20:57
20:58
Warning; midiExternalPlayer.midiLoaded will be null until a mIDI is loaded, so check with if (midiExternalPlayer.midiLoaded != null) before
20:59
Or use the same solution for inner loop: midiExternalPlayer.OnEventStartPlayMidi.AddListener(StartPlay);
Avatar
To convert measure to tick, use: Tick = MPTKSignature.MeasureToTick(midiExternalPlayer.MPTK_MidiLoaded.MPTK_SignMap, Measure);
21:10
the full example: // Display current measure and beat value if (midiExternalPlayer.midiLoaded != null) { Debug.Log($"MPTK_NumberBeatsMeasure: {midiExternalPlayer.midiLoaded.MPTK_NumberBeatsMeasure} MPTK_CurrentMeasure: {midiExternalPlayer.MPTK_MidiLoaded.MPTK_CurrentMeasure}.{midiExternalPlayer.MPTK_MidiLoaded.MPTK_CurrentBeat}"); // Calculate tick position of a measure (just for a demo how to calculate tick from bar). // So, it's easy to create loop based on measure. Debug.Log($"Tick for the current measure: {MPTKSignature.MeasureToTick(midiExternalPlayer.MPTK_MidiLoaded.MPTK_SignMap, midiExternalPlayer.MPTK_MidiLoaded.MPTK_CurrentMeasure)}"); }
Avatar
just_time 17/08/2024 12:55
Hi! Previously, I was using the bass_midi library. Does your asset work in the background on mobile(when the application is minimized)? And if not, is it possible to change the midi engine (the one you have on bass_midi) for midi?
Avatar
Avatar
just_time
Hi! Previously, I was using the bass_midi library. Does your asset work in the background on mobile(when the application is minimized)? And if not, is it possible to change the midi engine (the one you have on bass_midi) for midi?
Hello, what do you mean with midi engine ? MPTK is using fluidsynth to generate sound from MIDI event (edited)
Avatar
Avatar
Thierry
Hello, what do you mean with midi engine ? MPTK is using fluidsynth to generate sound from MIDI event (edited)
just_time 17/08/2024 18:14
Yeah. That's it. So what about working in the background?
Avatar
Avatar
just_time
Yeah. That's it. So what about working in the background?
Sadly, no. This option is not working with Android. A dedicated Java service must be writed and I 'm not sure that will be compliant with the Unity audiosource. (edited)
👍 1
Avatar
Intelligent search from Bing makes it easier to quickly find what you’re looking for and rewards you.
Avatar
Avatar
DarkSky42
Hi @Thierry, How can i convert a Bar to Tick position with a MidiExternalPlayer?
Hello, I updated the page regarding MidiExternalPlay. I hope that will be more clear, have your say! To be done: how calculating tick from bar. https://paxstellar.fr/midi-external-player-v2/ (edited)
Avatar
Avatar
Thierry
Hello, I updated the page regarding MidiExternalPlay. I hope that will be more clear, have your say! To be done: how calculating tick from bar. https://paxstellar.fr/midi-external-player-v2/ (edited)
DarkSky42 18/08/2024 12:10
Thank you! Really appreciate it!
Avatar
DarkSky42 23/08/2024 10:07
Hi @Thierry, what is the correct way to change the tempo of the playback/midiWrite? is there a Master Tempo setting? I didnt seem to find anything in the documentation
Avatar
Can anyone confirm if it is possible to use an external MIDI keyboard with the Unity Editor running the MPTK MIDI editor? I know there are website instructions to install a Unity MIDI plugin to use w/ builds using MPTK, but I couldn't find out if I install that plugin, if the built-in MIDI editor will let me create files w/ my external keyboard. Thank you! (I have the pro version of your plugin) (edited)
Avatar
Avatar
DarkSky42
Hi @Thierry, what is the correct way to change the tempo of the playback/midiWrite? is there a Master Tempo setting? I didnt seem to find anything in the documentation
Documentation application programm interface for MIDI player tool kit
21:48
Clearly the code example in the page is not very useful 😉 I will change this soon. Have a look to the demo "MiIDI File Writer", source file Assets\MidiPlayer\Demo\ProDemos\Script\TestMidiGenerator.cs For example here: /// <summary>@brief /// Play 3x4 quarters with a tempo change. /// </summary> /// <returns></returns> private MPTKWriter CreateMidiStream_tempochange() { MPTKWriter mfw = new MPTKWriter(deltaTicksPerQuarterNote: 500); mfw.AddBPMChange(1, 0 * mfw.DeltaTicksPerQuarterNote, 60); mfw.AddNote(1, 0 * mfw.DeltaTicksPerQuarterNote, 0, 60, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 1 * mfw.DeltaTicksPerQuarterNote, 0, 61, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 2 * mfw.DeltaTicksPerQuarterNote, 0, 62, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 3 * mfw.DeltaTicksPerQuarterNote, 0, 63, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddBPMChange(1, 4 * mfw.DeltaTicksPerQuarterNote, 120); mfw.AddNote(1, 4 * mfw.DeltaTicksPerQuarterNote, 0, 60, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 5 * mfw.DeltaTicksPerQuarterNote, 0, 61, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 6 * mfw.DeltaTicksPerQuarterNote, 0, 62, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 7 * mfw.DeltaTicksPerQuarterNote, 0, 63, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddBPMChange(1, 8 * mfw.DeltaTicksPerQuarterNote, 240); mfw.AddNote(1, 8 * mfw.DeltaTicksPerQuarterNote, 0, 60, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 9 * mfw.DeltaTicksPerQuarterNote, 0, 61, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 10 * mfw.DeltaTicksPerQuarterNote, 0, 62, 60, mfw.DeltaTicksPerQuarterNote); mfw.AddNote(1, 11 * mfw.DeltaTicksPerQuarterNote, 0, 63, 60, mfw.DeltaTicksPerQuarterNote); return mfw; }
21:50
If no tempo change is defined in the MIDI, the default tempo is 120 BPM
Avatar
Avatar
Dave E
Can anyone confirm if it is possible to use an external MIDI keyboard with the Unity Editor running the MPTK MIDI editor? I know there are website instructions to install a Unity MIDI plugin to use w/ builds using MPTK, but I couldn't find out if I install that plugin, if the built-in MIDI editor will let me create files w/ my external keyboard. Thank you! (I have the pro version of your plugin) (edited)
Hello Dave. I can confirm. Look at these demos (menu Maestro) with the Pro version: (edited)
21:53
Look also here for setup the plugins: https://paxstellar.fr/class-midikeyboard/
21:55
Warning: yes, that's works well also in the Unity Editor. But Unity Editor is quite sensible when loading DLL or Mac module because the editor is not able to unload DLL. That can causes crash in some cases. Save your project before testing! No issue when using the plugins with a build. (edited)
👍 1
Avatar
Thanks for confirming!
Avatar
I'm not sure to answer to all your question: if the built-in MIDI editor will let me create files w/ my external keyboard
(edited)
22:37
the built-in MIDI editor: the Maestro MIDI editor available from the Unity Editor?
Avatar
Yes
22:40
I’ve been having trouble finding a way to compose my own MIDI files in a DAW that is GeneralUser SoundFont and MIDI format v0 compatible. I am normally an Ableton Live user but they can’t really work well with exporting correctly or even with importing the SoundFonts from General User. I was then trying to use the Maestro editor, and if that doesn’t work with a MIDI keyboard was going to try and find other software to make Maestro compatible midi files. Not sure if you have any recommendations. (edited)
Avatar
Sadly, no. The Maestro MIDI editor is not able to works like a DAW which is a dedicated tool for creating music.
22:42
Unity latency is too low
👍 1
Avatar
No problem. Worse case I can draw in the grid. But is there a midi daw you know of that can play nice with general user sound fonts and the midi format Maestro expects?
Avatar
A DAW can't be used to export SoundFont. With a DAW you can export a MIDI file which is a standard format that Maestro is able to read.
👍 1
22:44
Then with Maestro you can choose the soundfont you want .... with the Pro.
👍 1
Avatar
Avatar
Thierry
A DAW can't be used to export SoundFont. With a DAW you can export a MIDI file which is a standard format that Maestro is able to read.
Thanks, I meant so I can compose in some daw/editor with the same 1:1 sound font name I’ll be using in Maestro after I export. I understand I can’t export sound fonts but that’s fine. I am just trying to understand what tools may exist so I can make my content here with a keyboard and multi channels and have it then export and line up 1:1 once imported into Maestro / Unity. Like, I noticed all those free midi files from some of your reference links import great into Meastro and seem to pick good GeneralUser sound fonts. Like even that Bladerunner theme imported pretty good 😆 I just am having no luck knowing how to get my pipeline working to make my own files in a reasonable way. (edited)
Avatar
tomorrow, I'm going to ask a musician friend of mine
👍 1
Avatar
(Sadly I only know Ableton Live really well but from everything I’ve been googling it just messes up the midi exports horribly and doesn’t support sound fonts anymore
Avatar
what app he uses
Avatar
Thanks
Avatar
See you later
👍 1
Avatar
Any luck from your musician friend? I'll keep searching on my own today as well.
Avatar
06:26
Works well: input MIDI from my keyboard, export as MIDI file, import in Maestro in a nutshell 🙂 (edited)
Avatar
But at first sight, no support for SoundFont.
👍 1
Avatar
OK, thanks for looking into it a bit!
Avatar
Avatar
Dave E
OK, thanks for looking into it a bit!
My friend is using Cubase. He is confirming also, DAWs are able, in general, to playing music from soundfont but not to export with the MIDI. Soundfonts are complex structure not compliant to export in a MIDI. (edited)
Avatar
Thanks for the info! Unfortunately my DAW of choice (Ableton Live 11) does not make using SoundFonts very possible and it's midi exporting is limited to v0 MIDI format unfortunately. I wonder what people used to create all those free MIDI files your site linked to. They all map so nicely to the Maestro/GeneralUser soundfont bank presets as well.
20:32
So, your friend who uses Cubase, does he just compose and export to MIDI and then somehow re-assign the soundfonts when he imports into Maestro?
20:32
I may just have a misunderstanding on workflow perhaps
Avatar
In general, he is using samples directly available from DAWs. I checked, Aria Maestosa export MIDI with the v1 format. It's not possible to change the samples but they are based on General User soundfont.
Avatar
I will check that out, thanks!
22:23
>In general, he is using samples directly available from DAWs. So, he is then importing those samples into Maestro afterwards? As SoundFonts?
Avatar
FalconEagle 27/08/2024 05:58
What versions of Soundfonts is best to use in MPTK? Soundfont 2 or 3? Also is there a tutorial on how to create soundfonts from Ableton? (edited)
Avatar
Avatar
Dave E
>In general, he is using samples directly available from DAWs. So, he is then importing those samples into Maestro afterwards? As SoundFonts?
My friend is a musicien, not a developper on Unity 🙂
Avatar
Avatar
FalconEagle
What versions of Soundfonts is best to use in MPTK? Soundfont 2 or 3? Also is there a tutorial on how to create soundfonts from Ableton? (edited)
SF3 is just SF2 with vorbis compression. But Unity compresses samples to vorbis when importing SF, so SF3s are not useful for MPTK ... and are not that common.
Avatar
I created a forum by topic. @FalconEagle i moved your question on this forum.
Avatar
The bigger your community grows, the harder it becomes to keep track of all the ongoing discussions. Forum Channels keep everyone heard. Learn more.
Avatar
Avatar
Thierry
My friend is a musicien, not a developper on Unity 🙂
Ah, ok! Thanks. That Aria Maestosa seems to be doing the trick well enough for now and I can compose there, copy/paste items, build the MIDI files and Maestro seems to read them in perfectly and set to the correct General User sample bank as well. Thanks for finding that! (edited)
👍🏻 1
Avatar
DarkSky42 30/08/2024 12:19
Hi @Thierry, is there a callback or event to check if the MidiStreamPlayer.MPTK_Channels have loaded? I am currently doing it from update, trying to set a default preset on my instrument. the preset change works, but the PresetName takes a while to update. is there a workaround/correct way to do this?
12:21
my main issue is that during the start of the script, I want the PresetName to reflect on the UI after i have called PatchChange. everything works fine when i switch presets from the UI, since everything has loaded at that point
Avatar
DarkSky42 30/08/2024 13:19
Update: I used WaitForEndOfFrame() and managed to make the preset name reflect correctly.
Avatar
Avatar
DarkSky42
Update: I used WaitForEndOfFrame() and managed to make the preset name reflect correctly.
Hello, strange thing. I will look.
14:53
Are you using MidiPlayerGlobal.MPTK_PresetName(CurrentPatch); ?
14:55
MPTK_PresetName is just a simple method which return the preset name from the list of preset: MidiPlayerGlobal.MPTK_ListPreset
14:58
So, not related to "loading" MPTK_Channels ... there is no loading when preset is changed (load is done only at the MPTK start ... or if you change Soundfont ). Just the internal MIDI Synth is informed of the preset to use for the channel of the note.
Avatar
Also, don't miss the new demo for MidiPlayerExternal
Avatar
Daniel Lindenberger 30/08/2024 21:50
Hi @Thierry , I'm using the latest MPTK_Pro, trying to follow the instructions on writing to file, but get: 'MPTKWriter' does not contain a definition for 'MPTK_WriteToFile' ImportFromEventsList() works fine, so the class seems instantiated, but can't write. This is on Unity 2022.2.19 PC
Avatar
Hello @Daniel Lindenberger My bad, I forgot update the site paxstellar example. Look here for the API doc. https://mptkapi.paxstellar.com/db/df6/class_midi_player_t_k_1_1_m_p_t_k_writer.html
Documentation application programm interface for MIDI player tool kit
09:37
Documentation application programm interface for MIDI player tool kit
09:38
I'm in travel with no equipment, I will update the site soon.
Avatar
Daniel Lindenberger 31/08/2024 17:39
Brilliant, thanks!
Avatar
Avatar
Thierry
So, not related to "loading" MPTK_Channels ... there is no loading when preset is changed (load is done only at the MPTK start ... or if you change Soundfont ). Just the internal MIDI Synth is informed of the preset to use for the channel of the note.
DarkSky42 31/08/2024 18:03
Thanks @Thierry! Once again, really appreciate the constant support
Avatar
Avatar
Thierry
MPTK_PresetName is just a simple method which return the preset name from the list of preset: MidiPlayerGlobal.MPTK_ListPreset
DarkSky42 31/08/2024 18:08
No, I was actually setting the preset directly with a MPTK Play event and then Reading the PresetName from MPTK_Channels[streamChannel].PresetName
👍🏻 1
18:09
That's probably not the best way to do it, is it?
18:10
private void PatchChange(int patch) { LastTimeActivity = Time.realtimeSinceStartup; SeqTimeUpdate = true; // Play the change directly midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent { Command = MPTKCommand.PatchChange, Value = patch, Channel = StreamChannel }); // Add midi event "Preset Change" to the midifilewriter object long tickFromTime = midiFileWriter.ConvertMilliToTick(CurrentTimeMs); //midiFileWriter.AddChannelAfterTouch(trackNo, tickFromTime, StreamChannel, patch); midiFileWriter.AddChangePreset(trackNo, tickFromTime, StreamChannel, patch); }
18:11
after calling this, I would do this to update the UI: if (presetNameText) presetNameText.text = midiStreamPlayer.MPTK_Channels[StreamChannel].PresetName;
Avatar
DarkSky42 31/08/2024 18:19
but in order to access the midiStreamPlayer.MPTK_Channels[StreamChannel].PresetName, i have to wait a frame after the PatchChange function is called (In the beginning of the Script only).
18:20
Also, I have to do this in Update(): //Wait till the MPTK_Channels has initialised, //and apply the default patch number added in from the inspector if(midiStreamPlayer.MPTK_Channels.Length>0) { if (!defaultPatchSet) { StartCoroutine(ChangePatch(defaultPatchNumber)); defaultPatchSet = true; Debug.Log("Default patch has been set"); } }
18:20
sorry for the spam lol
Avatar
No problem, I will look deeper tomorrow afternoon. Quite hard just with a phone 😁
👍 1
Avatar
GinRumAndWhiskey 31/08/2024 23:14
HI! I have a short question regarding Free/Pro - I was able to use the free version and play a midi after just a few seconds, good documentation. If I want to play only a subset of a midi - e.g. only the next "Tick" or only a specific Track, I have to go with the pro Version, right?
Avatar
Avatar
GinRumAndWhiskey
HI! I have a short question regarding Free/Pro - I was able to use the free version and play a midi after just a few seconds, good documentation. If I want to play only a subset of a midi - e.g. only the next "Tick" or only a specific Track, I have to go with the pro Version, right?
Hello, to filter playing specific MIDI events, for example by track, you will need the OnMidiEvent
09:38
Which is part of the pro
09:40
There is no feature like play only next tick on the shelve. I need to search how doing properly this need.
Avatar
Avatar
DarkSky42
private void PatchChange(int patch) { LastTimeActivity = Time.realtimeSinceStartup; SeqTimeUpdate = true; // Play the change directly midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent { Command = MPTKCommand.PatchChange, Value = patch, Channel = StreamChannel }); // Add midi event "Preset Change" to the midifilewriter object long tickFromTime = midiFileWriter.ConvertMilliToTick(CurrentTimeMs); //midiFileWriter.AddChannelAfterTouch(trackNo, tickFromTime, StreamChannel, patch); midiFileWriter.AddChangePreset(trackNo, tickFromTime, StreamChannel, patch); }
Yes, it's the good approach to change the current preset with the stream MIDI prefab.
18:04
In fact, there is two possibilities, like you can see in Assets\MidiPlayer\Demo\FreeDemos\Script\TestMidiStream.cs case "PATCH_INST": CurrentPreset = index; if (Test_MPTK_ChannelPresetChange) midiStreamPlayer.MPTK_Channels[StreamChannel].PresetNum = index; else midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent() { Command = MPTKCommand.PatchChange, Value = index, Channel = StreamChannel, }); Debug.Log($"Instrument Preset change - channel:{StreamChannel} bank:{midiStreamPlayer.MPTK_Channels[StreamChannel].BankNum} preset:{midiStreamPlayer.MPTK_Channels[StreamChannel].PresetNum}"); (edited)
Avatar
Avatar
DarkSky42
after calling this, I would do this to update the UI: if (presetNameText) presetNameText.text = midiStreamPlayer.MPTK_Channels[StreamChannel].PresetName;
When you want get the present name from: midiStreamPlayer.MPTK_Channels[StreamChannel].PresetName; a delay could occurs until the MIDI event Command = MPTKCommand.PatchChange is effectively run by the MIDI synth which is running in another thread
18:10
Try with this global method to get the preset name: MidiPlayerGlobal.MPTK_PresetName(CurrentPreset);
Exported 1 120 message(s)
Timezone: UTC+1