Get Root Note
-
It's actually part of the panel class (not 100% sure why).
-
@d-healey
I'll try that out tomorrow.
Thank you David. -
This does not work.
Question in the round
Has anyone ever managed to display the "RootNote" of the sample loaded in the AudioLoopPlayer in the GUI?Or the value of any knob of a module?
-
@MikeB Did you try a timer? Maybe have the timer run when loading a new audio file and then turn itself off after a second or so.
-
@DanH No - but David advised against this.
That would not be a Healeyfied method:-)
-
@MikeB Seems like a perfectly reasonable method to me!
However I'm not confident the preload callback would work - did you test that function yet?
-
@DanH How would you trigger the timer only when the audio file is loaded? If you can trigger the timer under such a condition then that would be fine, but then why would you need the timer?
-
@d-healey good point re needing the timer if you can trigger a callback when the file is loaded (assuming the root note is instantly assigned upon loading)
-
@DanH In my plug-in, the user can select the desired sample from 100 by means of a knob, and this four times for four AudioLoopPlayers.
A new sample is loaded with each scrolled value.
So I can scroll through the samples in 1 second with the mouse wheel.If I set a timer here, it won't follow - I think.
-
@MikeB well if you already have a callback for loading samples (via your knob) can you not get the value of the root note and update the ui control in the knob callback?
-
-
@DanH Go to the beginning of the entry.
We were already here. That was the first and actually sensible thought, but it doesn't work. Or at least I (beginner) and David (Jedi Knight) can't solve it. -
@MikeB snippet?
-
@MikeB It does (should) work. But your original post didn't explain what you were trying to do :p This is the first mention we've had of a sample selector on your UI. Post a snippet with that.
-
@d-healey @MikeB You've highlighted a good point here Mike, a callback upon loading an audio file in the audio loop player would be useful, if only to update the root note ui control, because otherwise the user might think the root note on the ui is the actual root note, which in many cases it isn't @Christoph-Hart
It's caught me out a few time for sure
-
@d-healey it works.
Thanks guys - solved - now I have only 1.234 problems until the completion of my first PlugIn :-)
It will - day by day//Start Knob-SampleSelector---------------------------------------------------------------------------------------------------------------------- inline function onSampleSelector_Knob1Control(component, value){ VariationID = parseInt(value-1); //Console.print("Variation" + "{PROJECT_FOLDER}"+Instrument[InstrumentID]+"/"+Sample[VariationID]); Synth.getAudioSampleProcessor("Audio Loop Player1").setFile("{PROJECT_FOLDER}"+Instrument[InstrumentID]+"/"+Sample[VariationID]); knb_Root.setValue(AudioLoopPlayer1.getAttribute(AudioLoopPlayer1.RootNote)); knb_Root.changed(); }; Content.getComponent("SampleSelector_Knob1").setControlCallback(onSampleSelector_Knob1Control); //End --------------------------------------------------------------------------------------------------------------------------------------
-
@DanH I think it would be sensible if it used the loading callback that we already have.
-
It works like this in both directions now.
- when changing the sample, the RootNote of the sample is displayed.
- if I change the value of the knob, it is played with a new root note.
Wonderful
inline function onknb_RootControl(component, value) { if(value) AudioLoopPlayer1.setAttribute(AudioLoopPlayer1.RootNote, value); }; Content.getComponent("knb_Root").setControlCallback(onknb_RootControl);
-
@MikeB You don't the
if (value)
part. -
Next challenge in this topic!
Is there already a snippet (or 2 lines of code) with the definition or the conversion of the note numbers into notes e.g. 60 = C3 or C4 as the case may be?
So that the root note number is no longer displayed here (60) but the actual note C3.