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 ++++++++++++++++++++++++++ 13 files changed, 3196 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 (limited to 'doc/classes') 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 +
+
+ + -- cgit v1.3.1