Custom lv2 is not saving preset information correctly in the .json file under /zynthian/config/jalv

Thanks! I’m not going to do anything with it for weeks so no rush.

I’ll definitely take you up on your offer for help when I get to that point!

I wish Heavy supported CSound or Supercollider. Part of the thing I’m working on now uses a bank of Karplus-Strong algorithms in parallel and PD vanilla turns out to not be very good for K-S (at least not at my skill level). I didn’t know until I was pretty far along that there’s some inherent latency when you feed the output of a delread~ object back into the matching delwrite~ that limits how low the tuning of the k-s algorithm can go before it stops working right.

Hi @LagoonCity ,
attached, please find the rewritten compilation script for a puredata patch fulfilling the restrictions described under hvcc.
Best practice would be to create a directory with all your files in there. Also you’d need a virtual python environment (see User Guide - virtualenv) running in this directory.

Copy the attached script to this directory, edit the script and use custom values (see comments inside the script), make the script executable.
You’d need the json file describing the patch for hvcc (see hvcc/docs/03.gen.dpf.md at develop · Wasted-Audio/hvcc · GitHub).

Then run the script and it should compile at least on your linux desktop and zynthian. For zynthian you could also use special directories, described in the installation script - just uncomment as you need it.

I will publish this script under GitHub - gitnob/pd_to_zynthian_oram: development environment for pd patches later on.
compile_lv2_from_pd.sh (3.8 KB)

#!/bin/bash

# Custom directory for temporary storing all necessary files
# use $ZYNTHIAN_PLUGINS_SRC_DIR within zynthian
#BASE_SRC=$ZYNTHIAN_PLUGINS_SRC_DIR
BASE_SRC=$PWD

# Custom name of temporary working directory to be used
WORKING_SRC=Pd2LV2Src

# Custom name of temporary compilation directory to be used
PD_2_LV2=pd_2_lv2

# Customization of puredata patch information
# PDFILE=$BASE_SRC/$WORKING_SRC/--PATH/TO/MAIN/PD/PATCH/EXAMPLE.pd--
# METAFILE=$BASE_SRC/$WORKING_SRC/--PATH/TO/ACCOMPANYING/JSON/FILE/EXAMPLE.json--
# LV_NAME=LV2Name
# LV2_URI="lv2://unique.lv2.identifier/LV2Name"		
# LV_COPYRIGHT="GPLv3"
# HVLIB=./lib/heavylib/

# For perfomix it is like
#
PDFILE=$BASE_SRC/$WORKING_SRC/Perfomix/Perfomix.pd
METAFILE=$BASE_SRC/$WORKING_SRC/Perfomix/Perfomix.json
LV_NAME=Perfomix
LV2_URI="lv2://nobisoft.de/Perfomix"		
LV_COPYRIGHT="GPLv3 2024 Gaggenau Nobisoft"
HVLIB=./lib/heavylib/

# Create the temporary working directory
cd $BASE_SRC
if [ ! -d "$WORKING_SRC" ]; then
	mkdir "$WORKING_SRC"
fi

# Create puredata source directory and fetch heavylib tools and the perfomix (puredata) code
cd $WORKING_SRC

# Compilation environment
mkdir $PD_2_LV2

# Fetch puredata code from github or cp from another source
git clone https://github.com/gitnob/Perfomix.git
# cp -r /PATH/FROM/ANOTHER/PD/SOURCE .

# Enter compilation environment directory
cd $PD_2_LV2

# Install hvcc in the actual activated virtual environment
# or stop executing, if no virtual environment exists
if [ "${VIRTUAL_ENV}" == "" ] ; then
	echo Please activate virtual python environment before continue. Stopping script.
	exit 1
fi
# pip install hvcc
pip3 install hvcc
if test ${?} != 0; then
	echo "Installation of HVCC ('pip3 install hvcc') failed."
	exit 3
fi
echo "Heavy compiler environment (HVCC) installed."

# clone heavylib
if [ ! -d "./lib/heavylib" ] ; then
	git clone https://github.com/Wasted-Audio/heavylib.git ./lib/heavylib
	if test ${?} != 0; then
		echo "Cloning of hvcc repository failed. Stopping script."
		exit 4
	fi
echo "Heavylib patches (heavylib) for puredata installed."
fi

# Clone DPF environment into gen/dpf
if [ ! -d "./gen/dpf" ] ; then
	git clone https://github.com/DISTRHO/DPF.git ./gen/dpf
	if test ${?} != 0; then
		echo "Cloning of DPF repository failed. Stopping script."
		exit 4
	fi
fi
echo "Succesfully installed DPF environment."

# Clone DPF widgets environment into gen/dpf-widgets
if [ ! -d "./gen/dpf-widgets" ] ; then
	git clone https://github.com/DISTRHO/DPF-Widgets.git ./gen/dpf-widgets
	if test ${?} != 0; then
		echo "Cloning of DPF widgets repository failed. Stopping script."
		exit 4
	fi
fi
echo "DPF widgets repositories installed."

echo "Succesfully created development environment."

# generating hvcc files
echo Creating hvcc compiler code with the following command:
echo hvcc "$PDFILE" -o gen -n "$LV_NAME" -p "$HVLIB" -g dpf --copyright "\"$LV_COPYRIGHT\"" -m "$METAFILE"
hvcc "$PDFILE" -o gen -n "$LV_NAME" -p "$HVLIB" -g dpf --copyright "$LV_COPYRIGHT" -m "$METAFILE"
if test ${?} != 0; then
	echo "Error generating hvcc code. stopping."
	exit 5
fi

# compiling the C code
cd gen
make
if test ${?} != 0; then
	echo "Error compiling lv2. stopping."
	exit 6
fi

# Optionally: Copy custom ttl parameter file to lv2 directory
# cp $BASE_SRC/$WORKING_SRC/Perfomix/*.ttl bin/Perfomix.lv2/

# Copy resulting lv2 directory to destination folder (Zynthian specific)
# cp -r bin/Perfomix.lv2 $ZYNTHIAN_PLUGINS_DIR/lv2/
cp -r bin/$LV_NAME.lv2 $BASE_SRC		# for developing issues

# Copy optional preset directory to destination folder (Zynthian specific)
# cp -r $BASE_SRC/$WORKING_SRC/Perfomix/Perfomix_Default.preset.lv2 $ZYNTHIAN_MY_DATA_DIR/presets/lv2/

# cd to $BASE_SRC and remove source directory completely (optional clean-up)
# be careful to have your compiled lv2 directory been copied to your destination
cd $BASE_SRC
rm -rf $WORKING_SRC

Any testers? Good luck.
Regards

1 Like

Thanks! I’ve been planning to start a Vangelis card for a while, I’ll find time over the next couple days to do that and set this up on it too.

Not that I have any patches ready to test it with.