Reading a table with DaisySP

Hello all,
Brand new here, I happily own a patch.init(). I manage to easily flash Pd patch to it…but with the limitations of hvcc.
My C is far, and C++ not yet really my cup of tea. I am looking for an example on how to play a single sample wavetable aka wavetable (I suppose it is like in Pd with a phasor and like in Bela C++ tuto) with Daisy.

Could anyone guide me ? Thank you a lot.

1 Like

Welcome!

As far as I know, there isn’t a wavetable example code available yet.

I recommend checking out this post as it links to few posts about wavetable from the past.

And that thread itself would be a good place to share what you would want out of a wavetable class as OP is looking for suggestions for class(es) that they’re planning on developing.

2 Likes

Can you explain which limitations you are running in to when trying to play with wavetables?

1 Like

Hello,
thank you all from your quick replies. The main trouble with hvcc is that it does not implement any mechanism to load a file from disk (or SD card). You have save your patch with the wave table in it on your pc and flash it to daisy…doable but quite tedious.

Still many vanilla Pd objects are not implemented in hvcc and obviously, will never be. … which is very sad as the number of embedded audio platforms is increasing and these platforms would really gain from having a fully implemented Pd.

Maybe someone will port libpd to daisy one days? ( or maybe the technical problems are too many)

1 Like

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

Once I have a promising result, which I’m aiming to achieve by the end of the week, I’ll share it with you.

1 Like

This will never be possible, there are many objects that don’t make any sense in an embedded context. While it is true that Miller has ported pd engine to run on a microcontroller (an ESP32) this is a highly specific and optimized build for his specific experimental application. And would not give any generic type of setup to use pd (it likely supports even less objects).

Eventually we do want to be able to load samples from sd-card, but this will need quite some work on different parts of the code (help is appreciated!).

2 Likes

Thank you a lot @viniciusfersil and @dreamer for your comments and guidance. I join a screenshot of the Pd patch that I am using now (I wish I could upload the patch on the forum, someone might wish to use/ improve it). It is not perfect but …it works. You can “morph” from one table to another one

PLease note that the wavetable was created with WAveEdit : 64 tables of 256 Single Cycle Sample.

My aim : to do the same in C++
Thank you for your time.

3 Likes

Is there any progress on Wavetables? I was also looking at the Github request thread.