-
Notifications
You must be signed in to change notification settings - Fork 202
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
How to get bars width ? #155
Comments
The model is independent from the whole rendering part; that's why you won't find any graphical details in the model classes. During rendering there a renderer.Render(track);
var boundsLookup = renderer.BoundsLookup;
var beatBounds = boundsLookup.FindBeat( track.Staves[0].Bars[0].Voices[0].Beats[0] ); //
var barBounds = beatPosition.BarBounds; Does this help you? |
It works great thank you ! |
Currently the note and rest positions are not part of the lookup cache. Mostly because I did not see any need for it yet but it is also not clear what bounds exactly to provide. The note head is the most obvious rectangle, but also the effects might be of interest (e.g. dots). It would be interesting ot hear what you are exactly planning to implement, then I rather able to provide a proper solution. All the information is available internally. I also have some performance worries of collecting all those details. I will run some tests where I collect also the note and rests. I could add a setting which allows to control whether the note bounds are included. |
I'm building videos out of tablatures. http://puu.sh/x2bIV/9b33162032.jpg Using bars boundaries I can highlight the current bar, and I'd love to be able to highlight the notes currenlty playing as well. BTW I'm sorry I moved the copyright, but I can't keep it in this form, otherwise each track is too large. |
If you have a proper replacement for the existing alphaTab notice I'm fine with it. Regarding your sceenshot it seems that you are rendering all tracks individually. In this case the tracks are not aligned properly to their timeline. You should use the multi-track rendering to overcome this problem. To render all tracks into PNGs (chunked to have a usable image size) you can do something like: // load score
var score = ScoreLoader.LoadScoreFromBytes(File.ReadAllBytes(args[0]));
// render score with svg engine and desired rendering width
var settings = Settings.Defaults;
settings.Engine = "gdi";
settings.Layout.Mode = "horizontal";
settings.Staves.Id = "tab";
var renderer = new ScoreRenderer(settings);
var chunk = 0;
var info = new FileInfo(args[0]);
renderer.PartialRenderFinished += r =>
{
var path = Path.Combine(info.DirectoryName, Path.GetFileNameWithoutExtension(info.Name) + "_" + chunk + ".png");
chunk++;
((Image) r.RenderResult).Save(path, ImageFormat.Png);
};
renderer.Render(score, score.Tracks.Select(t => t.Index).ToArray()); |
Wow man ! I wish I've talked to you about this earlier I'd have spared a lot of time! Though it works not too bad, tracks are somewhat aligned, see : I have this tempo issue I'm working on, and a few minor bugs. |
That's a very interesting way of animating the playback, it looks very fancy. But for playing along the song with the guitar, it is quite hard to read the tablature this way. What are you using for playback? Sounds a lot like the audio exported from Guitar Pro 6. |
That's GP6 right. |
I'm closing this issue in favor of #187. The only open topic here is the individual note position which is handled there. |
Your environment
Expected Results
I'm using Samples.PngDump to generate images from tablatures.
I'd like to be able to get the size of each bar drawn.
Observed Results
Currently the Bar model doesn't seem to have a "width" attribute.
The text was updated successfully, but these errors were encountered: