Formula Device: LineQuantize

LineQuantize , a formula device for controlling parameter changes quantized over time
More specifically, you use the first parameter (A) to specify a value
B will determine the line-quantize amount
C will determine the line offset (NOTE - needs to be smaller than line-quantize amount)

The device has been written with pattern-FX control in mind:
For both B and C, it is the FX command written into the pattern that will determine the number.
For example, the command “x209” would output a value for every 9th line.

<?xml version="1.0" encoding="UTF-8"?>
<FilterDeviceClipboard doc_version="0">
<DeviceSlot type="FormulaMetaDevice">
<IsMaximized>true</IsMaximized>
<IsSelected>true</IsSelected>
<SelectedPresetName>Init</SelectedPresetName>
<SelectedPresetIsModified>true</SelectedPresetIsModified>
<IsActive>
<Value>1.0</Value>
<Visualization>Device only</Visualization>
</IsActive>
<FormulaParagraphs>
<FormulaParagraph>quant(A,B,C)</FormulaParagraph>
</FormulaParagraphs>
<FunctionsParagraphs>
<FunctionsParagraph>-- this device will quantize a parameter (A) according</FunctionsParagraph>
<FunctionsParagraph>-- to the line number and offset specified in (B/C)</FunctionsParagraph>
<FunctionsParagraph>-- It is meant to be controlled by fx commands, e.g.</FunctionsParagraph>
<FunctionsParagraph>-- x204 to set quantize to four lines, and</FunctionsParagraph>
<FunctionsParagraph>-- x302 to set offset to two lines</FunctionsParagraph>
<FunctionsParagraph>-- (NOTE: offset needs to be smaller than quantize!)</FunctionsParagraph>
<FunctionsParagraph>local cached_val = nil</FunctionsParagraph>
<FunctionsParagraph>local cached_line = LINE</FunctionsParagraph>
<FunctionsParagraph>function quant(val,lines,offset)</FunctionsParagraph>
<FunctionsParagraph> if not cached_val then</FunctionsParagraph>
<FunctionsParagraph> cached_val = val</FunctionsParagraph>
<FunctionsParagraph> end</FunctionsParagraph>
<FunctionsParagraph> local lines = floor(lines*256)</FunctionsParagraph>
<FunctionsParagraph> local offset = floor(offset*256)</FunctionsParagraph>
<FunctionsParagraph> if (LINE%lines==(0+offset)) </FunctionsParagraph>
<FunctionsParagraph> and (LINE~=cached_line) </FunctionsParagraph>
<FunctionsParagraph> then</FunctionsParagraph>
<FunctionsParagraph> cached_val = val</FunctionsParagraph>
<FunctionsParagraph> cached_line = LINE</FunctionsParagraph>
<FunctionsParagraph> return val</FunctionsParagraph>
<FunctionsParagraph> else</FunctionsParagraph>
<FunctionsParagraph> cached_line = LINE</FunctionsParagraph>
<FunctionsParagraph> return cached_val</FunctionsParagraph>
<FunctionsParagraph> end</FunctionsParagraph>
<FunctionsParagraph>end</FunctionsParagraph>
<FunctionsParagraph/>
</FunctionsParagraphs>
<InputNameA>A</InputNameA>
<InputNameB>B</InputNameB>
<InputNameC>C</InputNameC>
<EditorVisible>true</EditorVisible>
<PanelVisible>1</PanelVisible>
<InputA>
<Value>0.480000377</Value>
<Visualization>Device only</Visualization>
</InputA>
<InputB>
<Value>0.0352941193</Value>
<Visualization>Device only</Visualization>
</InputB>
<InputC>
<Value>0.00392156886</Value>
<Visualization>Device only</Visualization>
</InputC>
<DestTrack>
<Value>-1</Value>
<Visualization>Device only</Visualization>
</DestTrack>
<DestEffect>
<Value>-1</Value>
<Visualization>Device only</Visualization>
</DestEffect>
<DestParameter>
<Value>-1</Value>
<Visualization>Device only</Visualization>
</DestParameter>
</DeviceSlot>
</FilterDeviceClipboard>

Edit: also on Renoise downloads now:

http://forum.renoise.com/index.php/files/file/106-linequantize/

Nice , was looking for this type of thing a while back,