inconsistent performance using dict bangs to drive random polybuffer play

Foam Okiji's icon

Foam Okiji

7月 10 2024 | 1:00 午前

Hoping I can find some help. I’m a beginner, but have spent some time searching for an answer.

I've pieced together a patch which will play randomly from playlists (polybuffers) whenever a certain word/number is typed (for the first buffer this would be "holder" which is indexed to “3”; and for the second buffer this trigger is “benjamin” which is indexed to “2”.

As I say, I'm new to this and the patch as simple as it is, is quite scrappy in all sorts of ways (happy for any pointers) but the biggest problem I'm having is that it is inconsistent. For instance, I’m not sure how to get it started each time, both how to get the triggers started and also how to get the audio to start responding (I end up just pressing all the messages and eventually something happens). Even more problematic is that for some reason the dict object is double-banging--it first bangs when I finish typing the word and then again when I hit the space bar. It seems to only happen when I type in the correct selection. How can I make it all more reliable? I have attached a version of patch.

Many thanks, in advance!

FoamPrawn

random dict play help.maxpat
Max Patch

Source Audio's icon

Source Audio

7月 10 2024 | 11:36 午前

I would simplify this completely.

no dict, no polybuffers, only simple autopopulated umenus, sfplay,

umenu populated with words to match

Max Patch
Copy patch and select New From Clipboard in Max.

Foam Okiji's icon

Foam Okiji

7月 10 2024 | 4:39 午後

Thanks so much for this! Working through your suggestions now.

Foam Okiji's icon

Foam Okiji

7月 10 2024 | 8:06 午後

OK, thanks again for the patch--it will definitely be useful for thinking through other parts of the project. A couple of things: I should have mentioned that the text box is not purely for triggering objects downstream but will be used in a performance setting to display notes. The triggers are a part of this broader context (e.g. I might type "walter benjamin and his curtains," with the "benjamin" setting off the sample selection in one of the poly buffers). This is to say that the text box needs to make sense. It needs spaces and needs to not have to clear before each trigger. Separately, while the umenus for the groups of samples makes complete sense, the umenu before the select object doesn't quite work. I have to manually click the various selections (and even then it works inconsistently).

After working through your patch, I returned to my own, cleaned it up a little and managed to get it working quite consistently. The one outstanding problem is that the "radomonizer" is still double-triggering (first when I type the word, and then again when I hit the space bar). Any ideas on how to solve that particular problem?

Once again, many thanks! I've learnt so much this morning!

random dict play with gate.maxpat
Max Patch

Source Audio's icon

Source Audio

7月 11 2024 | 8:19 午前

your recognition is simply wrong.

regexp detects holder alone and also with next typed spaces around it.

that is why you get repeated triggers.

I won't do more suggestions, because you don't describe what exactly

you want to do with text in textedit.

do you want to recognise ONLY last typed word ?

or be able to select text in the middle of typed stuff, output it

using for example tab ? etc ?

if umenu does not trigger audio playback then try embeded coll

or anything else that outputs that few bangs if names match.

Foam Okiji's icon

Foam Okiji

7月 12 2024 | 2:36 午前

Okay. Will give this a try.

Thanks, again.

Yes, I only want last typed word recognized and not the space that follows. I will be typing out full sentences of text, with audio being trigger when certain words (including benjamin and holder) are typed. The expression I'm using allows those words to be recognized. The problem is that it also allows the space(s) following those chosen words to be recognized, up until another character is received in the textbox. It's not a huge deal for this particular project, but I'd like to figure it out for future attempts. Anyway, I know I'm wading into things that are far too difficult for me. I appreciate your time.

Source Audio's icon

Source Audio

7月 12 2024 | 7:28 午前

there are different ways to target a word.

Textedit has several outputs which can be configured

to help a bit.

It is easy to recognise last typed word (means group of chars and digits

separated by space from the rest ... or any other defined separator)

One can also set it so that whan one clicks on a word anywhere in allready typed text, the word gets sent out 3rd outlet.

But in your case it is a simple decision,

do you want to recognise a word (which becomes a word only after either space or return / new line gets typed) ?

or as soon as all chars that make what you want to recognise are typed.

means typing b e n j a m i n will trigger it without space at end.

or do you want to wait till it becomes a word ?

what if you type b e n j a m i n x ???

is that recognised as benjamin before x gets typed?

In any case you must set textedit to output as one symbol ,

that is the only way to detect several spaces or newline chars at end.

Post what you want, and then will see about it.

Foam Okiji's icon

Foam Okiji

7月 12 2024 | 6:45 午後

Just to say, that changing the textedit to output as one symbol was the ticket! Thanks, again. Have attached the patch, as it stands, in case it might be of use to someone else in the future.

random dict play with gate.maxpat
Max Patch
Source Audio's icon

Source Audio

7月 13 2024 | 7:24 午前

well there are few problems left :

type ofili, then return (no space after ofili)

it will trigger again, press delete it triggers again.

if you have empty line above current typed text

you get no match

here is my version . just in case

Max Patch
Copy patch and select New From Clipboard in Max.

Foam Okiji's icon

Foam Okiji

7月 20 2024 | 9:42 午後

Source Audio, just writing to thank you for that last patch (I've been up against a deadline and have only now had a chance to play with it). It is great. Does what I want and more. I'm less familiar with fsplay; and atoi is completely new to me but will be really helpful for the text based things I'm attempting. Most importantly, it seems completely reliable. Two things I'm wondering about: what does the "13" in the blue rimmed sel object in reference to. Secondly, I'm assuming that the depth level is for if I've nesting folders of audio files. Is that right? Anyway, thanks again.

Wil's icon

Wil

7月 21 2024 | 3:22 午前

13 opens and closes gate

//

recursion depth is folder in a folder.

if you have a folder of audio , and a subfolder of audio inside. depth 1 will load the subfolder into umenu.

if you set depth 0 umenu will only load main file, not subfolder




Source Audio's icon

Source Audio

7月 21 2024 | 6:48 午前

Will explained all, thanks !

difficulty in this was not sfplay or buffer - does not really matter,

but sfplay is more efficient, does not need time to load big files into memory.

Challenge was rather text recognising, which is a bit troublesome

thing in max, regexp you used could not cope with it correctly.

Typed enter (new line / ascii 13) in textedit tells that something changed,

output gets triggered, but regexp does not treat it as printable char,

and so you would have repeated hit in case recognised word in previous line

had no space typed at the end of line.

atoi conversion gives us raw ascii output so that one can set some rules and act.

That construct would end up different in case you wanted to recognise a word when it

gets separated by space or new line from the rest.

Foam Okiji's icon

Foam Okiji

7月 21 2024 | 5:06 午後

Yes! Thanks, Will. Just to be clear, I understood that the challenge was with the text side of things. In terms of integrating this patch into other performance tasks, such as sample scrubbing, intra-sample selection, time manipulation, etc, I'm more familiar with using the groove object. I will need to learn how to do these with sfplay. I'm sure it won't be a problem. I'm just unfamiliar at the moment. But the efficiency of sfplay is definitely attractive.