writing waveforms into data object in gen~ without referring to an external buffer in max?

Yueting Wu's icon

hi !

I am trying to create a readable wavetable within gen~ using the data object

since I need the patch to work for Oopsy daisy, the patch cannot refer to any external buffers in max

The closest answer I was able to get was this post:

--using the codebox object to manually input sample values of waveforms into the data object

The OP's patch (basic waveform oscillator) works, but when trying to add new waveforms to the patch, I ran into issues:
I obtained sample values (256 samples) of the single-cycle waveforms from https://www.adventurekid.se/akrt/waveforms/ and input those values into the codebox, I received the following errors

I double checked and the list of values I put in indeed contained 256 items, so I am confused about why it "exceeded the maximum of 256"...and then I checked the amount of items in the lists that OP put in, and they actually contained less than 256 values (250&248 respectively)...so I just deleted the last few values from my list....the error disappeared but still there is something wrong:

reading OP's waveform
reading my waveform

It seems like it's reading the new waveform I put in twice as fast as it should????

I am very new to all this and not sure if I am doing something wrong here, or if there is any other ways of creating a wavetable completely within gen~

*"Datawavetable" contains OP's waveform, "datawavetable2" contains the waveform I tried to put in

datawavetable2.maxpat
Max Patch
datawavetable.maxpat
Max Patch

Tikoda's icon

Can you share how you are getting the sample values for the waveform? It must be during that process that something is going wrong, as every other part of the code is exactly the same