lv2 midi - Keeping track of time while processing a noteOn event
-
- KVRer
- Topic Starter
- 3 posts since 17 Jul, 2018
Hi all! I'm using Moony to prototype some components for a MIDI only lv2 plugin I'm building. I've been trying to work out how to get some sort of song position value from a noteOn event, meaning that I need to know the beat and bar that the note belongs to when it invokes the midiResponder. Even a total time or total frames will do to calculate. The way Moony works with timeResponder and midiResponder callbacks means I can know the time position or the note... but not both simultaneously. Looking at the lv2 midi spec it looks like only the event type, note number and velocity are properties of a noteOn event atom... so then I will face the same issue when I rewrite in C++ and integrate this code into my lv2 plugin? Is this right? Is there a work around?
-
- KVRer
- Topic Starter
- 3 posts since 17 Jul, 2018
AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
UPDATE: I managed to overlook this until it was pointed out to me on freenode https://x42.github.io/midifilter.lv2/ht ... ntize.html (https://x42.github.io/midifilter.lv2/http___gareus_org_oss_lv2_midifilter_quantize.html) This answers part of my question, and does provide the idea that I can solve this. I'm still left with an uncertainty though. I'm not sure if anyone can help me with this in Moony, it's just nice being able to test small ideas quickly in Ardour without having to compile and deal with URI's - but I do want to know it will work in an lv2 so I'd like to at least be able to test it in C++. I'm pretty inexperienced with MIDI for sure. Let's say I have a 4/4 time sig and a midi file in a track and I want to take the MIDI input and modify only notes on the 2nd and 4th beat of every bar then output the MIDI stream... when I process the midiOn event atom how can I know the note's position relative to time with accuracy?-
- KVRer
- Topic Starter
- 3 posts since 17 Jul, 2018
AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
I'm going to call this solved even though I don't have a fully implemented solution yet, the original question was whether this is a limitation writing lv2 midi plugins... which it is not. The plugins get the sample rate and time signature from the host and we can use that to calculate position. My issue was that I was unable to access that data in the Moony environment. The Moony developer pointed out that we can read current bar/beat from the timeResponder object from inside the midiResponder callback like this: Code: Select all (#)
local bar = timeR[Time.bar]
Code: Select all (#)
local beat = timeR[Time.barBeat]