index of namespace default
 
 index of project tksampler
 
 index of module tksampler

Class tksampler.StSampleVoice


Synopsis*

  Base classes:
  Methods: Description:

* The replayer (linearly) interpolates frequency/volume and panning across a "sample block". * Samples are also interpolated linearly. * Volume ramping can be done via the A(DS)R envelopes. * * Updated vol/pan/freq modulation info is read when a new block is started (copied from "queued" shadow members). * The default block size/length is STSAMPLEVOICE_BLOCK_LEN seconds, or 44.1 samples @44100Hz mixrate. * * The update mechanism is not "sample realtime" but behaves more like a hardware MIDI/USB sampler. * The latency depends on the output buffer size. * I recommend 256 samples @ 48Khz, i.e. 5 millisec latency. This should be fast enough for LFOs and arpeggiators.. * (also see the tkportaudio plugin for low latency audio I/O via Steinberg's ASIO2 API on Win32) * * The voice is marked inactive when * a) The end of the sample has been reached and there are no more loops * b) The volume release envelope finishes (i.e. some time after a note-off or immediately if there is no vol. envelope) * * The current replay note+finetune is mapped via a user-defined frequency table (can be changed per-voice). * * Reverse play and "scratch" fx currently only work with loop samples (i.e. the whole sample will be looped).


 
 top of page

Method getAltVolume
Return alternative volume modulation
Signature
getAltVolume():float
Returns
float

 
 top of page
Method getCycleLen
Return sample cycle length modulation
Signature
getCycleLen():float
Returns
float

 
 top of page
Method getFreq
Return frequency modulation
Signature
getFreq():float
Returns
float

 
 top of page
Method getFreq2
Return frequency modulation
Signature
getFreq2():float
Returns
float

 
 top of page
Method getMod
Return modulation
Signature
getMod():float
Returns
float

 
 top of page
Method getPan
Return panning modulation
Signature
getPan():float
Returns
float

 
 top of page
Method getPan2
Return panning modulation (randomization)
Signature
getPan2():float
Returns
float

 
 top of page
Method getSampleOff
Return sample offset modulation
Signature
getSampleOff():float
Returns
float

 
 top of page
Method getSampleOff2
Return sample offset modulation (randomization)
Signature
getSampleOff2():float
Returns
float

 
 top of page
Method getSampleShift
Return sample shift modulation
Signature
getSampleShift():float
Returns
float

 
 top of page
Method getSampleShiftEndOfLoop
Return sample shift modulation (queued until end of loop)
Signature
getSampleShiftEndOfLoop():float
Returns
float

 
 top of page
Method getTimedLoopBase
Signature
getTimedLoopBase():float
Returns
float

 
 top of page
Method getTimestretch
Return timestretch modulation
Signature
getTimestretch():float
Returns
float

 
 top of page
Method getTimestretchBend
Return timestretch phase bend modulation
Signature
getTimestretchBend():float
Returns
float

 
 top of page
Method getVoiceIndex
Query index of sample voice in sample player voice array
Signature
getVoiceIndex():int
Returns
int

 
 top of page
Method getVol
Return volume modulation
Signature
getVol():float
Returns
float

 
 top of page
Method getVol2
Return volume modulation (randomization)
Signature
getVol2():float
Returns
float

 
 top of page
Method init
Initialize sample voice.
Signature
init(StSamplesample,
  FloatArrayfreqTable,
  floatmixRate,
  intnote 
  )  
Arguments
StSamplesample- Which sample to play
FloatArrayfreqTable- Used to convert MIDI note number to frequency (Hz). At least 128 entries.
floatmixRate
intnote- Which MIDI note to play (fraction is used for detune)

 
 top of page
Method mmVarGetIdx
Returns currently playing mod matrix variation index (0..15)
Signature
mmVarGetIdx():int
Returns
int

 
 top of page
Method noteOff
Start release phase
Signature
noteOff(floatvelocity)
Arguments
floatvelocityNote-off velocity (0..1)
Description

If there is no release envelope, the voice is stopped immediately

 
 top of page
Method noteToFreq
Map MIDI note to frequency (Hz) using currently set freq_table.
Signature
noteToFreq(floatnote)
 :float
Arguments
floatnoteMIDI note number (fraction for detune)
Returns
floatFrequency (Hz)

 
 top of page
Method PrintDebugStats
Pseudo-static method that prints mixer codepath statistics (for debugging/optimization)
Signature
PrintDebugStats()

 
 top of page
Method render
Signature
render(FloatArraybuf)
Arguments
FloatArraybuf

 
 top of page
Method resetLFOAuxPhase
Reset aux LFO phase
Signature
resetLFOAuxPhase()

 
 top of page
Method resetLFOFreqPhase
Reset frequency LFO phase
Signature
resetLFOFreqPhase()

 
 top of page
Method resetLFOPanPhase
Reset panning LFO phase
Signature
resetLFOPanPhase()

 
 top of page
Method resetLFOVolPhase
Reset volume LFO phase
Signature
resetLFOVolPhase()

 
 top of page
Method restartVoice
Reset currently playing voice
Signature
restartVoice()

 
 top of page
Method retrigEnvLFO
Retrigger envelopes/LFOs
Signature
retrigEnvLFO(intmask)
Arguments
intmask

 
 top of page
Method setAAuxSpd
Set aux attack speed modifier
Signature
setAAuxSpd(floatint)
Arguments
floatint

 
 top of page
Method setADSRAuxInt
Set aux ADSR intensity modifier
Signature
setADSRAuxInt(floatint)
Arguments
floatint

 
 top of page
Method setADSRAuxLvl
Set aux ADSR level modifier
Signature
setADSRAuxLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setADSRAuxSpd
Set aux ADSR speed modifier
Signature
setADSRAuxSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setADSRFreqInt
Set frequency ADSR intensity modifier
Signature
setADSRFreqInt(floatint)
Arguments
floatint

 
 top of page
Method setADSRFreqLvl
Set frequency ADSR level modifier
Signature
setADSRFreqLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setADSRFreqSpd
Set frequency ADSR speed modifier
Signature
setADSRFreqSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setADSRPanInt
Set pan ADSR intensity modifier
Signature
setADSRPanInt(floatint)
Arguments
floatint

 
 top of page
Method setADSRPanLvl
Set pan ADSR level modifier
Signature
setADSRPanLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setADSRPanSpd
Set pan ADSR speed modifier
Signature
setADSRPanSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setADSRVolInt
Set volume ADSR intensity modifier
Signature
setADSRVolInt(floatint)
Arguments
floatint

 
 top of page
Method setADSRVolLvl
Set volume ADSR level modifier
Signature
setADSRVolLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setADSRVolSpd
Set volume ADSR speed modifier
Signature
setADSRVolSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setAFreqSpd
Set freq attack speed modifier
Signature
setAFreqSpd(floatint)
Arguments
floatint

 
 top of page
Method setAltVolume
Set alternative volume modulation
Signature
setAltVolume(floatav)
Arguments
floatav

 
 top of page
Method setAPanSpd
Set pan attack speed modifier
Signature
setAPanSpd(floatint)
Arguments
floatint

 
 top of page
Method setAVolSpd
Set volume attack speed modifier
Signature
setAVolSpd(floatint)
Arguments
floatint

 
 top of page
Method setCycleLen
Set granular cycle length modulation
Signature
setCycleLen(floatso)
Arguments
floatso

 
 top of page
Method setFilterCutOff
Set filter cutoff modifier
Signature
setFilterCutOff(floatf)
Arguments
floatf

 
 top of page
Method setFilterOffset
Set filter offset modifier
Signature
setFilterOffset(floatf)
Arguments
floatf

 
 top of page
Method setFilterPan
Set filter stereo pan modifier
Signature
setFilterPan(floatf)
Arguments
floatf

 
 top of page
Method setFilterResonance
Set filter resonance modifier
Signature
setFilterResonance(floatf)
Arguments
floatf

 
 top of page
Method setFreq
Set frequency modulation
Signature
setFreq(floatfreq)
Arguments
floatfreq

 
 top of page
Method setFreq2
Set frequency modulation 2 (additive, randomization)
Signature
setFreq2(floatfreq)
Arguments
floatfreq

 
 top of page
Method setGlideSpeed
Set glide speed
Signature
setGlideSpeed(floatspeed)
Arguments
floatspeed

 
 top of page
Method setGlideSwitch
Set glide switch
Signature
setGlideSwitch(booleanbEnable)
Arguments
booleanbEnable

 
 top of page
Method setJumpToLoop
Queue jump to loop
Signature
setJumpToLoop(intidx)
Arguments
intidx

 
 top of page
Method setJumpToLoopRel
Queue jump to loop (0..1 => 0..num_loops-1)
Signature
setJumpToLoopRel(floatrelIdx)
Arguments
floatrelIdx

 
 top of page
Method setLFOAuxFltAmt
Set aux LFO => flt amount modifier
Signature
setLFOAuxFltAmt(floatamt)
Arguments
floatamt

 
 top of page
Method setLFOAuxLvl
Set aux LFO level modifier
Signature
setLFOAuxLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setLFOAuxSpd
Set aux LFO speed modifier
Signature
setLFOAuxSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setLFOFreqAmt
Set frequency LFO => frequency amount modifier
Signature
setLFOFreqAmt(floatamt)
Arguments
floatamt

 
 top of page
Method setLFOFreqLvl
Set frequency LFO level modifier
Signature
setLFOFreqLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setLFOFreqSpd
Set frequency LFO speed modifier
Signature
setLFOFreqSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setLFOPanAmt
Set pan LFO => pan amount modifier
Signature
setLFOPanAmt(floatamt)
Arguments
floatamt

 
 top of page
Method setLFOPanLvl
Set pan LFO level modifier
Signature
setLFOPanLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setLFOPanSpd
Set pan LFO speed modifier
Signature
setLFOPanSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setLFOVolAmt
Set volume LFO => volume amount modifier
Signature
setLFOVolAmt(floatamt)
Arguments
floatamt

 
 top of page
Method setLFOVolLvl
Set volume LFO level modifier
Signature
setLFOVolLvl(floatlvl)
Arguments
floatlvl

 
 top of page
Method setLFOVolSpd
Set volume LFO speed modifier
Signature
setLFOVolSpd(floatspd)
Arguments
floatspd

 
 top of page
Method setMod
Set modulation
Signature
setMod(floatmod)
Arguments
floatmod
Description

This only has an effect when there is a mod range defined

 
 top of page
Method setModSeqAdvance
Signature
setModSeqAdvance(floatadvance)
Arguments
floatadvance

 
 top of page
Method setModSeqLevel
Signature
setModSeqLevel(floatlevel)
Arguments
floatlevel

 
 top of page
Method setModSeqNumStepsRel
Signature
setModSeqNumStepsRel(floatnumStepsRel)
Arguments
floatnumStepsRel

 
 top of page
Method setModSeqRetrigMask
Signature
setModSeqRetrigMask(intmask)
Arguments
intmask

 
 top of page
Method setModSeqSpeed
Signature
setModSeqSpeed(floatspeed)
Arguments
floatspeed

 
 top of page
Method setPan
Set panning modulation
Signature
setPan(floatpan)
Arguments
floatpan

 
 top of page
Method setPan2
Set panning modulation (randomization)
Signature
setPan2(floatpan)
Arguments
floatpan

 
 top of page
Method setRAuxSpd
Set aux release speed modifier
Signature
setRAuxSpd(floatint)
Arguments
floatint

 
 top of page
Method setRFreqSpd
Set freq release speed modifier
Signature
setRFreqSpd(floatint)
Arguments
floatint

 
 top of page
Method setRPanSpd
Set pan release speed modifier
Signature
setRPanSpd(floatint)
Arguments
floatint

 
 top of page
Method setRVolSpd
Set volume release speed modifier
Signature
setRVolSpd(floatint)
Arguments
floatint

 
 top of page
Method setSampleOff
Set sample offset modulation
Signature
setSampleOff(floatso)
Arguments
floatso

 
 top of page
Method setSampleOff2
Set sample offset modulation (randomization)
Signature
setSampleOff2(floatso)
Arguments
floatso

 
 top of page
Method setSampleShift
Set sample shift modulation
Signature
setSampleShift(floatsh)
Arguments
floatsh

 
 top of page
Method setSampleShiftEndOfLoop
Set sample shift modulation (queued until end of loop)
Signature
setSampleShiftEndOfLoop(floatsh)
Arguments
floatsh

 
 top of page
Method setSAuxSpd
Set aux sustain speed modifier
Signature
setSAuxSpd(floatint)
Arguments
floatint

 
 top of page
Method setSFreqSpd
Set freq sustain speed modifier
Signature
setSFreqSpd(floatint)
Arguments
floatint

 
 top of page
Method setSPanSpd
Set pan sustain speed modifier
Signature
setSPanSpd(floatint)
Arguments
floatint

 
 top of page
Method setSVolSpd
Set volume sustain speed modifier
Signature
setSVolSpd(floatint)
Arguments
floatint

 
 top of page
Method setTimedLoopBase
Set timedloop repeat frequency (1sec/base)
Signature
setTimedLoopBase(floatbase)
Arguments
floatbase
Description

This only has an effect when the sample uses timed loops.

 
 top of page
Method setTimestretch
Set timestretch modulation
Signature
setTimestretch(floatts)
Arguments
floatts
Description

This only has an effect when timestretching is enabled

 
 top of page
Method setTimestretchBend
Set timestretch phase bend modulation
Signature
setTimestretchBend(floatts)
Arguments
floatts
Description

This only has an effect when timestretching is enabled

 
 top of page
Method setVol
Set volume modulation
Signature
setVol(floatvol)
Arguments
floatvol

 
 top of page
Method setVol2
Set volume modulation 2 (randomization)
Signature
setVol2(floatvol)
Arguments
floatvol

 
 top of page
Method setWavepathIndex
Queue next cycle
Signature
setWavepathIndex(intidx)
Arguments
intidx

 
 top of page
Method softStopVoice
Fadeout voice and stop it
Signature
softStopVoice()

 
 top of page
Method stopVoice
Mark voice inactive (no fadeout)
Signature
stopVoice()

 
 top of page
Method updatePerfCtlPolyPressure
Update poly pressure (0..127)
Signature
updatePerfCtlPolyPressure(floatvalue)
Arguments
floatvalue

 
 top of page
 

Project Modules:tksampler 
Project Classes:StADSR , StEnvelope , StFFT , StLFO , StModSeq , StPluginInfo , StPluginLibrary , StPluginShared , StPluginSharedMissing , StPluginVoice , StRange , StSample , StSampleBank , StSampleMutexGroup , StSamplePlayer , StSampleVoice , StWaveform 
Project Functions:
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:42:00