<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.simtx.net/index.php?action=history&amp;feed=atom&amp;title=Lua_audio_add-on_API</id>
	<title>Lua audio add-on API - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.simtx.net/index.php?action=history&amp;feed=atom&amp;title=Lua_audio_add-on_API"/>
	<link rel="alternate" type="text/html" href="https://wiki.simtx.net/index.php?title=Lua_audio_add-on_API&amp;action=history"/>
	<updated>2026-11-04T23:23:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.simtx.net/index.php?title=Lua_audio_add-on_API&amp;diff=1525&amp;oldid=prev</id>
		<title>Clanker: Rework documentation for new users: illustrated steps, clear navigation, preserved technical references, and current 0.3.6 behavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.simtx.net/index.php?title=Lua_audio_add-on_API&amp;diff=1525&amp;oldid=prev"/>
		<updated>2026-09-13T21:22:03Z</updated>

		<summary type="html">&lt;p&gt;Rework documentation for new users: illustrated steps, clear navigation, preserved technical references, and current 0.3.6 behavior&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:22, 13 September 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Documentation navigation}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An &amp;#039;&amp;#039;&amp;#039;audio add-on&amp;#039;&amp;#039;&amp;#039; modifies mono audio before RF modulation. Several enabled add-ons form an ordered chain and run from top to bottom for every audio block.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;An &amp;#039;&amp;#039;&amp;#039;audio add-on&amp;#039;&amp;#039;&amp;#039; modifies mono audio before RF modulation. Several enabled add-ons form an ordered chain and run from top to bottom for every audio block.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== How to use this reference ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Use an add-on when the task changes ordinary mono audio before modulation. Begin with the complete gain package in [[Creating Lua extensions]]. The process callback changes the supplied audio block in place; it does not return a replacement file. Keep samples finite and use block operations when they express the task.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Declaration ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Declaration ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key simtxwiki:diff:1.41:old-569:rev-1525:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Clanker</name></author>
	</entry>
	<entry>
		<id>https://wiki.simtx.net/index.php?title=Lua_audio_add-on_API&amp;diff=569&amp;oldid=prev</id>
		<title>Clanker: Add and update user documentation for Lua extensions and the catalog</title>
		<link rel="alternate" type="text/html" href="https://wiki.simtx.net/index.php?title=Lua_audio_add-on_API&amp;diff=569&amp;oldid=prev"/>
		<updated>2026-08-06T09:12:26Z</updated>

		<summary type="html">&lt;p&gt;Add and update user documentation for Lua extensions and the catalog&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;An &amp;#039;&amp;#039;&amp;#039;audio add-on&amp;#039;&amp;#039;&amp;#039; modifies mono audio before RF modulation. Several enabled add-ons form an ordered chain and run from top to bottom for every audio block.&lt;br /&gt;
&lt;br /&gt;
== Declaration ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
simtx.addon {&lt;br /&gt;
  name = &amp;quot;Limiter&amp;quot;,&lt;br /&gt;
  description = &amp;quot;Limits audio peaks.&amp;quot;,&lt;br /&gt;
  controls = {&lt;br /&gt;
    simtx.controls.slider(&amp;quot;peak&amp;quot;, {&lt;br /&gt;
      label = &amp;quot;Peak&amp;quot;, min = 0.1, max = 1, step = 0.01, default = 0.9,&lt;br /&gt;
    }),&lt;br /&gt;
  },&lt;br /&gt;
  start = function(ctx)&lt;br /&gt;
    -- Optional per-session initialization.&lt;br /&gt;
  end,&lt;br /&gt;
  process = function(audio, ctx)&lt;br /&gt;
    audio:limit(ctx:control(&amp;quot;peak&amp;quot;))&lt;br /&gt;
  end,&lt;br /&gt;
  stop = function(ctx)&lt;br /&gt;
    -- Optional per-session cleanup.&lt;br /&gt;
  end,&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;simtx.processor&amp;lt;/code&amp;gt; is an alias of &amp;lt;code&amp;gt;simtx.addon&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;process&amp;lt;/code&amp;gt; fields are required. &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;controls&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;stop&amp;lt;/code&amp;gt; are optional. Controls use the declarations in [[Lua extension API]].&lt;br /&gt;
&lt;br /&gt;
Each transmission receives isolated callback state. Add-ons may be used with mono audio sources and with Lua modulation modes that produce audio. They do not apply to direct GNU Radio IQ, PipeWire Stereo, white noise, or an IQ-producing Lua mode.&lt;br /&gt;
&lt;br /&gt;
== Audio block ==&lt;br /&gt;
Audio samples are normally in the range -1 to 1. Indices are zero-based, and values written by an add-on must be finite.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Method !! Effect or result&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:size()&amp;lt;/code&amp;gt; || Number of samples in the block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:sampleRate()&amp;lt;/code&amp;gt; || Sample rate in hertz.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:sessionTime()&amp;lt;/code&amp;gt; || Time in seconds at the start of the block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:samplePosition()&amp;lt;/code&amp;gt; || Absolute sample position at the start of the block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:get(index)&amp;lt;/code&amp;gt; || Reads one sample.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:set(index, value)&amp;lt;/code&amp;gt; || Replaces one sample.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:map(function(sample, index, time) ... end)&amp;lt;/code&amp;gt; || Replaces every sample with the callback result.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:gain(amount)&amp;lt;/code&amp;gt; || Applies a constant linear gain.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:limit(peak)&amp;lt;/code&amp;gt; || Limits samples to the symmetric positive peak.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:mixTone(frequencyHz, level)&amp;lt;/code&amp;gt; || Adds a sine tone and reserves headroom.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:mixTone(frequencyHz, level, reserveHeadroom)&amp;lt;/code&amp;gt; || Adds a tone with optional headroom reservation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:fill(value)&amp;lt;/code&amp;gt; || Replaces the block with a constant value.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:peak()&amp;lt;/code&amp;gt; || Absolute peak of the current block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;audio:rms()&amp;lt;/code&amp;gt; || Root mean square level of the current block.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tone frequency must be at least zero and below half the sample rate. The peak supplied to &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; must be positive.&lt;br /&gt;
&lt;br /&gt;
== Context ==&lt;br /&gt;
The second callback argument supplies stream information and live controls.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Method !! Result&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ctx:blockSize()&amp;lt;/code&amp;gt; || Number of samples in the block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ctx:sampleRate()&amp;lt;/code&amp;gt; || Sample rate in hertz.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ctx:sessionTime()&amp;lt;/code&amp;gt; || Time in seconds at the start of the block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ctx:samplePosition()&amp;lt;/code&amp;gt; || Absolute sample position at the start of the block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ctx:control(id)&amp;lt;/code&amp;gt; || Current value of one control, or &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ctx:controls()&amp;lt;/code&amp;gt; || Snapshot table of all current control values.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua extensions]]&lt;/div&gt;</summary>
		<author><name>Clanker</name></author>
	</entry>
</feed>