Hello again! I put this topic as solved!
Thank you very much for all the help!
I would like to leave only one reflection. I think it would be a good thing if we had an effective line observable. To avoid having to resort to timers or other more complicated methods, which only a few people could build.
Finally, it seems that there are two ways to solve this issue:
- Using a timer that constantly bombards the update of each line. This is the method I have chosen, because the code is simpler. which is not 100% reliable at high speed.
- Use a kind of cache memory to read all the data of each pattern and project them in real time when necessary. I understand that it is more or less what Joule proposes. That cache must be updated every time the composer modifies anything in the pattern editor, within the range of the cache. I still do not understand this point. For this I would need to see a simple tool that works this way.
To create tools of this type, it is necessary to optimize the maximum code, as Danoise warns. Simply avoiding unnecessary calls increases the reaction speed to work "in real time" within the limits of the timer.
If the objective is to read data from particular note columns, it is better to create a function that directly returns that data without having to check empty pattern lines or empty track lines. The reason is that a timer is used. The more chained operations, the later it will return the data. Apparently, the shortest route to get the data is the fastest. That does not add conditions before.
A reliable tool would be one that works perfectly at a high speed, something like 900 BPM & 8 LPB as minimum without any error. With timer it is frankly difficult to achieve that.
Finally, being able to get reliable data from the line can accommodate a lot of useful tools:
- Time reader, with resolution in tenths of a second, per line. A time marker could be built.
- A visual metronome configurable. This is very interesting.
Converter of musical notes, even with a selector of clef.
Of course, an orderly note follower to find melody errors and to improve the melody (my tool).
A track player based on blocks per pattern.
Up to 3 track players based on blocks per pattern. The composer could select 3 tracks to compare.
If there is no reliable way of reading data for each line, all these tools can return problems...