ZeroXBufWr:
Filter:
miSCellaneous_lib/Classes (extension) | Libraries > miSCellaneous > ZeroX ugens

ZeroXBufWr
ExtensionExtension

writes zero crossing analysis from signals to buffers

Description

ZeroXBufWr analyses zero crossings from an input signal and writes the signal and the zero crossing indices to buffers. It is intended to be used with ZeroXBufRd and TZeroXBufRd, see these help files for more examples.

NOTE: Often it pays to adjust zero crossings in the sound buffer effectively to 0, that way sawtooth-like interpolation artefacts can be avoided. See Ex. 2, ZeroXBufRd: Ex. 7 and TZeroXBufRd: Ex. 1.
NOTE: For avoiding too long half wavesets it might be useful to apply LeakDC resp. a high pass filter before analysis.
NOTE: For full functionality at least SC 3.7 is recommended (adjustZeroXs set to 2 doesn't work in 3.6)

Credits

Thanks to Tommaso Settimi for an inspiring discussion, which gave me a nudge to tackle these classes.

Class Methods

.ar

Creates a new ZeroXBufWr ar UGen.

Arguments:

in

Signal to be analysed, size must correspond to sndBuf and zeroXBuf.

sndBuf

Buffer or SequenceableCollection of Buffers to write signals to, size must correspond to in and zeroXBuf, writing can be disabled with writeSndBuf. The length of sndBuf determines the trigger for the doneAction.

zeroXBuf

Buffer or SequenceableCollection of Buffers to write anaysis data to, size must correspond to in and sndBuf.

startWithZeroX

Number 0 or 1 or SequenceableCollection of such, determining whether the first sample should be regarded as zero crossing. Defaults to 0.

adjustZeroXs

One of the Numbers -1, 0, 1, 2 or a SequenceableCollection of such.

  • -1: indicate all zeroXs, dont't write sound buffer
  • 0: indicate all zeroXs, write sound buffer
  • 1: indicate all zeroXs, write sound buffer, set to 0 there
  • 2: indicate zeroXs with a minimum distance of 2, set to 0 there

Actions 1 and 2 can lead to smoother half wavesets, see examples. Defaults to 0.

doneAction

Done action be performed after the duration of the longest buffer of sndBuf. Defaults to 0.

Examples

See the ZeroXBufRd and TZeroXBufRd help files for more examples

 

Ex. 1: Basic usage

 

Ex. 2: Adjusting zero crossings