Welcome to %s forums

BrainModular Users Forum

Login Register

What to use for PSingle?

I need help on a Patch
Post Reply
woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 12 Jun 2013, 16:47

I have a script based on the simple audio example script from v5. But it requires some values of type PSingle.

V6 does not recognize this type. What do I use instead? There are no audio example scripts that I can see in the new browser....
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 12 Jun 2013, 22:42

PSingle is a pointer type, and to me it seems that pointer types aren't allowed in the new version (so far?). Using ^Single instead of the predefined PSingle type didn't help. GetDataPointer() is also missing.

Here's an attempt at doing the old audio example in a different way:

Code: Select all

/////////////////////////////////////////////
// Audio Volume
// Simple Audio Volume Script
////////////////////////////////////////////

// parameters declaration
var input    : Tparameter;
var output   : Tparameter;
var gain     : TParameter;


// initialisation : create parameters
procedure init;
begin  
 Input := CreateParam('In',ptaudio);
 output := CreateParam('out',ptaudio);
 gain := CreateParam('gain',ptDataFader);          
 
 SetIsOutPut(Input,false);
 SetIsOutPut(Gain,false);        
 SetIsInPut(Output,false);
 SetMin(gain,0);
 SetMax(gain,1);
 Setvalue(gain,1); 
 SetLength(output,BLOCSIZE); 
                                     
end;


// Global variables
var i            : integer;                   
//var pin,pout : PSingle;
var g : single;

//////////////////////////////
// main proc
//////////////////////////////
procedure Process;
begin
 //pIn := GetdataPointer(0); 
 //pOut := GetdataPointer(1);
 g := GetValue(2); 

 for i := 0 to BLOCSIZE-1
 do begin
   //pout^:= pin^*g;
   //incptr(pin);
   //incptr(pout)
    SetDataArrayValue(1, i, GetDataArrayValue(0, i)*g);   
 end;                                                    
end;
This works, but uses a lot CPU.

I tried the same in V5, and there both versions of the script worked, and both used negligible CPU.
Bjørn S

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 12 Jun 2013, 22:54

Because of the cross platform implementation (WIN,OSX,64) we use a new script engine which is less CPU friendly.
That's why the the V5 script-pointers capabilities are not available in Hollyhock.
No solution actually except rewrite a new script engine and it could take years...

But we made a particular effort to simplify the SDK. A user module is a very good option for intensive data manipulations?

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 13 Jun 2013, 08:32

Okay, that's good to know. I'll lay off the scripts. And I'll look into the SDK.

But for now, I realized my script doesn't need to work in the audio path anyway, it can just create a control signal for a volume module.

But I may just use modules anyway if the script engine is not cpu friendly. I mostly did it to save CPU!

cheers,
-e
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 13 Jun 2013, 08:52

Wow, no joke!

A simple midi change channel script takes ..33% on my quad-core i7!

16 of those, that's 5% CPU just to change midi channels.

Seems like a set of basic midi tools would be a good use for the SDK. Or nice to have as basic modules....

I'll see if it's cheaper to convert to and from midi using modules.

EDIT: that brings it down by about half. Guess that's the better choice.
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 13 Jun 2013, 14:42

,;:, damned macs^^ :p

seamus
Member
Posts: 484
Contact:

Unread post by seamus » 14 Jun 2013, 12:01

I replaced some midi scripts with the midi transformer and my patch became 50% more efficient.
Thanks for the tip!

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 14 Jun 2013, 13:26

check also the Midi multi-filter

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 14 Jun 2013, 13:28

slowly I'll replace all midi scripts by modules which are 100x faster

seamus
Member
Posts: 484
Contact:

Unread post by seamus » 14 Jun 2013, 15:24

Thanks senso!

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests