From 039847a29868d335c08fe0a587260dffc71ca5c4 Mon Sep 17 00:00:00 2001 From: Ludvig Gunne Lindström Date: Fri, 17 Jul 2026 11:43:24 +0200 Subject: init --- doc/classes/buffer.html | 247 +++++++++++++++++++++++++++ doc/classes/delay.html | 270 +++++++++++++++++++++++++++++ doc/classes/gain.html | 179 ++++++++++++++++++++ doc/classes/interp.html | 322 +++++++++++++++++++++++++++++++++++ doc/classes/ladspa.html | 298 ++++++++++++++++++++++++++++++++ doc/classes/mixer.html | 139 +++++++++++++++ doc/classes/nullsink.html | 188 +++++++++++++++++++++ doc/classes/oscil.html | 392 +++++++++++++++++++++++++++++++++++++++++++ doc/classes/pan.html | 240 ++++++++++++++++++++++++++ doc/classes/playback.html | 331 ++++++++++++++++++++++++++++++++++++ doc/classes/sample.html | 203 ++++++++++++++++++++++ doc/classes/serial.html | 161 ++++++++++++++++++ doc/classes/timer.html | 226 +++++++++++++++++++++++++ doc/index.html | 153 +++++++++++++++++ doc/ldoc_fixed.css | 312 ++++++++++++++++++++++++++++++++++ doc/modules/biquad.html | 189 +++++++++++++++++++++ doc/modules/expression.html | 221 ++++++++++++++++++++++++ doc/modules/fs.html | 138 +++++++++++++++ doc/modules/keycallback.html | 133 +++++++++++++++ doc/modules/udp.html | 311 ++++++++++++++++++++++++++++++++++ 20 files changed, 4653 insertions(+) create mode 100644 doc/classes/buffer.html create mode 100644 doc/classes/delay.html create mode 100644 doc/classes/gain.html create mode 100644 doc/classes/interp.html create mode 100644 doc/classes/ladspa.html create mode 100644 doc/classes/mixer.html create mode 100644 doc/classes/nullsink.html create mode 100644 doc/classes/oscil.html create mode 100644 doc/classes/pan.html create mode 100644 doc/classes/playback.html create mode 100644 doc/classes/sample.html create mode 100644 doc/classes/serial.html create mode 100644 doc/classes/timer.html create mode 100644 doc/index.html create mode 100644 doc/ldoc_fixed.css create mode 100644 doc/modules/biquad.html create mode 100644 doc/modules/expression.html create mode 100644 doc/modules/fs.html create mode 100644 doc/modules/keycallback.html create mode 100644 doc/modules/udp.html (limited to 'doc') diff --git a/doc/classes/buffer.html b/doc/classes/buffer.html new file mode 100644 index 0000000..0811641 --- /dev/null +++ b/doc/classes/buffer.html @@ -0,0 +1,247 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class buffer

+

Audio buffer for capture/playback.

+

+ + + +

+local mbuffer = require 'melisma.buffer'
+local mevent = require 'melisma.event'
+
+local input = ...
+
+-- Create a buffer with capacity of 5 seconds
+-- Capture stops automatically when buffer is full.
+local len = 5
+local buffer = mbuffer.init(input, len)
+
+-- Capture audio
+buffer:capture()
+
+-- Playback after capture 3 seconds
+mevent.schedule(3, buffer.playback, buffer)
+
+ +

+ + +

Functions

+ + + + + +
buffer.init(input, len)Create an audio buffer.
+

Methods

+ + + + + + + + + + + + + + + + + +
buffer:capture()Start capture mode.
buffer:length()Get length of captured audio.
buffer:playback()Start playback mode.
buffer:speed(speed)Set playback speed.
+ +
+
+ + +

Functions

+ Methods +
+
+ + buffer.init(input, len) +
+
+ Create an audio buffer. + + +

Parameters:

+
    +
  • input + channel + Input signal. +
  • +
  • len + number + Buffer capacity in seconds. +
  • +
+ +

Returns:

+
    + + buffer + The newly created audio buffer. +
+ + + + +
+
+

Methods

+ +
+
+ + buffer:capture() +
+
+ Start capture mode. + + + + + + + +
+
+ + buffer:length() +
+
+ Get length of captured audio. + + + +

Returns:

+
    + + number + Length of captured audio in seconds. +
+ + + + +
+
+ + buffer:playback() +
+
+ Start playback mode. + + + + + + + +
+
+ + buffer:speed(speed) +
+
+ Set playback speed. + + +

Parameters:

+
    +
  • speed + number + Playback speed. +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/delay.html b/doc/classes/delay.html new file mode 100644 index 0000000..3a5470d --- /dev/null +++ b/doc/classes/delay.html @@ -0,0 +1,270 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class delay

+

Digital delay line.

+

+ +

+ + +

Functions

+ + + + + +
delay.init(input)Create a delay line.
+

Methods

+ + + + + + + + + + + + + + + + + +
delay:delay(d)Set delay.
delay:feedback(f)Set feedback.
delay:gain(g)Set gain.
delay:wetdrymix(wd)Set wet/dry mix.
+ +
+
+ + +

Functions

+ Methods +
+
+ + delay.init(input) +
+
+ Create a delay line. + + +

Parameters:

+
    +
  • input + channel + Input signal. +
  • +
+ +

Returns:

+
    + + delay + Newly created delay line. +
+ + + + +
+
+

Methods

+ +
+
+ + delay:delay(d) +
+
+ Set delay. + + +

Parameters:

+
    +
  • d + number + delay in seconds. +
  • +
+ +

Returns:

+
    + + delay + + + +
+ + + + +
+
+ + delay:feedback(f) +
+
+ Set feedback. + + +

Parameters:

+
    +
  • f + number + Feedback. +
  • +
+ +

Returns:

+
    + + delay + + + +
+ + + + +
+
+ + delay:gain(g) +
+
+ Set gain. + + +

Parameters:

+
    +
  • g + number + Gain (TODO: Use decibels). +
  • +
+ +

Returns:

+
    + + delay + + + +
+ + + + +
+
+ + delay:wetdrymix(wd) +
+
+ Set wet/dry mix. + + +

Parameters:

+
    +
  • wd + number + Wet/dry mix. +
  • +
+ +

Returns:

+
    + + delay + + + +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/gain.html b/doc/classes/gain.html new file mode 100644 index 0000000..46bea50 --- /dev/null +++ b/doc/classes/gain.html @@ -0,0 +1,179 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class gain

+

Apply gain to signals.

+

+ + +

+local mgain = require 'melisma.gain'
+
+-- Interprets cntl as decibels and applies it to input
+local input = ...
+local cntl = ...
+local gain = mgain.db(input,cntl)
+
+ +

+ + +

Functions

+ + + + + + + + + +
gain.db(input, gain)Creates a decibel gain unit.
gain.linear(input, gain)Creates a linear gain unit.
+ +
+
+ + +

Functions

+ Methods +
+
+ + gain.db(input, gain) +
+
+ Creates a decibel gain unit. + + +

Parameters:

+
    +
  • input + channel + Input signal. +
  • +
  • gain + number or channel + Constant gain in decibels or a controlling signal. +
  • +
+ +

Returns:

+
    + + gain + The newly created gain unit. +
+ + + + +
+
+ + gain.linear(input, gain) +
+
+ Creates a linear gain unit. + + +

Parameters:

+
    +
  • input + channel + Input signal. +
  • +
  • gain + number or channel + Constant gain or a controlling signal. +
  • +
+ +

Returns:

+
    + + gain + The newly created gain unit. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/interp.html b/doc/classes/interp.html new file mode 100644 index 0000000..cea6277 --- /dev/null +++ b/doc/classes/interp.html @@ -0,0 +1,322 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class interp

+

Interpolation.

+

+ + + +

+local minterp = require 'melisma.interp'
+local mevent = require 'melisma.event'
+local mgain = require 'melisma.gain'
+
+local interp = minterp.init(0)
+
+interp:linear(1,1)
+
+mevent.schedule(0.5, function()
+    print('current value:', interp:sample())
+end)
+
+local sig = ...
+local gain = mgain.linear(sig,interp)
+
+ +

+ + +

Functions

+ + + + + +
interp.init(x0)Initialize an interpolation unit.
+

Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + +
interp:ease_in(v, t)Interpolate using ease-in interpolation.
interp:ease_out(v, t)Interpolate using ease-out interpolation.
interp:linear(v, t)Interpolate using linear interpolation.
interp:sample()Get the current value.
interp:set(x)Set value directly.
interp:smoothstep(v, t)Interpolate using smoothstep interpolation.
+ +
+
+ + +

Functions

+ Methods +
+
+ + interp.init(x0) +
+
+ Initialize an interpolation unit. + + +

Parameters:

+
    +
  • x0 + number + Initial value. +
  • +
+ +

Returns:

+
    + + interp + The newly created interpolation unit. +
+ + + + +
+
+

Methods

+ +
+
+ + interp:ease_in(v, t) +
+
+ Interpolate using ease-in interpolation. + + +

Parameters:

+
    +
  • v + number + Target value. +
  • +
  • t + number + Interpolation time. +
  • +
+ + + + + +
+
+ + interp:ease_out(v, t) +
+
+ Interpolate using ease-out interpolation. + + +

Parameters:

+
    +
  • v + number + Target value. +
  • +
  • t + number + Interpolation time. +
  • +
+ + + + + +
+
+ + interp:linear(v, t) +
+
+ Interpolate using linear interpolation. + + +

Parameters:

+
    +
  • v + number + Target value. +
  • +
  • t + number + Interpolation time. +
  • +
+ + + + + +
+
+ + interp:sample() +
+
+ Get the current value. + + + +

Returns:

+
    + + number + The current value. +
+ + + + +
+
+ + interp:set(x) +
+
+ Set value directly. + + +

Parameters:

+
    +
  • x + number + New value. +
  • +
+ + + + + +
+
+ + interp:smoothstep(v, t) +
+
+ Interpolate using smoothstep interpolation. + + +

Parameters:

+
    +
  • v + number + Target value. +
  • +
  • t + number + Interpolation time. +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/ladspa.html b/doc/classes/ladspa.html new file mode 100644 index 0000000..846b65b --- /dev/null +++ b/doc/classes/ladspa.html @@ -0,0 +1,298 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class ladspa

+

LADSPA plugin support.

+

+ + + +

+local mladspa = require 'melisma.ladspa'
+
+local spec = 'caps.so:Plate'
+local info = mladspa.info(spec)
+
+print('name:',info.name)
+print('maker:',info.maker)
+
+local input = ...
+local plate = mladspa.load(spec,input)
+
+plate:control(1,1)
+
+local left = plate:out(6)
+local right = plate:out(7)
+
+ +

+ + +

Functions

+ + + + + + + + + + + + + +
ladspa.info(spec)Get information about a specific plugin.
ladspa.lib_info(path)List plugins in the specified plugin library.
ladspa.load(spec, ...)Load a ladspa plugin.
+

Methods

+ + + + + + + + + +
ladspa:control(i, v)Set the value of an input control port.
ladspa:out(i)Get the audio output port at the specified index.
+ +
+
+ + +

Functions

+ Methods +
+
+ + ladspa.info(spec) +
+
+ Get information about a specific plugin.

+ +

Plugin specifications are written in the format <path>:<plugin>, +where <path> is the full name of the plugin library +(e.g. caps.so), and <plugin> is the name or label of the plugin. +If <path> is not an absolute path, the library is searched for +first in the current directory, then in LADSPA_PATH.

+ +

This can be used to generate more ergonomic plugin interfaces. + + +

Parameters:

+
    +
  • spec + string + Plugin specification. +
  • +
+ +

Returns:

+
    + + table + Plugin information. +
+ + + + +
+
+ + ladspa.lib_info(path) +
+
+ List plugins in the specified plugin library.

+ +

If path is not an absolute path, the library is searched for +first in the current directory, then in LADSPA_PATH. + + +

Parameters:

+
    +
  • path + string + Path to plugin library. +
  • +
+ +

Returns:

+
    + + table + List of short plugin descriptions. +
+ + + + +
+
+ + ladspa.load(spec, ...) +
+
+ Load a ladspa plugin.

+ +

Input signals are connected to the plugins audio input ports in the +order that they are declared. + + +

Parameters:

+
    +
  • spec + string + Plugin specification. +
  • +
  • ... + channel + Input signals. +
  • +
+ + + + + +
+
+

Methods

+ +
+
+ + ladspa:control(i, v) +
+
+ Set the value of an input control port.

+ +

Ports are indexed based on the order they are declared by the plugin. +This also means the indices of control ports are not necessarily consecutive. + + +

Parameters:

+
    +
  • i + integer + One-based port index. +
  • +
  • v + number + New control port value. +
  • +
+ + + + + +
+
+ + ladspa:out(i) +
+
+ Get the audio output port at the specified index.

+ +

Ports are indexed based on the order they are declared by the plugin. +This also means the indices of audio ports are not necessarily consecutive. + + +

Parameters:

+
    +
  • i + integer + One-based port index. +
  • +
+ +

Returns:

+
    + + channel + Audio output at specified index. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/mixer.html b/doc/classes/mixer.html new file mode 100644 index 0000000..2f8625c --- /dev/null +++ b/doc/classes/mixer.html @@ -0,0 +1,139 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class mixer

+

Mix signals.

+

+ + + +

+local mmixer = require 'melisma.mixer'
+
+local signals = ...
+local mixer = mmixer.init(table.unpack(signals))
+
+ +

+ + +

Functions

+ + + + + +
mixer.init(...)Mix input signals in to a single output signal.
+ +
+
+ + +

Functions

+ Methods +
+
+ + mixer.init(...) +
+
+ Mix input signals in to a single output signal. + + +

Parameters:

+
    +
  • ... + channel + Input signals. +
  • +
+ +

Returns:

+
    + + mixer + The newly created mixer unit. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/nullsink.html b/doc/classes/nullsink.html new file mode 100644 index 0000000..d8a611b --- /dev/null +++ b/doc/classes/nullsink.html @@ -0,0 +1,188 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class nullsink

+

Reference otherwise disconnected nodes.

+

+ + + +

+local mnullsink = require 'melisma.nullsink'
+local minterp = require 'melisma.interp'
+local mevent = require 'melisma.event'
+
+local interp = minterp.init(0)
+interp:linear(1,60)
+
+-- The output of interp is disconnected.
+-- Need to connect it to a nullsink so we
+-- can sample it in the event callback below.
+local nullsink = mnullsink.init()
+nullsink:ref(interp)
+
+mevent.schedule(30, function()
+    print('current value:', interp:sample())
+end)
+
+ +

+ + +

Functions

+ + + + + +
nullsink.init()Create a nullsink.
+

Methods

+ + + + + +
nullsink:ref(input)Connect an input signal.
+ +
+
+ + +

Functions

+ Methods +
+
+ + nullsink.init() +
+
+ Create a nullsink. + + + +

Returns:

+
    + + nullsink + The newly created nullsink. +
+ + + + +
+
+

Methods

+ +
+
+ + nullsink:ref(input) +
+
+ Connect an input signal.

+ +

This makes sure the input signal is processed +even if it's not connected to anything else. + + +

Parameters:

+
    +
  • input + channel + Input signal. +
  • +
+ +

Returns:

+
    + + nullsink + + + +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/oscil.html b/doc/classes/oscil.html new file mode 100644 index 0000000..5aea703 --- /dev/null +++ b/doc/classes/oscil.html @@ -0,0 +1,392 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class oscil

+

Wavetable backed oscillators.

+

+ + + +

+local moscil = require 'melisma.oscil'
+local mexpression = require 'melisma.expression'
+
+local wt = moscil.wavetable.sin()
+
+-- Make an LFO for controlling the frequency.
+local lfo_oscil = moscil.init(wt,1,1)
+
+-- Map [-1, 1] to [440, 880]
+local lfo = (440 + (1 + mexpression.input(lfo_oscil,0) / 2) * 440):build()
+
+local oscil = moscil.init(wt,0,0.5)
+oscil:mapf(lfo)
+
+ +

+ + +

Functions

+ + + + + +
oscil.init(wt, freq, amp)Initialize an oscillator.
+

Methods

+ + + + + + + + + + + + + + + + + + + + + +
oscil:mapa(sig)Map a signal to the amplitude.
oscil:mapf(sig)Map a signal to the frequency.
oscil:sample()Get the current oscillator value.
oscil:seta(amp)Set oscillator amplitude.
oscil:setf(freq)Set oscillator frequency.
+

Class wavetable

+ + + + + + + + + + + + + +
wavetable.saw()Saw wave.
wavetable.sin()Sine wave.
wavetable.square()Square wave.
+ +
+
+ + +

Functions

+ Methods +
+
+ + oscil.init(wt, freq, amp) +
+
+ Initialize an oscillator. + + +

Parameters:

+
    +
  • wt + wavetable + + + +
  • +
  • freq + number + + + +
  • +
  • amp + number + + + +
  • +
+ +

Returns:

+
    + + oscil + + + +
+ + + + +
+
+

Methods

+ +
+
+ + oscil:mapa(sig) +
+
+ Map a signal to the amplitude. + + +

Parameters:

+
    +
  • sig + channel + + + +
  • +
+ + + + + +
+
+ + oscil:mapf(sig) +
+
+ Map a signal to the frequency. + + +

Parameters:

+
    +
  • sig + channel + + + +
  • +
+ + + + + +
+
+ + oscil:sample() +
+
+ Get the current oscillator value. + + + +

Returns:

+
    + + number + + + +
+ + + + +
+
+ + oscil:seta(amp) +
+
+ Set oscillator amplitude. + + +

Parameters:

+
    +
  • amp + number + + + +
  • +
+ + + + + +
+
+ + oscil:setf(freq) +
+
+ Set oscillator frequency. + + +

Parameters:

+
    +
  • freq + number + + + +
  • +
+ + + + + +
+
+

Class wavetable

+ +
+
+ + wavetable.saw() +
+
+ Saw wave. + + + +

Returns:

+
    + + wavetable + + + +
+ + + + +
+
+ + wavetable.sin() +
+
+ Sine wave. + + + +

Returns:

+
    + + wavetable + + + +
+ + + + +
+
+ + wavetable.square() +
+
+ Square wave. + + + +

Returns:

+
    + + wavetable + + + +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/pan.html b/doc/classes/pan.html new file mode 100644 index 0000000..1728b7c --- /dev/null +++ b/doc/classes/pan.html @@ -0,0 +1,240 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class pan

+

Panning

+

+ +

+local mpan = require 'melisma.pan'
+local mexpression = require 'melisma.expression'
+local moscil = require 'melisma.oscil'
+
+local wt = moscil.wavetable.sin()
+local lfo_oscil = moscil.init(wt,1,1)
+local lfo = (1 + mexpression.input(lfo_oscil,0) / 2):build()
+
+local oscil = moscil.init(wt,440,0.5)
+local pan = mpan.init(lfo,oscil)
+
+local left = pan:left()
+local right = pan:right()
+
+ +

+ + +

Functions

+ + + + + +
pan.init(x, sig)Initialize a panning unit.
+

Methods

+ + + + + + + + + + + + + +
pan:left()Get the left output signal.
pan:right()Get the right output signal.
pan:set(x)Set the panning value.
+ +
+
+ + +

Functions

+ Methods +
+
+ + pan.init(x, sig) +
+
+ Initialize a panning unit.

+ +

A panning value ranges from 0 to 1, where a value of 0 +will pan everything to the left. + + +

Parameters:

+
    +
  • x + number or channel + Constant pan or a controlling signal. +
  • +
  • sig + channel + Input signal. +
  • +
+ +

Returns:

+
    + + pan + The newly created panning unit. +
+ + + + +
+
+

Methods

+ +
+
+ + pan:left() +
+
+ Get the left output signal. + + + +

Returns:

+
    + + channel + + + +
+ + + + +
+
+ + pan:right() +
+
+ Get the right output signal. + + + +

Returns:

+
    + + channel + + + +
+ + + + +
+
+ + pan:set(x) +
+
+ Set the panning value. + + +

Parameters:

+
    +
  • x + number + + + +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/playback.html b/doc/classes/playback.html new file mode 100644 index 0000000..fcee0d6 --- /dev/null +++ b/doc/classes/playback.html @@ -0,0 +1,331 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class playback

+

Audio sample playback.

+

+ + + +

+local msample = require 'melisma.sample'
+local mplayback = require 'melisma.playback'
+
+local sample = msample.load('sample.wav')
+local playb = mplayback.init(sample)
+
+playb:loop(true)
+playb:spped(2)
+playb:play()
+
+ +

+ + +

Functions

+ + + + + +
playback.init(smp)Intialize a playback unit.
+

Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
playback:loop(b)Enable/disable automatic looping.
playback:pause()Pause playback.
playback:phase(x)Set playback phase.
playback:play()Start playback.
playback:reset()Reset playback.
playback:reset()Set playback speed.
playback:set_sample(smp)Set playback sample.
playback:stop()Stop playback.
+ +
+
+ + +

Functions

+ Methods +
+
+ + playback.init(smp) +
+
+ Intialize a playback unit. + + +

Parameters:

+
    +
  • smp + sample or nil + + + +
  • +
+ +

Returns:

+
    + + playback + + + +
+ + + + +
+
+

Methods

+ +
+
+ + playback:loop(b) +
+
+ Enable/disable automatic looping. + + +

Parameters:

+
    +
  • b + bool + + + +
  • +
+ + + + + +
+
+ + playback:pause() +
+
+ Pause playback. + + + + + + + +
+
+ + playback:phase(x) +
+
+ Set playback phase. + + +

Parameters:

+
    +
  • x + number + Phase ranging from 0 to 1. +
  • +
+ + + + + +
+
+ + playback:play() +
+
+ Start playback. + + + + + + + +
+
+ + playback:reset() +
+
+ Reset playback.

+ +

Equivalent to playback.phase(0). + + + + + + + +

+
+ + playback:reset() +
+
+ Set playback speed.

+ +

A negative speed will play the sample in reverse. + + + + + + + +

+
+ + playback:set_sample(smp) +
+
+ Set playback sample. + + +

Parameters:

+ + + + + + +
+
+ + playback:stop() +
+
+ Stop playback.

+ +

Equivalent to playback.pause; playback.reset. + + + + + + + +

+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/sample.html b/doc/classes/sample.html new file mode 100644 index 0000000..313d14d --- /dev/null +++ b/doc/classes/sample.html @@ -0,0 +1,203 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class sample

+

Load audio samples.

+

+ + + +

+local msample = require 'melisma.sample'
+
+local smp = msample.load('sample.wav')
+
+print(smp:length())
+print(smp:path())
+
+ +

+ + +

Functions

+ + + + + +
sample.load(path)Load an audio sample.
+

Methods

+ + + + + + + + + +
sample:length()Get sample length.
sample:path()Get sample path.
+ +
+
+ + +

Functions

+ Methods +
+
+ + sample.load(path) +
+
+ Load an audio sample.

+ +

If necessary, the audio will be resampled to the current sample rate. + + +

Parameters:

+ + +

Returns:

+
    + + sample + + + +
+ + + + +
+
+

Methods

+ +
+
+ + sample:length() +
+
+ Get sample length. + + + +

Returns:

+
    + + number + The length of the sample in seconds. +
+ + + + +
+
+ + sample:path() +
+
+ Get sample path. + + + +

Returns:

+
    + + string + The path that the sample was loaded from. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/serial.html b/doc/classes/serial.html new file mode 100644 index 0000000..ca72d57 --- /dev/null +++ b/doc/classes/serial.html @@ -0,0 +1,161 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class serial

+

Read data on serial ports.

+

+ + + +

+local mserial = require 'melisma.serial'
+
+mserial.open {
+    path = '/dev/ttyACM0',
+    callback = print,
+}
+
+ +

+ + +

Functions

+ + + + + +
serial.open(conf)Open a serial port.
+ +
+
+ + +

Functions

+ Methods +
+
+ + serial.open(conf) +
+
+ +

Open a serial port.

+ +

conf is a table containing the following keys:

+ +
    +
  • path (string, required): Path to serial port (e.g. /dev/ttyACM0).
  • +
  • callback (function, required): Callback function for handling messages.
  • +
  • baud (integer); baud rate (default 9600).
  • +
  • format (string): frame format (default '8N1').
  • +
  • encoding (string): method for encoding messages (default 'cstring'). May be one of: +
      +
    • 'cstring': NULL-terminated strings.
    • +
  • +
+ + + + +

Parameters:

+
    +
  • conf + table + + + +
  • +
+ +

Returns:

+
    + + serial + + + +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/classes/timer.html b/doc/classes/timer.html new file mode 100644 index 0000000..a6b16c8 --- /dev/null +++ b/doc/classes/timer.html @@ -0,0 +1,226 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class timer

+

Time measurement.

+

+ + + +

+local mtimer = require 'melisma.timer'
+local mkeycallback = require 'melisma.keycallback'
+
+local timer = mtimer.init()
+timer:start()
+
+mkeycallback.set(function()
+    print(timer:read())
+    timer:reset()
+end)
+
+ +

+ + +

Functions

+ + + + + +
timer.init()Create a new timer.
+

Methods

+ + + + + + + + + + + + + + + + + +
timer:read()Read timer.
timer:reset()Reset timer.
timer:start()Start timer.
timer:stop()Stop timer.
+ +
+
+ + +

Functions

+ Methods +
+
+ + timer.init() +
+
+ Create a new timer. + + + +

Returns:

+
    + + timer + + + +
+ + + + +
+
+

Methods

+ +
+
+ + timer:read() +
+
+ Read timer. + + + +

Returns:

+
    + + number + Elapsed seconds. +
+ + + + +
+
+ + timer:reset() +
+
+ Reset timer. + + + + + + + +
+
+ + timer:start() +
+
+ Start timer. + + + + + + + +
+
+ + timer:stop() +
+
+ Stop timer. + + + + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..f7d3c3e --- /dev/null +++ b/doc/index.html @@ -0,0 +1,153 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ + +

Melisma module reference

+ +

Modules

+ + + + + + + + + + + + + + + + + + + + + +
biquadDigital biquad filters.
expressionBuild filters with arithmetic expressions.
fsFile system utilities.
keycallbackSet callback for keyboard input.
udpUDP support.
+

Classes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bufferAudio buffer for capture/playback.
delayDigital delay line.
gainApply gain to signals.
interpInterpolation.
ladspaLADSPA plugin support.
mixerMix signals.
nullsinkReference otherwise disconnected nodes.
oscilWavetable backed oscillators.
panPanning
playbackAudio sample playback.
sampleLoad audio samples.
serialRead data on serial ports.
timerTime measurement.
+ +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/ldoc_fixed.css b/doc/ldoc_fixed.css new file mode 100644 index 0000000..d7c7a6e --- /dev/null +++ b/doc/ldoc_fixed.css @@ -0,0 +1,312 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid #C0C0C0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #ffffff; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color:#FFFFFF; // #f0f0f0; + border-left: 1px solid #cccccc; +} + +#navigation { + position: fixed; + top: 0; + left: 0; + float: left; + width: 14em; + vertical-align: top; + background-color:#FFFFFF; // #f0f0f0; + border-right: 2px solid #cccccc; + overflow: visible; + overflow-y: scroll; + height: 100%; + padding-left: 1em; +} + +#navigation h2 { + background-color:#FFFFFF;//:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + padding-left: 2em; + width: 700px; + border-left: 2px solid #cccccc; + // border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding-left: 1em; + margin-left: 14em; // avoid the damn sidebar! + border-top: 2px solid #cccccc; + border-left: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; ; min-width: 200px; } +table.module_list td.summary { width: 100%; } + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f6f6ff; ; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +ul.nowrap { + overflow:auto; + whitespace:nowrap; +} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .function-name { color: #60447f; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .user-keyword { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } + diff --git a/doc/modules/biquad.html b/doc/modules/biquad.html new file mode 100644 index 0000000..4f89b1a --- /dev/null +++ b/doc/modules/biquad.html @@ -0,0 +1,189 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module biquad

+

Digital biquad filters.

+

+ +

+ + +

Class biquad.lowpass

+ + + + + + + + + + + + + +
biquad.lowpass.init(input)Create a lowpass filter.
lowpass:cutoff(cut)Set filter cutoff frequency.
lowpass:resonance(res)Set filter resonance.
+ +
+
+ + +

Class biquad.lowpass

+ +
+ Lowpass filter. +
+

Usage:

+
local mbiquad = require 'melisma.biquad'
+local input = ...
+local lowpass = mbiquad.lowpass.init(node, 2000, 0.6)
+lowpass:resonance(1000)
+lowpass:cutoff(0.25)
+
+
+ + biquad.lowpass.init(input) +
+
+ Create a lowpass filter. + + +

Parameters:

+
    +
  • input + channel + Input signal. +
  • +
+ +

Returns:

+
    + + biquad.lowpass + The newly created lowpass filter. +
+ + + + +
+
+ + lowpass:cutoff(cut) +
+
+ Set filter cutoff frequency. + + +

Parameters:

+
    +
  • cut + number + Cutoff frequency. +
  • +
+ + + + + +
+
+ + lowpass:resonance(res) +
+
+ Set filter resonance. + + +

Parameters:

+
    +
  • res + number + Resonance. +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/modules/expression.html b/doc/modules/expression.html new file mode 100644 index 0000000..e0f2f6e --- /dev/null +++ b/doc/modules/expression.html @@ -0,0 +1,221 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module expression

+

Build filters with arithmetic expressions.

+

+ + + +

+local mexpression = require 'melisma.expression'
+local input = mepxression.input
+
+local lhs = ...
+local rhs = ...
+
+local script = input(lhs,0) + 0.5 * input(rhs,10)
+local expression = script:build()
+
+ +

+ + +

Functions

+ + + + + + + + + +
input(sig, off)Introduce an input signal in the expression.
output(off)Introduce the output signal in the expression.
+

Class script

+ + + + + +
script:build()Compile an expression script.
+ +
+
+ + +

Functions

+ Methods +
+
+ + input(sig, off) +
+
+ Introduce an input signal in the expression. + + +

Parameters:

+
    +
  • sig + channel + Input signal. +
  • +
  • off + integer + Offset in no. of samples. +
  • +
+ +

Returns:

+
    + + script + + + +
+ + + + +
+
+ + output(off) +
+
+ Introduce the output signal in the expression. + + +

Parameters:

+
    +
  • off + integer + Offset in no. of samples. +
  • +
+ +

Returns:

+
    + + script + + + +
+ + + + +
+
+

Class script

+ +
+ Represents an expression before compilation. +Implements __add, __sub, __mul and __div for +combining scripts in to larger ones. +
+
+
+ + script:build() +
+
+ Compile an expression script. + + + +

Returns:

+
    + + expression + + + +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/modules/fs.html b/doc/modules/fs.html new file mode 100644 index 0000000..bfe5be3 --- /dev/null +++ b/doc/modules/fs.html @@ -0,0 +1,138 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module fs

+

File system utilities.

+

+ +

+ + +

Functions

+ + + + + +
readdir(path)List directory contents.
+ +
+
+ + +

Functions

+ Methods +
+
+ + readdir(path) +
+
+ List directory contents. + + +

Parameters:

+
    +
  • path + string + Directory path. +
  • +
+ +

Returns:

+
    + + table + Directory contents. +
+ + + +

Usage:

+
    +
    local fs = require 'melisma.fs'
    +local contents = fs.readdir('.')
    +for _,entry in ipairs(contents) do
    +	print(entry.name, entry.type)
    +end
    +
+ +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/modules/keycallback.html b/doc/modules/keycallback.html new file mode 100644 index 0000000..af74b90 --- /dev/null +++ b/doc/modules/keycallback.html @@ -0,0 +1,133 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module keycallback

+

Set callback for keyboard input.

+

+ + +

+local mkeycallback = require 'melisma.keycallback'
+
+mkeycallback.set(function(c)
+    print('you pressed', c)
+end)
+
+ +

+ + +

Functions

+ + + + + +
set(fn)Set the callback.
+ +
+
+ + +

Functions

+ Methods +
+
+ + set(fn) +
+
+ Set the callback. + + +

Parameters:

+
    +
  • fn + function + Callback function. +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + diff --git a/doc/modules/udp.html b/doc/modules/udp.html new file mode 100644 index 0000000..f19c300 --- /dev/null +++ b/doc/modules/udp.html @@ -0,0 +1,311 @@ + + + + + Melisma modules + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module udp

+

UDP support.

+

+ + + +

+local mudp = require 'melisma.udp'
+
+local addr = mudp.sockaddr.inet('127.0.0.1',8000)
+local sock = mudp.socket.inet()
+
+sock:send(addr,'hello')
+sock:bind(addr,print)
+
+ +

+ + +

Class sockaddr

+ + + + + + + + + +
sockaddr.inet(host, port)Create a internet domain address description.
sockaddr.unix(path)Create a unix domain address description.
+

Class socket

+ + + + + + + + + + + + + + + + + +
socket.inet()Create an internet domain socket.
socket.unix()Create a unix domain socket.
socket:bind(addr, fn)Bind a socket to an address.
socket:send(addr, pkt)Send a packet on a socket.
+ +
+
+ + +

Class sockaddr

+ +
+ Socket address description. +
+
+
+ + sockaddr.inet(host, port) +
+
+ Create a internet domain address description. + + +

Parameters:

+
    +
  • host + string + + + +
  • +
  • port + integer + + + +
  • +
+ +

Returns:

+
    + + sockaddr + + + +
+ + + + +
+
+ + sockaddr.unix(path) +
+
+ Create a unix domain address description. + + +

Parameters:

+ + +

Returns:

+
    + + sockaddr + + + +
+ + + + +
+
+

Class socket

+ +
+ Handle to a socket. +
+
+
+ + socket.inet() +
+
+ Create an internet domain socket. + + + +

Returns:

+
    + + socket + + + +
+ + + + +
+
+ + socket.unix() +
+
+ Create a unix domain socket. + + + +

Returns:

+
    + + socket + + + +
+ + + + +
+
+ + socket:bind(addr, fn) +
+
+ Bind a socket to an address. + + +

Parameters:

+
    +
  • addr + sockaddr + Address description. +
  • +
  • fn + function + Packet callback function. +
  • +
+ + + + + +
+
+ + socket:send(addr, pkt) +
+
+ Send a packet on a socket. + + +

Parameters:

+
    +
  • addr + sockaddr + Address description. +
  • +
  • pkt + string + Packet to send. +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.5.0 +Last updated 1980-01-01 00:00:00 +
+
+ + -- cgit v1.3.1