COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 04-16-2017, 08:35 AM   #1
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default Question about MIDI Processing

I am coding a MIDI only plugin that takes incoming MIDI NoteOn, NoteOff, and PitchBend messages and modifies them prior to sending them through. I have had no issues getting this working, and everything works as expected without an issue.

That being said my plugin does all MIDI processing in ProcessMidiMsg and does not utilize MidiQueue at all - there is nothing in ProcessDoubleReplacing. Based on the various example code I have come across it appears that this is not a standard methodology. My thought is that the MIDI messages are being serviced as they come in and adding a MIDI queue is overkill for my simple application.

My question is whether I will find myself seeing issues by doing all of my MIDI processing in ProcessMidiMsg, which calls out to other methods to modify the MIDI data and send it. Should I be using MidiQueue and do all of my main work in ProcessDoubleReplacing to avoid timing issues I am unaware of?
michaelwayneharwood is offline   Reply With Quote
Old 04-16-2017, 08:30 PM   #2
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

I refactored the code to use the IMidiQueue in ProcessDoubleReplacing instead of doing everything in ProcesMidiMsg just to be safe. I am brand new to coding audio plugins, so if anyone has an explanation as to why it's a best practice I would love to know.

Please be gentle on the n00b.
michaelwayneharwood is offline   Reply With Quote
Old 04-17-2017, 01:21 AM   #3
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

I have no personal experience with MIDI processing in VST, but my first guess would also be to do it entirely in ProcessMidiMsg(), providing I don't need to change any timings. I think usually MIDI is passed from the host to the plug-in from within the audio thread, very likely just before calling ProcessDoubleReplacing(), so it shouldn't matter. I do this in JSFX all the time, but of course that only runs in REAPER, so I don't know what a VST would do in other hosts.
Tale is offline   Reply With Quote
Old 04-17-2017, 08:18 AM   #4
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

Thanks for the reply Tale. Moving the MIDI processing to the MIDIQueue provides more options if I need them in the future, though I don't need to change MIDI event timing for this project.
michaelwayneharwood is offline   Reply With Quote
Old 04-17-2017, 08:37 AM   #5
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

And (assuming my own MIDI queue class from IPlug), it will (optionally) sort the MIDI stream, just in case the host doesn't do this (this could be an issue when two or more MIDI streams are combined).
Tale is offline   Reply With Quote
Old 04-17-2017, 09:03 AM   #6
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

I am using the WDL OL release currently, but have been bouncing around between yours, Oli's, and the recent updates Youlean released while I am learning the landscape.

I am solely focused on MIDI capabilities at the moment to support the plugin I am currently developing. I started in JSFX, but quickly found myself limited due to the lack of support for easy to use file support and decided to bite the bullet and move into the WDL space. The learning curve has been surprisingly small.

For those curious the plugin is geared for the Xenharmonic/Microtonal community. It allows you to "retune" a virtual instrument to alternate intervals and divisions of the octave outside of the traditional Western 12 note system using pitch bend messages. The goal is to be able to import files in the SCALA file format to accommodate a wider range of options than simply varieties of EDO tunings.
michaelwayneharwood is offline   Reply With Quote
Old 04-17-2017, 09:15 AM   #7
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

Quote:
Originally Posted by michaelwayneharwood View Post
I am using the WDL OL release currently, but have been bouncing around between yours, Oli's, and the recent updates Youlean released while I am learning the landscape.
Well, I guess the MIDI queue will be the same for all of those.

Quote:
Originally Posted by michaelwayneharwood View Post
For those curious the plugin is geared for the Xenharmonic/Microtonal community. It allows you to "retune" a virtual instrument to alternate intervals and divisions of the octave outside of the traditional Western 12 note system using pitch bend messages. The goal is to be able to import files in the SCALA file format to accommodate a wider range of options than simply varieties of EDO tunings.
BTW, there is a Scala file reader/writer class included with WDL/IPlug.
Tale is offline   Reply With Quote
Old 04-17-2017, 09:43 AM   #8
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

Quote:
Originally Posted by Tale View Post
BTW, there is a Scala file reader/writer class included with WDL/IPlug.
Nice! I found the class and this is going to save me a TON of work. I may need to modify it a bit as it ignores the SCALA description, which is something I want to capture, but overall this is very nice to have.

I am hoping there's a nice and simple cross platform "Open File" dialog hidden somewhere as well.

Last edited by michaelwayneharwood; 04-17-2017 at 11:40 AM.
michaelwayneharwood is offline   Reply With Quote
Old 04-18-2017, 02:08 AM   #9
ynohtna
Human being with feelings
 
Join Date: Jan 2014
Location: Brighton, UK
Posts: 21
Default

Quote:
Originally Posted by michaelwayneharwood View Post
I am hoping there's a nice and simple cross platform "Open File" dialog hidden somewhere as well.
Take a look at WDL_ChooseFileForOpen in wdl-ol/filebrowse.h.
ynohtna is offline   Reply With Quote
Old 04-18-2017, 04:57 AM   #10
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

Quote:
Originally Posted by ynohtna View Post
Take a look at WDL_ChooseFileForOpen in wdl-ol/filebrowse.h.
Thanks! I found IFileSelectorControl() and it seems to be doing what I need, but I will check it it out.
michaelwayneharwood is offline   Reply With Quote
Old 04-18-2017, 11:46 AM   #11
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

Quote:
Originally Posted by Tale View Post
BTW, there is a Scala file reader/writer class included with WDL/IPlug.
After doing some work with the ScalaFile class I can report back that it works, though it leaves it up to you to include error checking. It's modular nature makes it a snap to create a SCALA import wrapper that handles error checking for reading files.

I also need a Scala Keyboard Mapping import class, but that appears to have been passed over by whomever wrote the ScalaFile class. Simple enough to do myself.

Thank again for letting me know about it's inclusion in WDL - this has saved me a ton of time!

*edit*

I hope this does not come across as sounding arrogant - I am truly grateful for the ScalaFile class.

Last edited by michaelwayneharwood; 04-18-2017 at 03:10 PM.
michaelwayneharwood is offline   Reply With Quote
Old 04-18-2017, 11:30 PM   #12
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
Default

Quote:
Originally Posted by michaelwayneharwood View Post
I also need a Scala Keyboard Mapping import class, but that appears to have been passed over by whomever wrote the ScalaFile class. Simple enough to do myself.
That would be me, hehe. I just wrote it for what I needed at the time, which was to import up to 12-note organ tunings.

Quote:
Originally Posted by michaelwayneharwood View Post
I hope this does not come across as sounding arrogant
No, not at all. BTW, if you extend the Scala class, and you feel like sharing it, then I would be interested.
Tale is offline   Reply With Quote
Old 04-19-2017, 01:19 AM   #13
michaelwayneharwood
Human being with feelings
 
Join Date: Mar 2017
Location: Littleton, CO USA
Posts: 22
Default

Quote:
Originally Posted by Tale View Post
That would be me, hehe. I just wrote it for what I needed at the time, which was to import up to 12-note organ tuning.
*Grin* I am doing


No, not at all. BTW, if you extend the Scala class, and you feel like sharing it, then I would be interested.
*grin*

I really appreciate the starting point. I am using your code as a base and modifying the class fairly extensively by collapsing all of the smaller methods into single Scala Scale file import/export methods, adding similar methods for keyboard map files, and adding some class variables to hold generated tables for frequencies, ratios, and cents. I will share what I end up with.

Last edited by michaelwayneharwood; 04-19-2017 at 04:52 AM.
michaelwayneharwood is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.