Note event in formula device?

Is it possible in the formula device to determine whether a note playing occurs?

I would like to build a fake per-note panner, so it pans abruptly on note event, following a small rotating table of panning values. Is it possible?

Currently I have this, but I would like to get rid of the keytracker and LFOs:

<?xml version="1.0" encoding="UTF-8"?>
<FilterDeviceClipboard doc_version="0">
  <DeviceSlot type="DooferDevice">
    <IsMaximized>true</IsMaximized>
    <IsSelected>true</IsSelected>
    <SelectedPresetName>Ju LFO Step Panner Always</SelectedPresetName>
    <SelectedPresetLibrary>User Library</SelectedPresetLibrary>
    <SelectedPresetIsModified>false</SelectedPresetIsModified>
    <IsActive>
      <Value>1.0</Value>
      <Visualization>Device only</Visualization>
    </IsActive>
    <Macro0>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
    </Macro0>
    <Macro1>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
      <Name>LFO Offset</Name>
    </Macro1>
    <Macro2>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
      <Name>Macro 3</Name>
    </Macro2>
    <Macro3>
      <Value>4.00000477</Value>
      <Visualization>Device only</Visualization>
      <Name>LFO Wave</Name>
    </Macro3>
    <Macro4>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
      <Name>Macro 5</Name>
    </Macro4>
    <Macro5>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
      <Name>Macro 6</Name>
    </Macro5>
    <Macro6>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
      <Name>Macro 7</Name>
    </Macro6>
    <Macro7>
      <Value>50</Value>
      <Visualization>Device only</Visualization>
      <Name>Macro 8</Name>
    </Macro7>
    <NumActiveMacros>1</NumActiveMacros>
    <ShowDevices>true</ShowDevices>
    <DeviceChain>
      <SelectedPresetName>Init</SelectedPresetName>
      <SelectedPresetLibrary>Bundled Content</SelectedPresetLibrary>
      <SelectedPresetIsModified>true</SelectedPresetIsModified>
      <Devices>
        <LfoDevice type="LfoDevice">
          <IsMaximized>true</IsMaximized>
          <IsSelected>false</IsSelected>
          <SelectedPresetName>Init</SelectedPresetName>
          <SelectedPresetLibrary>Bundled Content</SelectedPresetLibrary>
          <SelectedPresetIsModified>true</SelectedPresetIsModified>
          <IsActive>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </IsActive>
          <DestTrack>
            <Value>-1</Value>
            <Visualization>Device only</Visualization>
          </DestTrack>
          <DestEffect>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </DestEffect>
          <DestParameter>
            <Value>2</Value>
            <Visualization>Device only</Visualization>
          </DestParameter>
          <Amplitude>
            <Value>0.152000263</Value>
            <Visualization>Device only</Visualization>
          </Amplitude>
          <Offset>
            <Value>0.0</Value>
            <Visualization>Device only</Visualization>
          </Offset>
          <Frequency>
            <Value>4.31999588</Value>
            <Visualization>Device only</Visualization>
          </Frequency>
          <Type>
            <Value>0.0</Value>
            <Visualization>Device only</Visualization>
          </Type>
          <CustomEnvelope>
            <PlayMode>Linear</PlayMode>
            <Length>64</Length>
            <ValueQuantum>0.0</ValueQuantum>
            <Polarity>Unipolar</Polarity>
            <Points>
              <Point>0,0.0</Point>
              <Point>63,1.0</Point>
            </Points>
          </CustomEnvelope>
          <CustomEnvelopeOneShot>false</CustomEnvelopeOneShot>
          <UseAdjustedEnvelopeLength>true</UseAdjustedEnvelopeLength>
        </LfoDevice>
        <FormulaMetaDevice type="FormulaMetaDevice">
          <IsMaximized>false</IsMaximized>
          <IsSelected>true</IsSelected>
          <SelectedPresetName>lfo val on note</SelectedPresetName>
          <SelectedPresetLibrary>User Library</SelectedPresetLibrary>
          <SelectedPresetIsModified>true</SelectedPresetIsModified>
          <IsActive>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </IsActive>
          <FormulaParagraphs>
            <FormulaParagraph>func(A, B)</FormulaParagraph>
          </FormulaParagraphs>
          <FunctionsParagraphs>
            <FunctionsParagraph>local last = 0</FunctionsParagraph>
            <FunctionsParagraph>local backVal = 0</FunctionsParagraph>
            <FunctionsParagraph>function func(a, b)</FunctionsParagraph>
            <FunctionsParagraph> local newNote = false</FunctionsParagraph>
            <FunctionsParagraph> if (a ~= last) then last = a;backVal = b;newNote = true end</FunctionsParagraph>
            <FunctionsParagraph> return backVal</FunctionsParagraph>
            <FunctionsParagraph>end</FunctionsParagraph>
            <FunctionsParagraph/>
          </FunctionsParagraphs>
          <InputNameA>A</InputNameA>
          <InputNameB>B</InputNameB>
          <InputNameC>C</InputNameC>
          <EditorVisible>true</EditorVisible>
          <InputA>
            <Value>0.623362899</Value>
            <Visualization>Device only</Visualization>
          </InputA>
          <InputB>
            <Value>0.425163925</Value>
            <Visualization>Device only</Visualization>
          </InputB>
          <InputC>
            <Value>0.0</Value>
            <Visualization>Device only</Visualization>
          </InputC>
          <DestTrack>
            <Value>-1</Value>
            <Visualization>Device only</Visualization>
          </DestTrack>
          <DestEffect>
            <Value>2</Value>
            <Visualization>Device only</Visualization>
          </DestEffect>
          <DestParameter>
            <Value>2</Value>
            <Visualization>Device only</Visualization>
          </DestParameter>
        </FormulaMetaDevice>
        <GainerDevice type="GainerDevice">
          <IsMaximized>true</IsMaximized>
          <IsSelected>false</IsSelected>
          <SelectedPresetName>Init</SelectedPresetName>
          <SelectedPresetLibrary>Bundled Content</SelectedPresetLibrary>
          <SelectedPresetIsModified>true</SelectedPresetIsModified>
          <IsActive>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </IsActive>
          <Volume>
            <Value>1.0</Value>
            <Visualization>Mixer and Device</Visualization>
          </Volume>
          <Panning>
            <Value>0.496233046</Value>
            <Visualization>Device only</Visualization>
          </Panning>
          <LPhaseInvert>false</LPhaseInvert>
          <RPhaseInvert>false</RPhaseInvert>
          <SmoothParameterChanges>true</SmoothParameterChanges>
        </GainerDevice>
        <KeyTrackingDevice type="KeyTrackingDevice">
          <IsMaximized>false</IsMaximized>
          <IsSelected>false</IsSelected>
          <SelectedPresetName>Init</SelectedPresetName>
          <SelectedPresetLibrary>Bundled Content</SelectedPresetLibrary>
          <SelectedPresetIsModified>true</SelectedPresetIsModified>
          <IsActive>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </IsActive>
          <SrcInstrument>-1</SrcInstrument>
          <DestScaling>Linear</DestScaling>
          <KeyTrackingMode>Clamp</KeyTrackingMode>
          <KeyTrackingMin>0</KeyTrackingMin>
          <KeyTrackingMax>119</KeyTrackingMax>
          <DestTrack>
            <Value>-1</Value>
            <Visualization>Device only</Visualization>
          </DestTrack>
          <DestEffect>
            <Value>4</Value>
            <Visualization>Device only</Visualization>
          </DestEffect>
          <DestParameter>
            <Value>8</Value>
            <Visualization>Device only</Visualization>
          </DestParameter>
          <DestMin>
            <Value>0.0</Value>
            <Visualization>Device only</Visualization>
          </DestMin>
          <DestMax>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </DestMax>
        </KeyTrackingDevice>
        <LfoDevice type="LfoDevice">
          <IsMaximized>false</IsMaximized>
          <IsSelected>false</IsSelected>
          <SelectedPresetName>Init</SelectedPresetName>
          <SelectedPresetLibrary>Bundled Content</SelectedPresetLibrary>
          <SelectedPresetIsModified>true</SelectedPresetIsModified>
          <IsActive>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </IsActive>
          <DestTrack>
            <Value>-1</Value>
            <Visualization>Device only</Visualization>
          </DestTrack>
          <DestEffect>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </DestEffect>
          <DestParameter>
            <Value>1.0</Value>
            <Visualization>Device only</Visualization>
          </DestParameter>
          <Amplitude>
            <Value>0.5</Value>
            <Visualization>Device only</Visualization>
          </Amplitude>
          <Offset>
            <Value>0.0</Value>
            <Visualization>Device only</Visualization>
          </Offset>
          <Frequency>
            <Value>9.99999997e-07</Value>
            <Visualization>Device only</Visualization>
          </Frequency>
          <Type>
            <Value>3</Value>
            <Visualization>Device only</Visualization>
          </Type>
          <CustomEnvelope>
            <PlayMode>Linear</PlayMode>
            <Length>64</Length>
            <ValueQuantum>0.0</ValueQuantum>
            <Polarity>Unipolar</Polarity>
            <Points>
              <Point>0,0.0</Point>
              <Point>63,1.0</Point>
            </Points>
          </CustomEnvelope>
          <CustomEnvelopeOneShot>true</CustomEnvelopeOneShot>
          <UseAdjustedEnvelopeLength>true</UseAdjustedEnvelopeLength>
        </LfoDevice>
      </Devices>
    </DeviceChain>
  </DeviceSlot>
</FilterDeviceClipboard>

EDIT: Disregard answer. Incorrect as I didn’t think enough. It can never pan the actual note events though, so you’re left with track panning.


No. The formula device doesn’t have access to any pattern data. Only input parameters and what’s available under “help”.

PS. I had some fun with checking what was available in the environment table of the formula device. With a script, it’s possible to use character byte to the output, and write the output of “for k, v” loop to a parameter device, character by character, then read it via a notifier :slight_smile: It turned out that the debug library was available in 3.0 (removed in 3.1), but even though lots of info about the lua environment(s) is available deep inside it, I believe it wasn’t possible to do much with it (like setting up a connection to the song data, for example).

No, but you already managed a very cool way that works for random panning positions.

I currently need distraction, so I made one similar to urs that will cylce through a table of panning values which is defined in the formula device code (just edit/add/delete values in the array to your liking). It also has a reset dial, just move/automate to reset the panning to the first slot in the table.

I currently need distraction, so I made one similar to urs that will cylce through a table of panning values which is defined in the formula device code (just edit/add/delete values in the array to your liking). It also has a reset dial, just move/automate to reset the panning to the first slot in the table.

Very cool, thanks.

Yes,

What you do is make a doofer, then add velocity tracker, LFO device and formula device.
Set the LFO device to Amplitude=0, Offset = 0.

Connect the velocity tracker to input A of the formula device, and then also connect the LFO device to the input A.

Then in your formula device, check to see the A>0. If it is, then a new note got triggered.

The way it works is that the velocity tracker will set A to the note velocity, and then on the next tick the LFO will set the A back to 0.

2 Likes