Hi,
I’m trying to trigger conditional events based on series of letters occurring during the iteration of a string.
I manage to do it with individual characters, but not with a couple of characters.
These frequencies are put in a list that feeds a synth after.
(var myString, freq, listFreq;
myString = "ACAAGTAGTCATGA";
myString.do({ arg item;
freq = case
{item = myString.finds("AA")} {freq = 300}
{item = myString.finds("AC")} {freq = 400}
{item = myString.finds("TG")} {freq = 500}
{item = myString.finds("GA")} {freq = 610};
listFreq.add(freq);
~freqList1 = listFreq;
})
)
I tried directly with a string ({item == “AA”} {freq = 300}), it does not throw any error, but it returns an empty list. With the syntax {item = “AA”} {freq = 300}, it throws a Non Boolean in test error.
I tried to concatenate the characters together ({item = $A ++ $A} {freq = 300}), but it also gives me a Non Boolean in test error.
I tried with find or findRegexp, which gives me the same error (which I think I understand because of what the methods return).
With contains, it does not throw an error, but it fills the list with only the first value (300 in this case).
Would someone have any idea?
Thanks!