Midi Player?
-
I'll write a proper documentation for the MIDI Player ecosystem when I merge it back to the master branch, it's not 100% finalised yet.
This opens a can of new possibilities, you can embed MIDI files, play them back, modify them using scripting calls, you can even build your own piano roll from a script panel.
-
@Christoph-Hart can't wait .
Thanks
-
@Christoph-Hart said in Midi Player?:
I'll write a proper documentation for the MIDI Player ecosystem when I merge it back to the master branch, it's not 100% finalised yet.
This opens a can of new possibilities, you can embed MIDI files, play them back, modify them using scripting calls, you can even build your own piano roll from a script panel.
Excited to see how this works =)
-
Excited for this too
-
Nothing Yet even in the new version (2.1.0) of HISE? @Christoph-Hart ???
-
Sure it's there.
-
@Christoph-Hart but it only play 1 bar, and the example you said you'll do?
-
@Christoph-Hart said in Midi Player?:
I'll write a proper documentation for the MIDI Player ecosystem when I merge it back to the master branch, it's not 100% finalised yet.
This opens a can of new possibilities, you can embed MIDI files, play them back, modify them using scripting calls, you can even build your own piano roll from a script panel.This?
-
@Christoph-Hart any chance you can throw together some quick notes on this function? I ready to use this in my next project.
-
@dustbro Following
-
@Dominik-Mayer is closing in on the new documentation system and I‘ll make sure it contains a few words about the Midi Player.
-
@Christoph-Hart yes!
-
@Christoph-Hart Is there a way to add multiple events to a track? I'd love to see a snip on how you would paint a timeline as well
-
@dustbro said in Midi Player?:
Is there a way to add multiple events to a track? I'
Yes, but I realise there is one puzzle piece missing.
- Create a list of
MessageHolders
which contain the MIDI messages - Set the MIDI properties for each message
- Call
flush()
to pass it to the MIDI player.
But you can't set the Type for the
MessageHolder
object (it was initially created to hold a reference to actual MIDI input so there was no need to change its type, but now we needMessageHolder.setType(MessageHolder.NoteOn);
What do you mean with timeline? Any graphic representation grabs the rectangle list from the MIDI player, then applies some transformations and displays the information in some way, so if you can show me an example I can check how to realise it.
- Create a list of
-
@Christoph-Hart I'm trying to incorporate this into a drum sampler...
So file browser to drag n drop midi into a player, and an associated midi track to arrange parts. -
Alright, a snippet how to use the MIDI API to create notes programatically is available here:
https://docs.hise.audio/tutorials/recipes/event-processing/create-midi-sequence.html
Now the other thing you want to achieve is a little bit more complex, as it would require to divide the notes into multiple "clips", which is not supported ATM (and chances are tiny that it will be added in the future since it requires a full rework of how the MIDI files are handled).
-
@Christoph-Hart said in Midi Player?:
it would require to divide the notes into multiple "clips"
I'm thumbing thru the MidiPlayer API and found:
getNoteRectangleList(var targetBounds) This converts the MIDI data in the current sequence to a list of rectangles for each note scaled to fill the rectangle supplied as argument.
The description says
The most simple application of this is to draw a piano-roll content into a Panel.
@Christoph-Hart Can you use a panel as a "clip" with this? I'm checking out the example code, but unsure how to properly populate "note". @Dominik-Mayer any insight on this?
for(note in list) { // `note` is a array with 4 numbers and can be passed // into all Graphic API functions pretty conveniently. g.fillRect(note); }
I'm also seeing
setRepaintOnPositionChange(var shouldRepaintPanel) If true, the panel will get a repaint() call whenever the playback position changes.
description:
By default this is off, but if you need your connected Panel to repaint during playback (eg. to display a ruler that indicates the position), set this to true and it repaint() will be called periodically during playback
would this Ruler be similar to the timeline ruler in the pic above?
-
Making a ruler and showing the contents of a clip is the smallest problem (in fact these are trivial to achieve with the API calls you listed above).
The problem which you won't be able to overcome is to combine multiple MIDI files into a timeline, and drag them around as entity.
I've modified the example from the docs to use a panel to display the position and content of the MIDI file which should get you started on the basics:
HiseSnippet 2049.3oc4Y8+aabaE+NaeE0JyEoaEC6GIBFvNuncQxeIN.EEwxx1wZI1VUxMMnEEAz2wSGStiTkGkc0Jx9ab+oj+C1dOxS5NYq5ooktgto3.K936Q995mGIcWkLjkmKUNtqew3gLG2ekW+wBcR6DJW3z4PG2Ow6TZtloHVRGLdHMOmE435t5yPBtquli4y6e5AzTpHjURxw4kRdH6E7LttjZ28eNOM8XZD6BdVEt2Y+NgRQaYpbDnOq50vYHM7szArynHaq3439QGEw0RUeMUyxcbW6.Yz39IxqEV9eIOmeYJCGzzoOrPVxGKSiPMFo5zNgmF0chcm63350szKrp0K7Ydmxi3SoW5MtuYBRoDU8GtqbWpWy+4pWi4odqVQ89nIAIi5kRGyTSBRcNrC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8ArzPVwCUkiM5WAwCsiafisfohHyf+N7oXxl3X2hIaNYx+irGYzPk70g1yTg4xergBX2Bya7tt2o3XRSGyIGA47fi65jAHhuNLDc2+Iv+LeY1ZIjY6kPlcVBY1cIj4wKgL6sDx7j6TFrYTqQZYlsTDHz8H6eM.2o+AIbW04evx051q
-
@Christoph-Hart Thanks for the update!
I'm doing a little tinkering but can't quite wrap my head around it's functionality.
I've added a play + stop button to your example (using the property editor), but get unexpected results. Pressing play will only play 1 random note, and when I hit stop, the midi player switches to an empty sequence.
What's the proper way to to add controls to the player?HiseSnippet 2167.3oc4Y8+aaabEmz1LqVcNHcqXX+3gfAL5EOFI+k3.TTDKK+MsDaqJ4lFzhtryjGkXB4crGOYEsh.r+M1+I6Oi8mR9OX68tijhxVwUUsaCqU1Fh26du6806y634NRgOKKSHsrW8hwoLK6eoSuwb0fVCnQbq1GXYeWmSoYJljXHs+3TZVFKvx1d4iQB1qthk9y6dx9zXJ2mMgjk0yEQ9rmEkDolPsydOMJN9HZ.6hnjJbu8ds8E7VhXwPvdV1otUJ0+0z9rynHaK4XYemCChTBYOEUwxrrWYeQv3dCDi3F9edTVzkwLbPCqdvBYHejHN.sXjpUqAQwAcJ76LKKamNShBKahBeryoQAQkzmDMtmdBxDIpFOrW51LuFe2lW8YYdKWw7tSQRRadwzwLYQRp8AsIFJMlxnZMTJYbUO12LjMUx4cOIepKjPXtJ8mIDoGxofoFTkr8xS6dKOet2McIKz5OJJlgtmcw.fazUfz7ATE0xNy4wa5wu3QO8ws51scaOuS+rC+xW0zyy6EddM853kD0s2Es27KAJdi87d0t6tYeulmbNL7UOX2MCCatk94lONILz6Ec7Ng+m5b1ek0Z+iBa0LLrQy1cef+Ic7Fbfm2tO3oddVncLoZyFqO6E0mSUCk.MmyFlrOE7fJAkyDIQv75cP4Du2dGv3yhLFWgfmTUcGhIXOUf1pRFeESF+ib54KiRUSlAiU+5bpSpGmN2al0ZIgiCYsZgC49pHAmPCBNSnXtwQYpMH9CnbN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GCMCxIAYH3A0.HfrOk7HHBHdlOM1fHhnLoX3IiD.U17LHdj4MQlojNjwhArElFe2WGk0tDzjaD6J.EZrXHX6ulUYA5qaNqCnkw0QChT5TyDlvPOjW3.ncYnTGNv9U0qxq9g2piY4l0wR5kZGgKjITH1AtFBZdIbj7xidsV44Q.J2LG1Im+hZH20I+gqm+xMhR8FHoiz5UND.ILj66gTeFVdA5QexOrSZ8al6ycrZuE96+e.gc9wBD91PIsWJ2p.VUZ7t6li2s+PkRvsh.Xs63f4LKs8N0A+mKY6g.q4x5XqEcQflgWMr.Izx9WXz2ZEXy31Js59.GCBj0aPkcWPWiwG9GvCivRqRy+uLZuA5xiRJ+sWtGMNVL5.IsOb109fkrj0M046O9nU4etPk+cvUkzfHwwRwvTSlHsHGzN3FuDbJUBuIGzgn8jUbdUuND+lIoFwdiKGjNdue.lQu2SWw64bpHXXL9JiUusA7JVxm.p4mpyH18Cv7Tim5czm+qfn9beCIyq49QNchT9Cls8tzLrWb6x+gs27KzYMmCCCAv4IF6JNG8hE81aVLS4tFS4Cc5APr5SUnMjeidL4KvWC3XFmIwfZia4h19my6EskN2Wz14PaqqXWHobnOb1TKbOVRzEvVlrpD+7L3DXruoKlkqRukfJm4Tu6IGAN4LkoG9dG5xklIPWzotbjqekSeuuQsYdgeq7+fK76G+ca+vAGVd9L2YDAs6biKN9dPYLduDGxw6oAnf13uB51DRGFqJnNcc8oBtHcffG4WMo2kojQ86yjUs8Y5PMUpot5xOdutrXFsZA7uaO7.MTIDmXKXrnw7GKts70u0wXtDbyH4mFf5K+ySPcyag0+TJTn9Fy8B2CvR8Y42jGdXS3rNnn5w0KNnVOFOPO3eAexmrAN1NexFES9eEcjP8khW5aNzIVK+AZJfey0WB9pNmhiIMJOtoC79.VI.h3K88wv8eDhOyVlMW.Y1ZAjY6EPlcV.YdzBHytKfLO9VkAaF0bnRjX1JBD5bn4eWhc4+wF6ks92.YvWttA
-
@dustbro if you use the "create generic script reference" on the MidiPlayer
and paste it in initCallbackconst var MIDIPlay = Synth.getMidiProcessor("MIDI Player1");
you can use this code to enable disable the play function
inline function onPlayControl(component, value) { MIDIPlay.setAttribute(1, value); MIDIPlay.setAttribute(0, !value); };
Attribut 1 is Play and 0 is Stop
However you have to disconnect the "Play" btn from "Property editor"
this function above make only use of the Play btn value, but you've set the buttons in a radio group so the stopbtn will set the playbtn to value = 0