playNoteWithStartOffset
-
So I was browsing the API (like you do..) when I learn that this is limited to 65536 samples (so about a second) which is a big problem for me, or will be.
I have a loop player I'd like to re-implement in HISE.
It plays 4-bar loops - so these can be quite long - and I need to be able to start the play head anywhere up to (sample length - 1/16th note) - so a long way in several seconds....
Is there a way around this?
-
@Lindon Don't use dfd mode just load the whole sample into memory
-
@d-healey OK great so just like Kontakt then.
-
@Lindon said in playNoteWithStartOffset:
So I was browsing the API (like you do..) when I learn that this is limited to 65536 samples (so about a second) which is a big problem for me, or will be.
Yes I know. The problem is that the internal event type in HISE has to fit into 128 bits and I am already doing all kinds of weird bit-shifting to get all the information into this space.
Basically there are two ways of changing the offset - either via start offset in the event (works with every sound generator) or if you modulate the start offset in the sampler by adding a modulator to the sample start mod chain - this approach just scales the 0...1 to the available sample start modulation range so you will never run out of numbers :)
Now the looper is in fact the only module that can't be offset using a modulator but might require a start offset > 65536 (sine waves or other synthesised waveforms only need a tiny amount of modulation to change their phase, so there you won't run into this limitation). I'd rather think about adding a modulation chain there than redesign the entire event system.
-
@Christoph-Hart a looper is not my only scenario....
Are you saying that even if I load the entire sample in to memory I'm still stuck with this limitation? please please say no.
The looper will need very (sample) accurate positions to get it to work properly...
The granular engine (another product) can be a bit more forgiving but again needs to be able to access (start from) any position in the wav
As does the dynamic oscillator sequencing engine (yet a third product scenario) - its a kind -of cross-fading oscillator.
Without the ability to start the note playback from an off-set anywhere in the wav file then nearly ALL our products wont work in HISE, and this would be very very very very very bad.
-
Are you saying that even if I load the entire sample in to memory I'm still stuck with this limitation? please please say no.
No, as I said, the sample start modulation in the sampler can use the entire range you specify (you will bypass the streaming engine and have everything in memory, but that's the only disadvantage).
The limitation is only in the API call
Message.setStartOffset()
, which makes some use cases more simple, with the given restriction that it just works for smaller values (it's intended use case is stuff like skipping legato offsets which can be directly implemented in the legato script). -
@Christoph-Hart phew - relief .
So if I set the preload size to = -1
then I can say
playNoteWithStartOffset(0,60,120,)
??
-
Almost. You set the
SampleStartMod
property of every sample to the full length (don't bother about the preload size, the engine is smart enough to load the entire sample start modulated range into memory), then you add a modulator on the sample start mod chain where you control how much of the start phase you want to skip (just like in KONTAKT IIRC).Calling
Synth.playNoteWithStartOffset()
has the same limitation. -
@Christoph-Hart said in playNoteWithStartOffset:
Almost. You set the
SampleStartMod
property of every sample to the full length-- for every sample? That's a nightmare of repetitive work....grief. Is there some programmatic way to do this - like in Kontakt
z := find_zone("085_HipHop_Drums_Snares_01")
len := get_sample_length(z)- so I assign a modulator (what kind a constant? a script voice start ? <- what can I do in here?)
lets assume a constant (so number between 0 and 1)
How do I set this to some very very specific number of samples?
- so I assign a modulator (what kind a constant? a script voice start ? <- what can I do in here?)
-
-- for every sample? That's a nightmare of repetitive work....grief. Is there some programmatic way to do this - like in Kontakt
Go into the Sampler workspace. Select all of the samples in the mapping editor. Right click the sampleStartMod value edit box. Drag the slider all the way to the right.
-
@d-healey oh ok that bits fine then, how do I assign as tart sample of (lets say) 623458 using this modulator approach?
-
@Lindon said in playNoteWithStartOffset:
@d-healey oh ok that bits fine then, how do I assign as tart sample of (lets say) 623458 using this modulator approach?
No idea, which is why I didn't answer that bit :p I've only used unspecific offsets in my projects so far.
-
You can of course set sample properties programatically. There's a blog post called "Fun with Regex" that explains this.
If you use the modulator approach, the 0...1 value is converted to the samplestart mod range available in the sample that's about to start.
If you set them all to 623458, then just return 1.0 :)
-
@Christoph-Hart fine but setting something to a fixed sample position is not really much use to me, let me explain:
My instrument has a wav file its 4 bars at a tempo (lets say) 120 bpm. OK its a loop and I want to divide this down into "steps" - 32 of them.
The user presses play and now I need to play this loop - but I want to do so by playing slices of the wav file - so I can reorder the slices, and change tempos during the song.
Lets assume for the minute the selected pattern is the following: 1,2,3,4,5,6,7...32 - so just sequential
So first slice is easy thats at 0 offset
so playNote with a zero offset..
--- Now I have to calculate a point to send a NoteOff but thats another story...Next slice is at (file_length in samples/32) *1
So playNote with offset (file_length in samples/32) *1
next note:
playNote with Offset (file_length in samples/32) *2
next note:
playNote with Offset (file_length in samples/32) *3
etc.
This is all pretty easy to do in Kontakt... Kontakt will tell me the file_length in samples when I want it,
Kontakt will let me:play_note(60,100,((file_length in samples/32) * pattern_number),(a user-specified duration))
..and I'm done. No note off to worry about no offset to worry about
SO how would I do this in HISE?
-
oh and the blog is:
ERR_CONNECTION_TIMED_OUT
So I cant read you Regex post.
-
@Lindon Yup the blog link has been broken for some time, but all of the blog entries were moved to the forum under the blog category
Fun with Regex
This is an advanced feature that I just implemented (and you need at least version 0.984 for this). You can now change the properties of individual sample so...
Forum (forum.hise.audio)
-
@Lindon said in playNoteWithStartOffset:
This is all pretty easy to do in Kontakt... Kontakt will tell me the file_length in samples when I want it,
HISE has
AudioSampleProcessor.getSampleLength()
which might be useful here. -
@d-healey Thanks dave. I will give this a try.. so one bit sorted now how to offset dynamically..
OK looking at it I have accss to :
Sample Start
Sample Endand I have SetSampleRange - what does this do?
can I use this call dynamically ? So..
myAudioSampleProcessor.setSampleRange( (file_length_in_samples/32) *2, (file_length_in_samples/32) *3); myNoteID = playNote(60,100);
-
bump - still looking for answers about this last question...
-
No, changing the sample start like this would affect all ringing voices so it's a rather nasty hack.
I need to supply you with a proper workaround for the looper module. Given the fact that it's the only module that benefits from a sample start > 65536, it's a sensible addition.