Granulator audio file
-
@rzrsharpeprod use a broadcaster to "know" when the user has dropped a file on the Audio player, get the file path - load into the granulator...
heres what one of my broadcasters for this looks like:
const var FileLoadBroadcaster1 = Engine.createBroadcaster({ "id": "File Watcher1", "colour": -1, "args": ["processorId", "fileIndex", "value"] }); FileLoadBroadcaster1.attachToComplexData("AudioFile.Content", // event type "yourAudiofileID", // processor id 0, // index of slot "Loop Player Source"); // metadata inline function getTextValue(indexInList, // the index of the component (here -1 because no array) processorId, // the arguments of the broadcaster fileIndex, value) { // value here should be the file name... Console.print("user dropped:"+ value); // you probably want to load the granulator here.... }; FileLoadBroadcaster1.addComponentPropertyListener("yourLoopWidgetNameHere", // target component (single or array) "text", // target property "Update Text Label", // metadata getTextValue); // conversion function
-
@Lindon Amazing, thankyou. I will have a look at this properly when I get home and give it a go.
Thankyou , much appreciated.
I may be back with questions I'd imagine :)
-
@Lindon
Hi, I have played with this for a little bit over the past few days and I don't really understand what it is doing so am struggling to link it to the relevant parts of my project.Would you be able to show me it in a simple snippet so that I can see how the parts of the script reference the various components etc so that I can get a better understanding of the relationships and what part if the script is calling what etc?
-
@rzrsharpeprod said in Granulator audio file:
@Lindon
Hi, I have played with this for a little bit over the past few days and I don't really understand what it is doing so am struggling to link it to the relevant parts of my project.Would you be able to show me it in a simple snippet so that I can see how the parts of the script reference the various components etc so that I can get a better understanding of the relationships and what part if the script is calling what etc?
OK with some overview general comments;
// We create a broadcaster object...... const var FileLoadBroadcaster1 = Engine.createBroadcaster({ "id": "File Watcher1", "colour": -1, "args": ["processorId", "fileIndex", "value"] }); // We tell it what sort of thing we want it to be "listening" for and broadcasting about.... // in our case the user dropping a wav file on an Audio Player.. FileLoadBroadcaster1.attachToComplexData("AudioFile.Content", // event type "yourAudiofileID", // processor id 0, // index of slot "Loop Player Source"); // metadata // We define a function that needs to be called when the thing we are broadcasting about happens... // in our case when the Audio Players contents are changed inline function getTextValue(indexInList, // the index of the component (here -1 because no array) processorId, // the arguments of the broadcaster fileIndex, value) { // value here should be the file name... Console.print("user dropped:"+ value); // you probably want to load the granulator here.... }; // we attach the Audio Player to the broadcaster,, and point at the function (we just wrote) that we want to see called when the event happens.. FileLoadBroadcaster1.addComponentPropertyListener("yourLoopWidgetNameHere", // target component (single or array) "text", // target property "Update Text Label", // metadata getTextValue); // conversion function
You should go watch Davids Broadcaster video...it helped me.
-
-
@Lindon Thankyou, I will try and apply this tonight and watch David's video as well and hope that helps as I am not really understanding how to make it work even with the notes you added.
It's calling the actual granulator and the ID of the file that I am struggling with most of all.
The granulator is in a scriptFX module, it will be built as a DLL at some point but can it be called easily enough by simply referencing the module and the name of the granulator eg ScriptFX.granulator1?
The "yourAudiofileID"/processor id is the other thing I am struggling with as obviously it can be any file that the user drops in so I don't know what to put in the "yourAudiofileID" part.
Is there some of wildcard or variable that can be entered here to represent the random file or is there a specific reference I need to put in for Audio Loop Player?Then once the above is sorted, I have to make sure it loads that same file into the granulator which is ultimately what I want. It may or may not do that, I will find out once I have worked through the above.
-
@rzrsharpeprod so..
you've got a widget in the Ui the the user can drop an audio file on to... = yourLoopWidgetNameHere
..and you've got some sort of processor in the back end that "processes" files.... = yourAudioFileID
Note: I've only ever done this with LoopPlayers and AudioWaveforms - so the granulator in you example might be a bit different - @Christoph may be able to clarify this..
-
@Lindon said in Granulator audio file:
@rzrsharpeprod so..
you've got a widget in the Ui the the user can drop an audio file on to... = yourLoopWidgetNameHere
..and you've got some sort of processor in the back end that "processes" files.... = yourAudioFileID
Note: I've only ever done this with LoopPlayers and AudioWaveforms - so the granulator in you example might be a bit different - @Christoph may be able to clarify this..
Right ok so the yourAudiofileID is the name of the LoopPlayer in my project? That makes more sense, I was thinking it was some reference to the actual file somehow.
So now filling all of that in correctly, what do I need to fill in for the target property to avoid the error I am getting?
Sorry for all of the questions, I am struggling to fully understand what I need to do and what it is trying to do.
I can't seem to wrap my head around what it is doing try as I might as I am expecting to see some 'get file name', 'load file' type functions in there but as there aren't any I just don't understand and it is making me feel dumber than usual haha -
@rzrsharpeprod said in Granulator audio file:
@Lindon said in Granulator audio file:
@rzrsharpeprod so..
you've got a widget in the Ui the the user can drop an audio file on to... = yourLoopWidgetNameHere
..and you've got some sort of processor in the back end that "processes" files.... = yourAudioFileID
Note: I've only ever done this with LoopPlayers and AudioWaveforms - so the granulator in you example might be a bit different - @Christoph may be able to clarify this..
Right ok so the yourAudiofileID is the name of the LoopPlayer in my project? That makes more sense, I was thinking it was some reference to the actual file somehow.
So now filling all of that in correctly, what do I need to fill in for the target property to avoid the error I am getting?
Sorry for all of the questions, I am struggling to fully understand what I need to do and what it is trying to do.
I can't seem to wrap my head around what it is doing try as I might as I am expecting to see some 'get file name', 'load file' type functions in there but as there aren't any I just don't understand and it is making me feel dumber than usual hahaYour AudioWaveform will be connected to your granulator processor - and it will do this file loading - or so I am assuming - not a granulator user as I say just an AudioLoopPlayer user - but in any case - you have a widget in your UI that allows the user to drop audio files, and here you have a broadcaster that offers you a way to process the text rendition(path) of this "drop activity" in any way you want....I assume you will want to load it into your granulator somehow...if its not doing it automatically..
-
Maybe I explained poorly in the beginning. In my case the waveform in the UI is connected to the loop player not the granulator,
Basically I have the loop player & the granulator but in the UI it is just the waveform for the loop player which the user can drag and drop the wav file into. The granulator is hidden or at least has no waveform in the UI, only some controls that the user can use to tweak the granulator.
What I want to be able to do but can't figure out how is for the user to drop the file into the loop player waveform but also to load that same file into the hidden granulator at the same time so that a granulated version of that file can then be blended by the user.
Basically, I don't want the user to have to load the same file twice - once into the loop player and once into the granulator as this seems like a poor user experience and feels like something that should be possible via scripting but I am struggling to figure it out.
Sorry if I didn't make that clear in the beginning
-
@Lindon I just found this thread which seems to be exactly what I am looking for.
https://forum.hise.audio/topic/7812/audioloop-player-granulator-file-handling/4?_=1722250501048
I shall try this out when I get home but from reading it through it looks like it should give me enough to get to where I need to get to and build from there.