Pure Data

Here’s a dedicated topic for Pure Data with Daisy!


I have a pd2dsy converter in the works that will convert a vanilla pd patch into libdaisy-based source code, using HVCC (the heavy compiler).

The end-goal is for a non-developer friendly tool that can convert pd patches to a binary that can be flashed to daisy without the need for any editing of the code.

Many features still need to be added like control handling and more, but I have tested running a few very simple patches, and manually mapping controls to the pd parameters.

I’ll add it to the electro-smith ecosystem of Github repos this week. So anyone can try to use it in its current state, or help out if they want!

14 Likes

This is way up my alley. My Arduino style programming skills are, as of this time, terrible.
I can make Max/MSP do fun tricks though and PD is… close enough.
I imagine implementing the screen on the Daisy Patch will be difficult/interesting.

1 Like

Yeah, figuring out how we want to map the display to PD will be a bit tricky. But might be doable with just using a table with a specific attribute name.

There will also be support for code export from the gen~ object in Max/MSP soon!

3 Likes

Hey Stephen, looking forward to using this pd2dsy tool! Any chance you could upload it to the github repos?

I’m very interested in using the pd2dsy tool as well. Any idea when this might be available? Working on a project with PD right now and am trying to decide between Daisy or Raspberry Pi right now. If the library is still being developed I’ll probably circle back to the Daisy once it’s ready. Thanks!

I didn’t have a chance over the weekend. But I should be able to get the repo up by the end of tomorrow! :smile:

As I mentioned above it’s still in a very early state that requires modifying the source generated by hvcc (as it is, it’s pretty much just a wrapper around hvcc), and there are many things to work out for mapping controls. So it may still be a little while before it’s working as a functional pd->daisy converter with no manual intervention.

1 Like

@shensley that sounds great! It’s cool if there is a bit of manual intervention. As long as there are some examples that show us how to map the controls ourselves in the LibDaisy code!

Hey all, we just made the pd2dsy repo live.

I need to find the example I made of a working conversion, or make a new one.

But the README goes over its current (limited) functionality along with a list of next steps for making it a bit more usable. :smile:

2 Likes

Thank you! Stoked to play around with it

Sounds really great with the script :slight_smile:

Using PD patches on Daisy is why I bought it , so I look forward to see where this goes over time :slight_smile:

Would love to see an example of how to implement the compiled hvcc patch into the Daisy, as it is now, without the script :slight_smile:

3 Likes

@Jaffasplaffa

We’re working on expanding the script, and will be doing more in the next few weeks.

There is a work branch on the repo that now has a working example. Early next week we’ll test/get that merged in and keep moving forward with control integrations, etc.

4 Likes

Hey all,

we just merged an update to pd2dsy that generates functional libdaisy code.

There are a few examples included that are fairly simple, but illustrate using the basics of controls.

A lot of this is covered in the README, but you will need python 2 (due to hvcc requirements) installed, and you’ll need to clone the repo with --recurse-submodules or run git submodule update --init after cloning to get hvcc and libdaisy.

After that, you can run something like:

python pd2dsy.py -b <board> yourpatch.pd

where board is either seed, pod, or patch (petal and field will be added shortly as well).

This creates a folder containing a Makefile, and a cpp file that can be built and run immediately or manually edited.

The README covers how to configure controls within your pd patch.

For compilation details, etc. see the " Setting Up Your Development Environment" section of the wiki

Happy hacking! We’ll keep updating this thread as more progress occurs!

2 Likes

GREAT i will test it over the weekend :smile:

Has anyone gotten this to compile and work correctly? I’m actually not able to compile any of the examples “out of the box”. It looks like there is a variable mis-match for the audiocallback. Even just running the saw_test I get the following error that prevents me from compiling:

saw_test.cpp: In function ‘int main()’:
saw_test.cpp:33:26: error: invalid conversion from ‘void ()(float**, float**, size_t)’ {aka 'void ()(float**, float**, unsigned int)’} to ‘dsy_audio_callback’ {aka ‘void ()(float, float*, unsigned int)’} [-fpermissive]
33 | hardware->StartAudio(audiocallback);
| ^~~~~~~~~~~~~
| |
| void ()(float**, float**, size_t) {aka void ()(float**, float**, unsigned int)}
In file included from daisy_boards.h:7,
from saw_test.cpp:3:
…/…/libdaisy/src/daisy_seed.h:64:40: note: initializing argument 1 of ‘void daisy::DaisySeed::StartAudio(dsy_audio_callback)’
64 | void StartAudio(dsy_audio_callback cb);
| ~~~~~~~~~~~~~~~~~~~^~

If I change the following code from:
void audiocallback(float **in, float **out, size_t size)
{
hv.process(in, out, size);
ProcessControls();
}

To:
void audiocallback(float *in, float *out, size_t size)
{
hv.process(&in, &out, size);
ProcessControls();
}

It compiles - and I get a saw wave - but in the pod_test example - I only get envelopes generated from button 1 and the audio comes out of both speakers.

I wasn’t able to get any of my own projects to export correctly either. It would initially provide an error saying that it couldn’t create the directory. If I create the directory for it - it creates the *.cpp, MakeFile, and daisy_boards.h file, but no “c”, “hv”, or “ir” folders. I tried running my patch through Heavy as a standalone python script and then tying the pieces together - but I wasn’t getting any sound.

Let me know if other people are having different experiences - maybe I’m missing a step or maybe I have an outdated / wrong version of libdaisy.

Ok - messed around a little bit more. I was able to get a passthrough pd patch to work (adc>dac) and a passthrough patch with a volume control (mapped to knob1 on pod).

I tried a simple delay patch using only PD vanilla objects ([delwrite~] and [delread~]) and I did get some audio - but it was overwhelmed with really bad noise. Are there any object limitations that are different from hvcc in this iteration? HVCC has example pd patches that include [delwrite~] and [vd~] - though maybe [delread~] is unsupported?

We’ll look into the folder generation stuff, as well as the delay noise and such. This is still very much in progress, and we haven’t tested all of the pd objects specifically in the context of daisy yet. It could be something with the way the generated code is using memory for delays, etc.

Also, its worth making sure that libdaisy is up to date (you can git checkout master; git pull from inside of the libdaisy folder, or run git submodule update from outside the pd2dsy folder. The addition of the non-interleaved callbacks (i.e. callback(float**, float**, size_t) is fairly recent.

Ah, noted! I’ll make sure to update libdaisy, then and try again. Thanks!

Update here - Updating libdaisy completely fixed the issue with my simple delay patch as well as the stereo issue I was experiencing with the pod_test file. So, that was definitely an issue on my side. Many thanks @shensley!

The pd2dsy folder issue is probably still worth looking into - but it’s a pretty simple workaround to just make the folder ahead of time and run pd2dsy and hvcc separately.

1 Like

Just archiving this for future generations: we were able to solve the folder issue by running the python script with sudo!

1 Like

Hi,
How can I use the command: python pd2dsy.py --board <BOARD> <FILE>.pd?
I can’t convert my pure data patch into cpp.
Does anyone know how to do?
Thanks