Position finding

Discussions, advice, bug reports and much more about the "bach" environment.
Post Reply
Julian
Posts: 3
Joined: Sun May 28, 2017 8:33 pm

Position finding

Post by Julian » Sun May 28, 2017 9:27 pm

Dear Andrea and Daniele,

We are currently working on a university project using bach.score and have encountered some difficulties. We’re aware it’s a lot of questions, but we’d be very, very grateful if you would take the time to try and help!

We want to use bach.score as a score in which a user can turn pages just as if it was an actual piece of paper lying in front of him. Also, he should be able to jump to a certain position in the score by clicking inside a bar (jumping to the beginning of that bar). We haven’t yet been able to find a way to do that, or in other words to have the position of the cursor being put out in any way.

Our initial thought was to use ‘preventedit’ to lock all editing functions and have mouse clicks send a position telling us where in the score the user clicked. Is there a way to do that? And if so, how would the position be given out? Bars/miliseconds?)

We also thought about making the spacing of bars absolutely equal for the whole piece via spacingtype and align, so we could afterwards lay a (transparent) grid over the score to be able to read a position from that. But we encountered the problem that there seems to be a graphics bug as bach.score stops following the midi-file that’s being input once we do that.

Secondly, for our User Interface, we would like the User to be able to scroll horizontally (via simple left/right arrows). Is there a way to do this? And if so, is there a way to do this ‘per page’?

Another question related to graphics: Is there a way to have MIDI tracks that are being read by bach but are not visible for the user? In our case we’d have 8 MIDI tracks which should all be read and sent to outputs, but only four of them should be visible in the score. Is there a way to do that besides using 2 separate instances of bach?

Another thing we’ve come across is MIDI Control Changes. We tried to load a MIDI file that has Control Changes into bach.score and export it again from there. The exported file had lost all the Control Changes. Are CCs simply not being read in bach?

Somehow related to that: Is there a way to influence pitch via bach? We’d like to alter the standard pitch in a range of about 40 Hz from 420-460Hz, so this isn’t covered by pitchbend alone.

Thanks again in advance, we’re looking forward to your answer and hope we’ve been able to make everything clear – if you have any questions, please don’t hesitate to ask.

With all the best,
Julian

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

Re: Position finding

Post by danieleghisi » Sun May 28, 2017 10:07 pm

Hi Julian, I'll try to answer your questions (there are patch snippets inside the answers.)

1. You can "turn pages" via "inscreenmeas", look it up in the help center.
There's no output-measure-on-click thing, but you can easily do that by overlaying a lcd and using the #gettimeatpixel function (which by the way will be called, from next version, "pixeltotime", but it'll be the same thing, and compatibility will be preserved).
You'll see that the answer contains both onset in ms and onset in measure + onset in measure form.
Look at this snippet:

<pre><code>
----------begin_max5_patcher----------
1634.3oc6a01jhhCD9yN+JnntObWU6rWR3UuOc2uiq1xJBQM6BITj3Li2V6+
8Ku.HJQGGcFKWWb2Avzjzc+jmzzHze+gI9y4uPD9d+k2+5MYx2eXxDSS5Flz
78I9k3WxJvByo4mwKKILo+mrxjjWj11KnYeij6URvhVgUXY1JJa4rZRlzpDX
P7mAexKHFn2kZ1hTa89RSeXqKorBhznM31F4qkssBZZklazLe9WeDNsUmB4l
BhocecC+3gGza9zI5cJEMmTeD6GAS6Y+QV6G8Z1eEtFWRjj5YDFdt09.N8Mj
CeKwgu0zhsmxMUDq4oD34OGyV568kyw8IOqz3f4143rUelIW4g7fd+sRmdxi
BQIFHBY1AgQGGiPNwAnCbH5sfCu69+2HaDdRpheKqnuPJdcD.M035PTzowRd
clP3MASnplxNFAHDDXH.fP8t3fyw6csFG89rFujHD3kjA91uAOhOYhZASrq2
m94n2GFM7CmQWjkeDuJZpwsBM6hPVm7sFNNbniE2py4Kk0XlPE+SeMidCw.2
qfJjZJa6dCE6b85CMEuToxsqf8N5LdC1XCeAAv2onXAe3S4l0nhLdcm++Dml
QTSBYTc3.8Pa4ww87lBNupQs+tB3gl+qNI++POMzzDpsottc4jpjsMZsy8nI
1vQMe53UOqxCQoa5bZAUtwLNfofoMhWvYxE3ribc1o8nFY7BdcObY6FXOiVO
lB5+YFSnhGzhsjZAkyZRbXO6PHwKVTPYsoXE0MZ8iB32SCLUdBFI+SMEu8ZL
TEJSxo5ESKaYGr0EEamHLXmt2hdyh8moxIKvqKjLtjHJ3RgyQw4UQN1eMWgo
o6YblPYip0tyI3RAUuxuYFsEuddEufLyPOmkik3YftOMprg513AZakxVv6wB
sBLHkZ+SjBdlhC3QX5CqH98Is9FeQ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L6afRuywrLp6jVQyyIr9ELTNUnKY579soxKvVrUPm0G2Iae6p6CXfQu
EC7xrmnSwdRtZ1S7oXNvqG7bJzIzkPmtP6CdB3UvUCtBNkYuyzZrgFvUUMk+
nwTzFhJS6uZKlRSccpxwlY+Zf4q0jmnsmuojYU4YmsRcOfYx001Be7kXaUt6
WxUyJr0zl04JM+iG9erja.CK
-----------end_max5_patcher-----------
</code></pre>

2. I don't understand what graphic bug you have found with equally-wide measures, can you please be more specific and post an example?
To have fixed measure width, you can add the width specification in the measureinfo, see #measure+width.

3. When bach.score has the focus, you can't scroll with arrows, since this is used for something else. But please consider that Cmd+Arrows (mac) or Ctrl+Arrows (win) already scrolls left/right. If the objecet does not have the focus, you can do whatever you want by using the [key] object in combination, for instance, with #inscreenpos.

Here's another snippet, be sure to doubleclick the loadbang after you paste it

<pre><code>
----------begin_max5_patcher----------
1768.3oc6cs0bapCD94jeELLmGZmIIGIw89142wY5jACxwpEj7.3j3Sm9e+n
KfMXDNNNINNoqaK3HgVs629okkKM6ut7B2YhGo0tNey4ect3hec4EWnaR0vE
s+7EtkoOlUjVqOL2YqZZDb2qLcsLsIaAie2sUzrFiXHww2ftxITuk32s046s
CgupjwKnMZwg21nXUytsxx0SoX1Otl32Mk0MqKn516ZwLxl0KoFMvcVJ+NWm
uq582WdoZyUGn0URqqSui1I4F5iZqxkwqypnT9RQsC5Fmu37WXmutOPHI7ln
fqbvdQJ..SPZbfLENPNTb.G+LvgiCC3zGjyzHHnPjlqfGG7drabh1s6Gn1FQ
1uQevNeb3atQOkieeFqWnwLML8jaBNDO7xJZMk2j1vD7ojEpcSeI8DHTv6FB
c8dgHxQ.QOs05+dsHnlVHCvIsjm1l80q7CR1+Z.Oq1rmEal7bC.d018upXPZ
V1px8Y+nXkeFi0zX+viA.r3zidF1Oi27pZx+jt9oc3XiCGseRNxp85O1d8dl
16U11cTfvrzrE2TmIp1rX+dAKiVuLMioNwpZJMmOKrmUVHDKaUmuHmdr9uxC
x8qJkosI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OmaBjy8lWCG62IaODfP6H
qxR4wTO9U+TzP6uu2PVHpxG7k9ODDyC8pa+j3ok2kuSzD5cpmP+S8DFbJmvs
8VlV8SZ0NWeQIKmksHkyoEiIx8utjt2+3s81kG93dFtw2.wa6dG8pfdOsncg
Ndrb528vkp3+Ndy2OvGOaHNxCG6q9NZvyHD8xkLAmrWI+lZWnHTzaicg7Cvm
6100FQ+7UI4.82cfH6b4yJZ7Yg69ZuAfGfa.tA3Ffa.tA3Ffa.tA316AtAWF
hJodBvG.9.vG.9.vG.9.vG.9.vG.9.vG.9.vG.9vGd9.4z8X07AvD.S.LAvD
.S.LAvD.S.L+yAL0+2Osu4E7lkfNH42XICLFPx.iAjLvX.+JvX.zGXL.iAXL
.iAjLvX.I+9wXtF+RuiNfDNukvNUKpQE+mLwJdWsGbPwtROD2dkNotZektfS
oZeXEvpVrpJqqnE0UwIcP8p9Q0MLt4W+saOnnAGyBVdNk2uXEkypSmUP00pI
j0Rw0gpN5e0G9TpyN57SnOckropbSgmB+xTP+ycEL9.TP7IygFcHZS7oieE9
witqTG7wRlPu8r82S8iLXtmfdEb57mjCgt6exzGuCQcHGo5XN2S5xks01Ost
nzD2xzeXpTf5hVnaIia9QcUvzshdOq630ECU2zprErFZVypJSU86wPSsO0sT
H4I7Ur13hxY92W9+.h4L6oC
-----------end_max5_patcher-----------
</code></pre>


4. You can hide voices. Look up #hide voices.

5. No, MIDI control changes are not read by bach, since they are not note-attached, and bach has the concept of note-attached slots instead. We understand that it might be useful to have them, but we haven't actually figured out the best scenario yet.
In principle, you should be able to build up a custom system and add "fake" long notes having all control changes notated within their slots.

6. I'm not sure of what you mean by "altering pitch in bach". bach represents pitch in MIDIcents, you can of course change whatever pitches to whatever you want (look up the #cents message). If you want to assign a pitch modification via a MIDI pitch bend, this is not something bach represents natively, but you can probably use an integer slot and make your own MIDI rendering system (have a look at [bach.ezmidiplay], which is actually an abstraction, if you need something to start with).

But I must say I'm not sure if that's what you want: it seems more like you want to transpose pitches, in which case of course you can do it, using the #cents message. By the way, bach.ezmidiplay handles microtonality via its argument, look at its help file and reference sheet.

Hope this helps. We know that bach has a lot of features and it's not always easy to navigate through the documentation; nevertheless, in general, whenever you need something, you might want to start looking into the help center for the corresponding tag, e.g. #transpose or #cents.

Best,
Daniele

Julian
Posts: 3
Joined: Sun May 28, 2017 8:33 pm

Re: Position finding

Post by Julian » Fri Jun 09, 2017 6:44 pm

Dear Daniele,

that helped a lot! Thanks you so much!!!
We've only 3 small Questions left:
1. We're still trying to get the same width for every bar despite the "number of notes" in it. We tried it via the required measureinfo syntax, which kind of worked, - but "empties" our loaded score... ( Our Workaround would be an extra miditrack constantly playing demisemiquaver or sth.; and then just put a panel over the track, but we still are curious if there's an other possibillity)

2.Might be pretty easy, but it seems like we just can't find the right Argument:
Is there a way to hide the vertical selector which appears and follow the playing position during the playback?
And also - Is it possible to make the score "static", so it wouldn't follow the playing notes on his own and just "stands" on the exact same view continuously?


Thanks in advance,
Julian

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

Re: Position finding

Post by danieleghisi » Sat Jun 10, 2017 9:58 am

1. you need to unset @autoclear, which by default is 1. Look #autoclear up.
2. You can hide the play cursor by changing its color to a transparent one. Be sure to remove @highlightplay also, otherwise played notes would also be transparent. There is currently no way to avoid scrolling when the cursor overflows the current view, but this is a good feature request, some sort of @catchplay attribute which you might disable. Should be easy to add. In the meantime, a (rather cumbersome) workaround might want to have a copy of your score, and play the copy, not the original.

Post Reply