hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

Float note positions and tuplets

Open oddtime opened this issue 3 years ago • 8 comments

After some tests I am pushing the experimental work (in progress) with double note tick positions. I have not implemented a class for note positions, just using the 192/whole note resolution as a unit.

It includes the minimal gui used to test tuplets in #1127 that can be used to input fractional position notes. Note: reloading a file using other branch versions, transforms all fractional positions to zero (not the fractional part but the number indeed), because of QLocale::toInt() in readXMLInt()

Note: piano roll is not working for tuplets

oddtime avatar Apr 27 '21 07:04 oddtime

Along with many things to discuss, there is the printing precision of double type values in XML nodes, affecting both Song export and copy/cut & paste. This is bonded together with the tolerance that the GUI accepts while searching the note (to overwrite or remove the note for example).

For the moment I am using 10 significant digits for the XML double nodes, and defined a POS_EPSILON in Pattern.h for the tolerance (wider than the XML precision).

oddtime avatar Apr 28 '21 09:04 oddtime

I see Windows is not building the last commit. I have no idea, there were very few changes (maybe function fabs or missing a parenthesis ?).

oddtime avatar Apr 28 '21 22:04 oddtime

I see Windows is not building the last commit. I have no idea, there were very few changes (maybe function fabs or missing a parenthesis ?).

Hey @oddtime ,

I think this was due to one of my commits which slipped into master and caused the Windows builds to break.

theGreatWhiteShark avatar Nov 12 '21 09:11 theGreatWhiteShark

Hey @oddtime,

I'm currently working on a larger patch of Hydrogen's AudioEngine to make it support arbitrary tempo changes. Unfortunate for me but lucky for you, this will include changing the tick type from integer to float. At first, there will be a compatibility layer making everything except AudioEngine and Sampler still see the ticks as integers but from the engine perspective there won't be much missing to support arbitrary tuplets.

theGreatWhiteShark avatar Dec 15 '21 18:12 theGreatWhiteShark

Hi @theGreatWhiteShark this seems good ;) thanks for it and thanks for the information here, send the link when you upload the thing. I am afraid that I will have to rewrite all this PR at the end...

oddtime avatar Dec 15 '21 18:12 oddtime

I am afraid that I will have to rewrite all this PR at the end...

Well, at least the AudioEngine stuff I'm doing right now is more or less orthogonal to your PR. But there was indeed quite some progress during the last year.

theGreatWhiteShark avatar Dec 18 '21 13:12 theGreatWhiteShark

@theGreatWhiteShark is your patch of Hydrogen's AudioEngine fully merged now? Thanks

oddtime avatar Oct 13 '22 19:10 oddtime

@theGreatWhiteShark is your patch of Hydrogen's AudioEngine fully merged now? Thanks

Hmm. So, the audio engine already uses double precision ticks internally. That's merged. But there are still a number of glitches due to me getting some things not right the first time and some conceptional legacy still prevailing. I'm in the process of fixing these things and make the engine (hopefully) run as smooth as it gets. It still needs some more testing but it feels like its almost done. https://github.com/theGreatWhiteShark/hydrogen/tree/phil-introduce-transport-position

That aside, Note placement is still only possible on integer tick positions. I did not touch this in order to not change too many things at the same time. From the perspective of the audio engine, however, this should take only some minor changes to support double precision note placement. But the remainder of the core and the GUI has to be adapted. This is probably quite some work.

theGreatWhiteShark avatar Oct 13 '22 19:10 theGreatWhiteShark