Reading a table with DaisySP

Hello, @JMC64! It’s great to discover that we share an interest in this topic. I believe you can read samples from an array in a similar manner to how it’s done in Pure Data (PD).

Below is a simple code snippet example of how you can use a phasor to read samples from an array at a specific frequency. (I recommend delving into the documentation for more details, including the initialization of the phasor in the main() function and so on.)

Phasor    phs;
const int size    = 10463;

void AudioCallback(AudioHandle::InputBuffer  in,
                   AudioHandle::OutputBuffer out,
                   size_t                    size)
{
    for(size_t i = 0; i < size; i++)
    {
        float sig = sample[(uint32_t)(phs.Process() * 10463)];
        out[0][i] = out[1][i] = sig;
    }
}

However, please note that when using flash memory, you may be limited in terms of sample size. To handle larger samples, consider using an SD Card with the libdaisy abstractions library. If you intend to use your tables as oscillators, somewhat like tabosc4~ in PD, you can use SDRAM to store your tables. It’s also possible to use SDRAM for sample storage, but I’ve noticed that it significantly increases build times. I haven’t been able to figure out how to implement a file system in SDRAM.

There are some excellent resources available on working with memory and wavetables for the Daisy Seed platform, such as:

If you have any further questions or need more information, please feel free to ask!

2 Likes