HISE Docs

Sample

Functions for doing something with a single samples selected from a Sampler. You can get and filter the array of samples from the sampler with one of these functions:

const var Sampler1 = Synth.getChildSynth("Sampler1"); // Script reference to Sampler module

const var sampler_obj = Sampler1.asSampler(); // Sampler object

const var sample = sampler_obj.createSelection("foley").pop(); // single sample from regex array

Console.print(sample.get(sample.FileName));


Class methods

deleteSample

Deletes the sample from the Sampler (not just this reference!). Edit on GitHub

Sample.deleteSample()



duplicateSample

Duplicates the sample. Edit on GitHub

Sample.duplicateSample()



get

Returns the sample property.

Sample.get(int propertyIndex)


Attribute Name escription
FileName he file name
Root he root note
HiKey he highest mapped key
LoKey he lowest mapped key
LoVel he lowest mapped velocity
HiVel he highest mapped velocity
RRGroup he group index for round robin / random group start behaviour
Volume he gain in decibels.
Pan he stereo balance (-100 = left, 100 = right)
Normalized nables / disables Autogain to 0dB for all samples.
Pitch he pitch factor in cents (+- 100). This is for fine tuning, for anything else, use RootNote.
SampleStart he start of the sample.
SampleEnd he end sample
SampleStartMod he amount of samples that the sample start can be modulated.
LoopStart he loop start in samples. This is independent from the sample start / end (so 0 is the SampleStart value and not the beginning of the file , but it checks the bounds.
LoopEnd he loop end in samples. This is independent from the sample start / end, but it checks the bounds.
LoopXFade he loop crossfade at the end of the loop (using a recalculated buffer) LoopEnabled rue if the sample should be looped.
ReleaseStart he release start value. A value of 0 disables the feature.
LowerVelocityXFade he length of the lower velocity crossfade (0 if there is no crossfade).
UpperVelocityXFade he length of the upper velocity crossfade (0 if there is no crossfade).
SampleState his property allows to set the state of samples between Normal(0) and Purged (1)
Reversed hether the sample is reversed.

Example to print the SamplEnd of all samples:

const selection = Synth.getChildSynth("Sampler1").asSampler().createSelection(".")` //Array of `Sample` objects.
`for (sample in selection){
  Console.print(sample.get(Sampler.SamplEnd));
}

Note that attribute names belong to the Sampler class, not Sample

trace() does not work on Sample objects. Use the Script Watch Table to peek inside.

getCustomProperties

Returns an object that can hold additional properties. Edit on GitHub

Sample.getCustomProperties()



getId

Returns the ID of the property (use this with the setFromJSONMethod). Edit on GitHub

Sample.getId(int id)



getRange

Returns the value range that the given property can have (eg. the loop end might not go beyond the sample end. Edit on GitHub

Sample.getRange(int propertyIndex)



loadIntoBufferArray

Loads the sample into a array of buffers for analysis. Edit on GitHub

Sample.loadIntoBufferArray()



refersToSameSample

Checks if the otherSample object refers to the same sample as this. Edit on GitHub

Sample.refersToSameSample(var otherSample)



replaceAudioFile

Writes the content of the audio data (array of buffers) into the audio file. This is undoable!. Edit on GitHub

Sample.replaceAudioFile(var audioData)



set

Sets the sample property. Edit on GitHub

Sample.set(int propertyIndex, var newValue)



setFromJSON

Sets the properties from a JSON object. Edit on GitHub

Sample.setFromJSON(var object)