Goto not working? | Querying tempo and timesig information of a selected score element

Discussions, advice, bug reports and much more about the "bach" environment.
Post Reply
sydy
Posts: 155
Joined: Tue Mar 21, 2017 1:34 pm

Goto not working? | Querying tempo and timesig information of a selected score element

Post by sydy » Wed Aug 05, 2020 4:33 pm

Hy,

Two things:

1.
I'm trying to use the goto syntax. Seems like I don't understand it fully.

When I send the following message to a bach.score
goto time [ 1 3 0 ] @inscreen 1
it should select the 1st element of the 3rd measure.
But bach selects the last element of the 2nd measure

2. My goal is to query on musical element (note, rest) in a bach.score the following information:
a) I goto to the beginning of a measure N: goto time [ 1 <N> 0 ] @inscreen 1
b) I query the information about the current tempo of this element. Don't know how to get this information...
c) I query the information about the timesig of the current measure. Don't know how to get this information...

Thanks for your help.

Micha

<pre><code>
----------begin_max5_patcher----------
2958.3oc6ck0bipiE9YmeETbmGcRPrXimmFulmleA2pqTXPNl9hAW.NKSW8+
8QrZbP3XARHnC4daufVNmym9zQ5HIv+5tQha8dGFHJ7uE9agQi90ciFEeonK
LJ86iDOX7toiQPb1DM8Nb.5FJNNIsP36gwWObucfPvduSNVBAPGnYnP3dnvN
a+fPAz2iJjf2t3Kp3aIb.ZDbxGNVv1MHDZXIXGlVtf37fDXoxI6lWtGxT.Ga
Wno2I2XsPK8h1Vw5j21edu7rrb5d5fsqCLL1N.oW7nQn4da2Wd1GI4DbPd1j
GjFKnp7fttltjhTxefwB.MonTlp9fjvONWqdmBypVonK966tK5kw2Hhd.FDX
7BrDh9hWnmPn8AHRm.BJBHYJ7ePnkoOD5J.xxehzC+3HLQ8EEy0shvvTrvfb
0v.PqBTPd5rnTjkqDE.0.EP0vVne0F0XAwsFtuf23zDysCeiCvPn+yPWisNw
kVhv1+DCGnHG8VRK9UrUYl0h+u.MrIWodM4.sYsTadU3f0oCGS7EX64RnQKQ
pQqVsUCz0XASG9FRSKYzaML2+vQe6y9VKXVfoj5ESCH8fr1XAEY8XyS5qHxY
cSBLdEZ8LRnnp5YivPe6smBSFiXTtEMR7Une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vhjUZKAocCBJSaJQNLNd7Une
PZtiEh3Aie54G8U8wwe01M4qf3u5Ce0NK+ZwWwv2bucHzL7jerhI99DT+h3h
5YA8cOYGW56hLOjHMcLBBbMN.CNZjXIha8dW7tee2+Gfd9B.2
-----------end_max5_patcher-----------
</code></pre>

danieleghisi
Site Admin
Posts: 1347
Joined: Fri Dec 03, 2010 1:25 pm

Re: Goto not working? | Querying tempo and timesig information of a selected score element

Post by danieleghisi » Wed Aug 05, 2020 9:38 pm

Hi Micha,

1) looks like a bug.
Off the top of my head, it could be an issue of precision in computation. If you use 0.01 instead of 0, that works, so you may use it as a temporary workaround. I'll look into it, though.

(The goto system is new with bach 0.8.1, so it is likely to contain some bugs...)

2) goto will not help you in retrieving tempo/timeisg.
I think you can retrieve the timesig via standard "dump measureinfo", and then picking the appropriate measure. That should solve c.
b is more complicate though, although I agree it should NOT be. There's perhaps a getcurrenttempo message instead of getcurrentchord.
For the time being, this doesn't mean you cannot do it yourself: you should parse the measureinfo llll, go element by element (measure by measure), keep track of tempi, and retrieve the correct tempo at the measure you want.

hope this helps.
I'll look into #1
d

danieleghisi
Site Admin
Posts: 1347
Joined: Fri Dec 03, 2010 1:25 pm

Re: Goto not working? | Querying tempo and timesig information of a selected score element

Post by danieleghisi » Wed Aug 05, 2020 10:09 pm

I think I have fixed #1.
Very sneaky one, thanks for posting it.

danieleghisi
Site Admin
Posts: 1347
Joined: Fri Dec 03, 2010 1:25 pm

Re: Goto not working? | Querying tempo and timesig information of a selected score element

Post by danieleghisi » Thu Aug 06, 2020 8:45 pm

Hi,
In the next dev release there will be "interp tempo" and "interp timesig" messages to get tempo and time signature at a specific timepoint.

sydy
Posts: 155
Joined: Tue Mar 21, 2017 1:34 pm

Re: Goto not working? | Querying tempo and timesig information of a selected score element

Post by sydy » Fri Aug 07, 2020 8:59 pm

Your doing great work! Thank you Daniele.

Post Reply