Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback tempo #14

Closed
rettinghaus opened this issue Dec 9, 2016 · 2 comments
Closed

Playback tempo #14

rettinghaus opened this issue Dec 9, 2016 · 2 comments

Comments

@rettinghaus
Copy link

The MIDI file now plays with the correct tempo, but the highlighting of notes still progresses at 120 bpm.

@craigsapp
Copy link
Member

That is caused by the update to the latest verovio develop branch. I implemented MIDI tempo conversion from Humdrum to MEI in Leipzip in September, and you implemented MEI to MIDI conversion of tempo recently. But there is one more item seems to be causing the problem:

var vrvTime = Math.max(0, 2 * time - 800);
var elementsattime = vrvToolkit.getElementsAtTime(vrvTime);

	var vrvTime = Math.max(0, 2 * time - 800);
	var elementsattime = vrvToolkit.getElementsAtTime(vrvTime);

This JavaScript code is hardwired to tempo 120 for visual playback. Now that MIDI playback is not hardwired to 120, they are not in sync. The question is how to un-hardwire the visual playback tempo...

I took these lines from the MEI viewer. And it looks like the viewer still is using that system (and would likewise have the same bug):

https://github.com/rism-ch/verovio/blob/gh-pages/mei-viewer.xhtml#L288-L289
https://github.com/rism-ch/verovio/blob/gh-pages/midi.xhtml#L56-L58
https://github.com/rism-ch/verovio/blob/gh-pages/mei-player.xhtml#L243-L244

Ideally I would ask the MIDI playback system at what time it is currently being played and then send that value to vhvToolkit.getElementAtTime(). Do you know if this is possible or how to do it? I can also do a work around by calculating the note times from the original Humdrum data (but that would not help if you are starting with MEI data).

Verovio issue related to this:

rism-digital/verovio#379

Embedding MIDI timestamps in the SVG is one way to implement it, but this is inelegant since the SVG would be tied to a specific MIDI file/tempo setting.

@craigsapp
Copy link
Member

This is now fixed in verovio 2.0 pre-release (current develop branch of verovio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants