<commit_before>-- pan effect: horizontally pan a waveform

local wrap = require "wrap"


local defs = { name = 'Pan' }

defs.knobs = {}

defs.knobs.angle = {
    min     = -90.0,
    max     =  90.0,
    default =   0.0,
    label   = 'Angle (degrees)',

    onChange = function(state, newVal)
        local angleRad = math.rad(newVal)

        -- Implement trig formula for equal-power panning.
        state.leftAmp  = math.cos(angleRad) + math.sin(angleRad)
        state.rightAmp = math.cos(angleRad) - math.sin(angleRad)
    end
}

defs.processSamplePair = function(state, left, right)
    return left * state.leftAmp, right * state.rightAmp
end
<commit_msg>Reverse polarity of pan effect, so left = negative<commit_after>-- pan effect: horizontally pan a waveform

local wrap = require "wrap"


local defs = { name = 'Pan' }

defs.knobs = {}

defs.knobs.angle = {
    min     = -90.0,
    max     =  90.0,
    default =   0.0,
    label   = 'Angle (degrees)',

    onChange = function(state, newVal)
        local angleRad = math.rad(newVal)

        -- Implement trig formula for equal-power panning.
        -- 0 degrees is center, -45 full left, 45 full right.
        -- XXX: 90 or -90 should be inverse phase but I don't think
        -- this code does that.
        state.leftAmp  = math.cos(angleRad) - math.sin(angleRad)
        state.rightAmp = math.cos(angleRad) + math.sin(angleRad)
    end
}

defs.processSamplePair = function(state, left, right)
    return left * state.leftAmp, right * state.rightAmp
end

{'fraction_non_alphanumeric': 0.11672131147540983, 'fraction_numerical': 0.01639344262295082, 'mean_word_length': 2.4524886877828056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1495335', 'n_tokens_mistral': 532, 'n_tokens_neox': 507, 'n_words': 143}