Skip to content

Instantly share code, notes, and snippets.

@nomelif
nomelif / decompose.py
Last active December 15, 2021 13:41
Decompose a microphone input by frequency. Depends on PyAudio, Matplotib and NumPy
import pyaudio
import numpy as np
import matplotlib.pyplot as plt
CHUNKSIZE = 1024*2 # fixed chunk size
# initialize portaudio
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16, channels=1, rate=44100, input=True, frames_per_buffer=CHUNKSIZE)

Audionodes demo networks

Here is a heteroclitical collection of different audio networks that were found somewhat interesting.

MIDI-enabled

These are networks that can be played with a MIDI keyboard.

Electric guitar

CC drivers/media/video/camdrv_ss.o
drivers/media/video/camdrv_ss.c:264:3: warning: initialization from incompatible pointer type
.show = rear_flash_show,
^
drivers/media/video/camdrv_ss.c:264:3: warning: (near initialization for 'dev_attr_rear_flash.show')
drivers/media/video/camdrv_ss.c: In function 'camdrv_ss_g_parm':
drivers/media/video/camdrv_ss.c:3915:36: warning: argument to 'sizeof' in 'memcpy' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
memcpy(param, &state->strm, sizeof(param));
^
@nomelif
nomelif / OSL Mason.c
Last active December 8, 2019 20:18
Osl brick shader
// Copyright (c) 2016 Théo Friberg
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE O
#!/bin/bash
g++ -O2 -Wall -std=c++11 $1 --debug && echo "===" && time ./a.out
t _ [] = 0
t !n ('8':rest) = t (n+1) rest
t !n (')':rest) = n + (t n rest)
main = getLine >>= (\l -> print (t 0 l))
# Polygon generator for python3 using numpy.
# Released under the MIT lisence
# Copyright (c) 2017 Théo Friberg & Roope Salmi
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# Polygon generator for python3 using numpy.
# Released under the MIT lisence
# Copyright (c) 2017 Théo Friberg & Roope Salmi
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
@nomelif
nomelif / voicemod.py
Created March 20, 2017 15:40
Skeleton for on-line voice modification scripts. Requires numpy and PyAudio
import pyaudio
import numpy as np
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
CHUNK = 1024
audio = pyaudio.PyAudio()
@nomelif
nomelif / rooliarpoja.py
Last active January 25, 2017 06:30
susirunko.py
# WSGI:n perus kirjasto
from wsgiref.simple_server import make_server
# Tätä funktiota kutsutaan aina, kun selain haluaa sivun
# environ: yleistä tietoutta: mitä sivua kysyttiin, millainen vempain jne jne jne
# start_response: funktio, jolla kerrotaan WSGIlle palautetun kaman tyyppi ja mahdolliset virheet
ilmoittautuneet = []