Patch/Load object


#1

Hi there,

I was experimenting and tried everything possible to load a patch on the sdcard.
I made a screenshot to show how it should work.
On the left upper side is the patch I uploaded on the sdcard, on the upper right is the file manager and on the lower end you see the patch I'm going live with.
It worked exactly one time and now I can't reproduce it.
The aim is to load different synth/guitareffect patches onto the sd and change them by pressing different footswitches on my hardware.
Could anyone help me please?

Thanks a lot!
Joki


#2

ok stupid mistake - I have to use the ctrl/button object.
But now next problem: how can I get it work with more than one patch/load object?
I made a second oscillator patch (OSC2), uploaded it, inserted a button and the load object.
If now I press the first button, OSC is loaded, if I press the second button nothing happens.
Sometimes the button of the second one is also black from the start when going live.


#3

Loading a patch by any other means than the live button does not make a live connection to the patch.
For loading multiple patches, there is an object in git (not in a release yet, soon...) to load a patch with a filename created with string/indexed. That way, for instance a midi program change could be used to load a patch. But I have not tested this extensively.


#4

Ok, thanks Johannes for the quick answer.
Means that it's not possible for now with more than one patch/load object?


#5

multiple patch/load objects should work too


#6


Can't get this work. Any tips?


#7

What is the name of that object?


#8

For diagnosis I suggest to add a script/script2 object to the patches that you want to load with in the script something like this:

void setup(){
   LogTextMessage("patch x loaded");
}

void loop(){
}

and maybe modify the patch/load object:
"edit object definition" in its popup menu, and change the "K-rate code" to

if ((inlet_trig>0) && !ntrig) {
   LogTextMessage("loading patch attr_filename");
   LoadPatch("attr_filename"); 
   ntrig=1;
}
else if (!(inlet_trig>0)) ntrig=0;

#9

patch/load fn
https://raw.githubusercontent.com/axoloti/axoloti/master/objects/patch/load%20fn.axo


#10

I forgot to mention that LogTextMessage will post the string to the Axoloti log screen, this does not require a live connection to the patch.


#11

This is what I get:

Generate code complete
Start compiling patch
RM
rm -f /Users/jokischaller/Documents/axoloti/build/xpatch.o /Users/jokischaller/Documents/axoloti/build/xpatch.elf /Users/jokischaller/Documents/axoloti/build/xpatch.bin /Users/jokischaller/Documents/axoloti/build/xpatch.d /Users/jokischaller/Documents/axoloti/build/xpatch.map /Users/jokischaller/Documents/axoloti/build/xpatch.lst
APP
arm-none-eabi-g++ -nostdlib -fno-exceptions -fno-rtti -mcpu=cortex-m4 -O3 -fomit-frame-pointer -falign-functions=16 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wunused-parameter -DCORTEX_USE_FPU=TRUE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB -std=c++11 -DARM_MATH_CM4 -D__FPU_PRESENT -H -I/Applications/Axoloti.app/Contents/Java/CMSIS/Include -I/Applications/Axoloti.app/Contents/Java/chibios/os/ports/common/ARMCMx/CMSIS/include -I/Applications/Axoloti.app/Contents/Java/chibios/os/ports/common/ARMCMx -I/Applications/Axoloti.app/Contents/Java/chibios/os/ports/GCC/ARMCMx -I/Applications/Axoloti.app/Contents/Java/chibios/os/ports/GCC/ARMCMx/STM32F4xx -I/Applications/Axoloti.app/Contents/Java/chibios/os/kernel/include -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/include -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32F4xx -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/GPIOv2 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/I2Cv1 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/OTGv1 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/RTCv2 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/SPIv1 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/TIMv1 -I/Applications/Axoloti.app/Contents/Java/chibios/os/hal/platforms/STM32/USARTv1 -I/Applications/Axoloti.app/Contents/Java/chibios/boards/ST_STM32F4_DISCOVERY -I/Applications/Axoloti.app/Contents/Java/chibios/ext/fatfs/src -I/Applications/Axoloti.app/Contents/Java/firmware -Winvalid-pch -MD -MP --include /Users/jokischaller/Documents/axoloti/build/xpatch.h -c /Users/jokischaller/Documents/axoloti/build/xpatch.cpp -o /Users/jokischaller/Documents/axoloti/build/xpatch.o
! /Users/jokischaller/Documents/axoloti/build/xpatch.h.gch
/Users/jokischaller/Documents/axoloti/build/xpatch.cpp: In member function 'void rootc::instanceload__2::dsp(int32_t)':
/Users/jokischaller/Documents/axoloti/build/xpatch.cpp:67:54: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
if ((inlet_trig>0) && !ntrig) {LoadPatch("OSC.BIN"); ntrig=1;}
^
/Users/jokischaller/Documents/axoloti/build/xpatch.cpp: In member function 'void rootc::instanceload__1::dsp(int32_t)':
/Users/jokischaller/Documents/axoloti/build/xpatch.cpp:103:55: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
if ((inlet_trig>0) && !ntrig) {LoadPatch("OSC2.BIN"); ntrig=1;}
^
LINK
arm-none-eabi-gcc -nostartfiles -Tramlink.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mno-thumb-interwork /Users/jokischaller/Documents/axoloti/build/xpatch.o -Wl,-Map=/Users/jokischaller/Documents/axoloti/build/xpatch.map,--cref,--just-symbols=/Applications/Axoloti.app/Contents/Java/firmware/build/axoloti.elf -o /Users/jokischaller/Documents/axoloti/build/xpatch.elf
BIN
arm-none-eabi-objcopy -O binary /Users/jokischaller/Documents/axoloti/build/xpatch.elf /Users/jokischaller/Documents/axoloti/build/xpatch.bin
Done compiling patch
Start uploading patch
bin path: /Users/jokischaller/Documents/axoloti/build/xpatch.bin
block uploaded @ 0x20011000 length 3684
Done uploading patch
Start starting patch
Done starting patch
Start locking
Done locking

If I press one of the buttons it appears:
"Axoloti says: patch x loaded"

Still can't load a different second preset :frowning:


#12

You mean, after you have triggered loading the 1st?


#13

Yes. Sometimes the button of the second is also already black.


#14

To load OSC2.bin from OSC.bin you also need to have the same loading mechanism in the OSC patch.
The ctrl/button staying black, I guess that comes from the "detach" from the live session, the button should be cleared before going live or uploading, otherwise this will trigger an immediate teleport to a new patch when going live with the 1st.

Also helpful in diagnosis may be the virtual remote control (in window menu), I believe you can load a patch from sdcard through that, and this uses the same loading mechanism.


#15

Do you mean I have to place the patch/load object into the osc patch?
Can you or someone else give me an example how to proper use this object? I suppose I am doing something completely wrong... :astonished:


#16

If you want to load OSC2 from the OSC patch, yes. Likewise, if you want to load OSC from the OSC2 patch, you also need this loading mechanism in the OSC2 patch.

After triggering patch/load, Axoloti forgets the original patch.


#17

Damn. I thought the patch/load object has to be in a separate patch where the other patches are loaded into (similar to the subpatches).
I will give it a try tomorrow.
Thanks for the help Johannes!


#18

You can make a subpatch with the patch loading mechanics, and instance this subpatch in your patches, so you only have to define the loading mechanics in a single place.

Loading a patch as a subpatch dynamically is not possible.


#19

the new controller object preferences now in github will allow you to do this without having to change all your patches. (not sure when this is being released though)


#21

How does it work? Just finished a new build from github a minut ago. Would love to test it.