7 months ago

Basically you use the eqe raw command in terminal. You can either run it with no arguments to get a REPL, or load a script in like this: eqe raw < script.lua

Here are some examples, basically just copy/paste the code into a file script.lua and run eqe raw < script.lua

Examples

This replaces the audio output with white noise:

raw.lua = function(audio, num_samples, num_channels, sample_rate)
    for i=0,num_samples-1 do
        for c=0,num_channels-1 do
            local a = math.random() - 0.5
            audio[c][i] = a
        end
    end
end

This applies the white noise on top of the normal output (instead of replacing it):

raw.lua = function(audio, num_samples, num_channels, sample_rate)
    for i=0,num_samples-1 do
        for c=0,num_channels-1 do
            local a = math.random() - 0.5
            audio[c][i] = audio[c][i] + a*0.2
        end
    end
end

This replaces the audio with a sin wave:

local freq = 200
function set_freq(f)
    freq = f
end

local omega = 0
raw.lua = function(audio, num_samples, num_channels, sample_rate)
    for i=0,num_samples-1 do
        omega = omega + freq * math.pi * 2 / sample_rate
        local a = math.sin(omega)
        for c=0,num_channels-1 do
            audio[c][i] = a
        end
    end
end
Terms