Supercharge HiseScript with SNEX
-
:couple_with_heart_man_man:
-
Looks interesting, will we have access to it from within the standard MIDI callbacks or will it live in its own processor module?
-
Yes, you can call it like any other function in your script. Maybe I'll add an option to autoforward the MIDI callbacks directly to a given SNEX class so it reduces the (small) overhead of calling into HiseScript altogether, but this works already:
snex.struct MyProcessor { int isFastNote() { // A small selection of API calls will be available in SNEX double thisTime = Engine.getUptime(); int isFastNote = (thisTime - lastTime) < 0.5; lastTime = thisTime; return isFastNote; } double lastTime = 0.0; }; const var obj = snex.make<MyProcessor>(); function onNoteOn() { if(obj.isFastNote()) Console.print("Fast Note"); }
-
@Christoph-Hart said in Supercharge HiseScript with SNEX:
snex.struct MyClass { // span<T, Size> is a fixed sized array span<float, 44100> data; void process() { // a range-based loop over the entire array // (the & means "reference to" so you operate directly on the array) for(auto& s: data) s = Math.max(s > 0.5 ? (Math.random() + Math.sin(s)) : 2.0f, 50.0f); } };
So this is saturation by iterating over the 44100 sample buffer? I take it this does nothing to the audio until you call obj.process()?
Either way DSP like this is
-
Sounds great
-
@iamlamprey said in Supercharge HiseScript with SNEX:
So this is saturation by iterating over the 44100 sample buffer? I take it this does nothing to the audio until you call obj.process()?
Either way DSP like this is
Oops I think it's actually just a random number generator for performance comparison.
How would we apply an algo to a sample/block/buffer with this? AKA teach me how to DSP so I can forever leave JUCE in my rearview
-
So cool! Canβt wait to try it
-
@Christoph-Hart Anxious to to get this working, but it does not compiles on Mac :(
snex_ArrayTypes.h
-
Yeah itβs not commited yet, so you need a bit more patients (sooooon ;)
-
@Christoph-Hart ok, just copy paste this
git add .
git commit -m "other DSP dev frameworks are death"
git push