Saving Values in spark ar

Hey guys, I hope you all doing great.
I have a real quick but important question.
How can we save a variable value in spark ar? For example, the position of face mesh, Which is changing every second and in a specified moment, I just want to save that position value.

I appreciate your h

Hey, same!

Unfortunately I’m not really sure how! This is definitely more for @josh_beckwith or @Tomas_Pietravallo!

I’d say it’s doable in script, I just recently played with one that seemed to do something similar, it outputs the positions of the facemesh for every second of video played in the console :

//FaceTrackingRecording by @Juanmv94
const Diagnostics = require('Diagnostics');
const Patches = require('Patches');
const Time = require('Time');
const R = require('Reactive');

const frameRate = 1;
const numFrames = 34;
const intervalms = 1000/frameRate;

var frame=0;
var recording=new Array(numFrames);
var waiting=true;
var interval=null;

Patches.getPulseValue("start").subscribe(function() {
   if (waiting) {

function f() {
var posx=Patches.getScalarValue("posx").pinLastValue();
var posy=Patches.getScalarValue("posy").pinLastValue();
var posz=Patches.getScalarValue("posz").pinLastValue();

var rotx=Patches.getScalarValue("rotx").pinLastValue();
var roty=Patches.getScalarValue("roty").pinLastValue();
var rotz=Patches.getScalarValue("rotz").pinLastValue();

if (frame==numFrames) {
	Diagnostics.log("Recording completed! var Recording=");

I’m not sure if it’s the solution of your question, but I remember that I’ve created a patch to kinda captures the value with a pulse to trigger it.

Not sure about the accuracy since I can’t really see the real time value changes with my potato laptop. What I mean by accuracy is the tolerance of time changes between the source value that you want to pass and the moment spark identified the trigger caused by latency. The bigger the latency, the later the value passed/saved.
Also Spark doesn’t provide any information about each patch processing latency for us to do any latency/delay compensation to make timed events are synced with 99.9% precision. But I think it gets the job done. Try it. Even if it might not your solution, i hope you find it helpful.

Capture Value.arp (1.7 KB) Capture Vec2.arp (3.7 KB) Capture Vec3.arp (4.3 KB)

1 Like

That’s exactly what I did in the patch that I shared above. But i don’t really know about the time precision. have you ever tested it? Is there any perceivable/significant inaccuracy when it stores the value caused by latency? Or is it actually accurate and in sync?

Thanks Boris I really used it, actually I just found a real quick solution to do what I wantd to do but your solution helps me to do more cool things.

1 Like

Thanks for your help bro,I appreciate it.

So here is what I found to handle my little poject
Just using a randomize patch and pass the same value to start and end value (face position) and trigger it with a pulse and tada, on that moment i saved the value and i can use it later :smiley: