Using a key to remove an index from coll

Paul's icon

Hi there, I'm making an interactive sound installation where ascii data is sonified in Max. I'm getting the data through the coll object, which has been going fine. The issue that has fried my brain involves removing ascii data in coll, prior to dumping it. When storing this data in coll, the ascii value is the index, and the amount of times that the ascii value is pressed is the value.

I have been trying to work out how to remove a value from the previously inputted index in coll whenever a particular index ('backspace' or acsii 127) is inputted.

I've attached the relevant part of the patch - sorry I have no prior coding experience so please excuse my piecemeal approach! While the actual patch uses all the letters of the alphabet, the attached one is set up as an example, so that you input 'a' 'b' or 'c' from textedit into histo, then coll. It then routes the relevant acsii's quantity so that it can be used in another part of the patch. I am trying to make it so that, upon pressing 'backspace', the previously inputted acsii value is banged to a counter which minuses from the quantity of the previously inputted acsii value, each time that 'backspace' is pressed. Ugly, but the only way I have been able to think of implementing it. Another issue is that this method doesn't address that it will remove the previous letter once, without acknowledging the amount of times that the previous letter was pressed. My goal is to have the values and indexes correspond to the amount of times you have pressed the relative keys on the keyboard, while also taking into account any values that have been removed by 'backspace'. This process ends when 'enter' is pressed, which then dumps and clears coll so that the next part of the patch can begin.

I'm sure it is something simple, but I just can't get over the conceptual hurdle. My Max experience largely involves having written some of my own patches and having completed all the Max Tutorials. Any help or suggestions would be much appreciated. Many thanks!

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

Paul

Paul's icon

Hi, any suggestions? :)

Rick's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'd edit the list first then sent that to coll or histo if needed. Something like this...

ak's icon

Hello Paul, I would use [table] for what you described. If you want to count the number of occurrence of each character in textedit, use Rick's solution.

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

Paul's icon

Many thanks Rick and AK! Your examples have cleared it up for me, much appreciated :)