Skip to content

Instantly share code, notes, and snippets.

@x42
x42 / hw2.bip
Created November 27, 2020 20:50
#!/tmp/bipscript/build/bipscript
synth <- Lv2.Plugin("http://gareus.org/oss/lv2/b_synth")
eq <- Lv2.Plugin("http://gareus.org/oss/lv2/fil4#stereo")
input <- Midi.Input("my_input")
output <- Audio.StereoOutput("out", true)
input => synth => eq => output
@x42
x42 / tanh.cc
Created January 12, 2021 21:25
#include <cmath>
#include <lv2.h>
static inline float db_to_gain( float x)
{
return powf (10.f, 0.05 * x);
}
struct clipping_tanh {
float *ports[6];
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix pset: <http://lv2plug.in/ns/ext/presets#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix state: <http://lv2plug.in/ns/ext/state#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix zcpset: <http://gareus.org/oss/lv2/zeroconvolv/pset#> .
#define LV2_TinyUI_URI "http://example.org/lv2/tinyUI"
#define LV2_TinyUI_PREFIX LV2_INLINEDISPLAY_URI "#"
#define LV2_TinyUI__interface LV2_INLINEDISPLAY_PREFIX "Interface"
#define LV2_TinyUI__feature LV2_INLINEDISPLAY_PREFIX "Feature"
/** a LV2 Feature provided by the Host to the plugin */
typedef struct {
/** Opaque host data */
LV2UI_Controller controller;
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
ardour {
["type"] = "dsp",
name = "Lua IR Capture and Convolver",
license = "MIT",
author = "Ardour Team",
description = [[Another DSP example]]
}
function dsp_ioconfig () return
{
// gcc -o /tmp/fft-debug fft-debug.c `pkg-config --libs fftw3f` -lm
// /tmp/fft-debug > /tmp/fft.dat
// gnuplot
// plot '/tmp/fft.dat' u 3 w l, '' u 4 w l, '' u 5 w lp
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* needed for M_PI */
#endif
#include <fftw3.h>
@x42
x42 / peak_calc.cc
Last active September 24, 2021 16:20
// -- Linux / Intel --
// g++ -o peak_calc peak_calc.cc -Wall -mavx -lm -O3 -fopt-info && ./peak_calc
// g++ -o peak_calc peak_calc.cc -Wall -msse2 -lm -O3 -fopt-info && ./peak_calc
//
// -- Linux / ARM --
// g++ -o peak_calc peak_calc.cc -Wall -lm -O3 && ./peak_calc
// g++ -o peak_calc peak_calc.cc -Wall -mfpu=neon-vfpv4 -lm -O3 && ./peak_calc
//
// -- macOS --
// g++ -o peak_calc peak_calc.cc -Wall -lm -O3 -framework Accelerate
ardour {
["type"] = "EditorAction",
name = "Close Gaps",
license = "MIT",
author = "Ardour Team",
description = [[Same as Region > Edit > Close Gaps, but for all regions on selected tracks]]
}
function factory () return function ()
@x42
x42 / zenity
Created October 18, 2021 14:42
#!/bin/sh
unset LD_LIBRARY_PATH;
exec /usr/bin/zenity "$@"