Python values -> Table DAT -> CHOP samples: Is the Table DAT needed?

Here’s my complicated first solution, which didn’t even work because Constant CHOPs have a maximum of 40 channels.

My second solution works nicely, but do I even need the Table DAT? It seems like an unnecessary extra step. I just want Python values as CHOP samples.

I originally tried setting the samples manually, but the Table solution was the only one that makes sense to me currently: Setting CHOP Channels with Python

You can do this now via the script chop:

though contents will not save in the TOE, so you’ll need to regenerate upon start up, if that matters

2 Likes

Thanks, Lucas!

I tried your solution and nothing happened, but then I got it working by removing the callback DAT that automatically gets created with the Script CHOP.

Here’s how to do it with an existing array:

prime_numbers = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

op("script1").clear()
op("script1").appendChan()
op("script1").numSamples = len(prime_numbers)

for index, number in enumerate(prime_numbers):
	op("script1")[0][index] = number
2 Likes

yep sorry forgot to mention you have to take the callback off!

It runs any time the chop cooks, and if you write to it, the calback’s default code clears the results right away.