Tap tempo, loop count and transposition with two bach.score

Discussions, advice, bug reports and much more about the "bach" environment.
Post Reply
singeorge
Posts: 6
Joined: Wed Oct 27, 2021 3:39 pm

Tap tempo, loop count and transposition with two bach.score

Post by singeorge » Wed Oct 27, 2021 4:28 pm

Hi everybody!

New member here and also new to Max (and bach!). I have been tryihng various turorials and started building my first patches recently. I'm trying to build a patch that will load a midi file and will be able to:

1. Change the tempo (not real-time, although it would be nice) by tapping on keyboard. I can do that on Max but don't know if it's possible inside bach.

2. Count the times the midi file has been looping (real-time). I have been using the loopall message (I only need it to loop the whole file) and, with bach.keys loop I am able to print the Start and End of the Loop. Is there also some form of counter that counts these loops?

3. I am using two separate bach.score windows, one that shows every note on midi file and I'd like the other one to show only some of the bars of the first bach.score (so that, for example, a singer that waits to sing doesn't have to see the first few bars that have chords). Is there a way for the second bach.score to delete some measures?

Any help would be really appreciated. I am not sure if what I am asking is novice or advanced stuff, so please bear with me.

George

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

Re: Tap tempo, loop count and transposition with two bach.score

Post by danieleghisi » Wed Oct 27, 2021 9:16 pm

Hello,

1. The easiest way to change the global tempo for all the score (off-line, heavy change) is by sending something a message "cleartempi, addtempo [1/4 70]" or anything you need. If you need it quickly and in real-time, you may want to use a setclock instead, with the "clock" message to bach.score (see #clock in the Help center). This essentially allows variable rate playback.

2. Whenever you play with a loop, as the loop end is reached a "loop end" message is sent through the playout. You can just put a
[bach.== loop end]
|
|
[sel 1]
|
|
[counter]
to count how many times the loop has been played

3. Of course, you can select the measure you want to delete (e.g. "sel measure range [1 4]" ), and then send the "delete" message. See #sel and #delete.

Hope this helps,
Daniele

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

Re: Tap tempo, loop count and transposition with two bach.score

Post by danieleghisi » Thu Oct 28, 2021 6:47 pm

(As for the tapping, you can do this in standard Max, with some arithmetic to take the taps and compute time differences, filter them, etc... Then you can feed the inferred tempo to bach.score as I mentioned, or use it to pilot the setclock)

singeorge
Posts: 6
Joined: Wed Oct 27, 2021 3:39 pm

Re: Tap tempo, loop count and transposition with two bach.score

Post by singeorge » Fri Oct 29, 2021 8:08 am

Wow!

Thank you so much for these -truly elegant - solutions!

Much appreciated!!

singeorge
Posts: 6
Joined: Wed Oct 27, 2021 3:39 pm

Re: Tap tempo, loop count and transposition with two bach.score

Post by singeorge » Wed Nov 10, 2021 5:24 pm

I wasn't sure if I should open a new thread, but, as my question is still on transposition, I am continuing the old one.

So, I am following the solution that is on the "Through the Looking Glass (a)" tutorial, in order to do the transposition. Can you please let me know what the final bang, on the left side of this tutorial, does? As it seems, because of that bang, the tempo doesn't pass throught to the transposed bach.score.

The idea is to open a midi file on bach.roll, then quantize it to a bach.score (these two will always display the original score), while the transposition will be shown to another bach.score. I would like to control the transposition from the first note of the midi file (and not from the key of the piece, actually I don't want any accidentals to be shown), so I am doing a bach.flat and then bach.slice 1 to find the first note. The above solution removes the accidentals on the final bach.score but, unfortunately, it also removes the tempo.

Finally, In order to be able to do the transposition in diatonic pitches (eg. minor 2nd, major 3rd etc.), I have created a txt file, where all the intervals are kept (G-1 to C1) and I am thinking of calling this file with a "coll" wherever I want to make a transposition. Is "coll" the "right" way to implement this, or is there another way, maybe through bach library?

Thanks again!

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

Re: Tap tempo, loop count and transposition with two bach.score

Post by danieleghisi » Wed Nov 10, 2021 10:39 pm

The final bang rebuilds the whole score starting from the separate parameters you entered. Look up #separate+syntax in the help center. Tempi are also passed through, because they are part of the measureinfo (second outlet). If you think you have spotted a bug, post a minimal patch example and I'll look into it.

That tutorial is indeed about using separate syntax, which is the "traditional" CAC way. You can also use scripting instead to transpose in place (e.g. "sel all, cents = cents + 100").
As for diatonic transpositions, it depends what you mean: if you mean scalar transposition (e.g. in C major transposing by 1 step: C to D, E to F, etc.), then you have to patch it yourself; you can perhaps take advantage of cage.scale and build a lookup system from there.
If you mean diatonic transposition (e.g. augmented 2nd as opposed to min 3rd), then you can simply use bach's pitches, e.g. "sel all, pitch = pitch + D#0" as opposed to "sel all, pitch = pitch + Eb0".
If you want to output pitches from separate syntax or playout or gathered syntax, see the relevant attributes starting with "outputpitches" (search for them in the inspector).

Best,
Daniele

singeorge
Posts: 6
Joined: Wed Oct 27, 2021 3:39 pm

Re: Tap tempo, loop count and transposition with two bach.score

Post by singeorge » Wed Nov 10, 2021 11:11 pm

Hi Daniele,

Thank you for the quick reply.

I am attaching a part of the patch. As you can see, if you load a midi file, the tempodoes not pass through to the final bach.scores. If I remove the bang we were talking about, the tempo passes through - but, obviously, the transpose does not. However, I may have patched something wrong, so I do appreciate you looking at it.
Asma WP3 7 forum.zip
(6.04 KiB) Downloaded 165 times
I will also try your suggestions concerning the transposition.

Once more, thank you!

Best,
G.

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

Re: Tap tempo, loop count and transposition with two bach.score

Post by danieleghisi » Fri Nov 12, 2021 1:18 pm

Hello, for one thing, you are not connecting the measureinfo outlet-inlet, so tempo information cannot pass through. Connect it and it'll work.
Then: I assume you want to use a [t b] before your delays? In any case I don't see why you should use delays: normal Max triggers should suffice for the dataflow.

Best,
Daniele.

singeorge
Posts: 6
Joined: Wed Oct 27, 2021 3:39 pm

Re: Tap tempo, loop count and transposition with two bach.score

Post by singeorge » Mon Jun 27, 2022 8:13 pm

Hi! Still building my patch and I have a question regarding transpositions.
I am using the method that is provided at the tutorial (Through the looking glass). There is a counter that essentially shows the number of semitones the score is transposed from the original. There is also a [bach. == loop end], as previously suggested, going to the same counter in order for the transposition to take place automatically, every time the end of the score is reached (just like a phonetic exercise going upwards of downwards, a semitone each time). I would like to have the score stop when it reaches the max value that I have entered at the counter but not before it reaches the loop end. I have tried using a gate so that it opens when the toggle from the max value of the counter turns on and waiting for the loop end to stop the exercise. Unfortunately, the counter toggles off before bach score reaches the end of the loop.
Any ideas would be much appreciated!

Post Reply