Skip to content

Instantly share code, notes, and snippets.

Avatar

Coder of Salvation / Leon van Kammen coderofsalvation

View GitHub Profile
@coderofsalvation
coderofsalvation / wav2csound
Created Jul 27, 2022
convert wav 2 csound using awk
View wav2csound
#!/bin/sh
# usage: ./wav2csound sample.wav >> mysong.csd
test -z $1 && {
echo "usage: wav2csound sample.wav";
echo " wav2csound sample.wav >> mysong.csd"
exit 0;
}
{
@coderofsalvation
coderofsalvation / example.zip
Last active Aug 2, 2022
tiddlywiki + redbean server (1.2MB)
View example.zip
This file has been truncated, but you can view the full file.
@coderofsalvation
coderofsalvation / test.sh
Created Jul 25, 2022
highlight color part in string awk bash
View test.sh
echo "0 astroids are hitting your house" | awk '( $1 > 0 ) { $1 = "\033[31m" $1 "\033[0m" } 1'
echo "10 astroids are hitting your house" | awk '( $1 > 0 ) { $1 = "\033[31m" $1 "\033[0m" } 1'
@coderofsalvation
coderofsalvation / README.md
Last active Jul 1, 2022
WebSpeechApi support in 2022
View README.md

WebSpeechApi support in 2022

The browser/library support for speech is not great in my experiments:

browsers

  • Chrome 70
  • Firefox 96.0
  • Oculus browser
  • Brave 100.1
@coderofsalvation
coderofsalvation / batch.pd
Created Jun 28, 2022
batch file commandline puredata example
View batch.pd
#N canvas 378 163 705 465 12;
#X obj 99 19 osc~ 440;
#X obj 99 319 writesf~;
#X obj 252 6 loadbang;
#X msg 123 105 open ./osc440.wav \, start;
#X msg 123 59 \; pd dsp 1 \;;
#X msg 252 266 stop;
#X obj 252 156 del 20000;
#X msg 308 256 \; pd quit \;;
#X text 292 201 <-- disconnect here in 3...2...1...;
@coderofsalvation
coderofsalvation / bookmarklet.html
Last active Jun 12, 2022
bookmarketlet to mark clicked images as seen
View bookmarklet.html
<a href="javascript:(function()%7BsetInterval(%20()%20%3D%3E%20%7B%0A%20%20%20%20let%20imgs%20%3D%20%5B...document.querySelectorAll(%22img%22)%5D%0A%20%20%20%20imgs.map(%20(i)%20%3D%3E%20%7B%0A%20%20%20%20%20%20let%20rec%20%3D%20localStorage.getItem(i.src)%3B%0A%20%20%20%20%20%20if(%20rec%20)%7B%0A%20%20%20%20%20%20%20%20i.style.opacity%20%3D%200.15%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20i.addEventListener('click'%2C%20((i)%20%3D%3E%20()%20%3D%3E%20localStorage.setItem(i.src%2C'%7B%7D'))(i)%20)%0A%20%20%20%20%7D)%0A%7D%2C2000)%7D)()%3B">marketplace_seenmarker</a>
@coderofsalvation
coderofsalvation / MANIFESTO.md
Last active Jun 30, 2022
unix dsp's (UD's) as offline alternative to VST/LV2 plugins)
View MANIFESTO.md

Unix DSP processors (UDSP's)

Let's face it, non-realtime audio is as important as realtime audio.
UDSP's are a great offline alternative to realtime plugins, which allow for polyglot-scriptable synth & fx-chains.

crossplatform example UD

$ ./myudsp[.exe] [-o out.wav] [-n 60] [in1.wav in2.wav ..] # on unix/mac/linux
@coderofsalvation
coderofsalvation / startpods
Last active May 26, 2022
start pods on boot
View startpods
#!/bin/sh
# usage:
# 1. put podi project;s in /home/foo/projectname
# 2. to disable podboot create /home/foo/projectname/podi.stop
# 3. install service using './startpods install'
start(){
apps="$(find /home/*/*/podi)"
for app in $apps; do
test -f $app".noboot" && continue
user=$(echo $app | awk -F'/' '{ print $3 }')
@coderofsalvation
coderofsalvation / test.c
Created May 5, 2022
scaling limiter attempt
View test.c
// problem: it's bad
if( treshold > 0.0f ){
float avg = srcL + srcR;
if( avg > peak ) peak = avg;
buffer[i] = (mp_sint32)( tanh(srcL*1.2) * 1.31 * max); // compand once
buffer[i+1] = (mp_sint32)( tanh(srcR*1.2) * 1.31 * max); // compand once
if( ZEROCROSSING(srcL+srcR,lastL) ){
for( ; offset <= i; offset+=2 ){
float L = (float)buffer[offset]*(1.0/max);
float R = (float)buffer[offset+1]*(1.0/max);
@coderofsalvation
coderofsalvation / fft.sh
Created May 1, 2022
ffmpeg example template for audio fft processing #filtergraph #batch
View fft.sh
#!/bin/bash
# the following mixes 2 FFT-expressions into a dry (FFT) signal
set -e
in=/tmp/somefile.wav
out="$in.ffmpeg.wav"
winsize=1024
fft_a_r="real='0'"
fft_a_i="imag='tanh(re / 8) * lt(b,4)" # bins 0-4
fft_b_r="real='0'"
fft_b_i="imag='tanh(re * 1.8) * gt(b,150) * lt(b,512)'" # bins 150-512