This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FFT Stockham | |
# http://wwwa.pikara.ne.jp/okojisan/otfft-en/optimization1.html | |
# original source of scalar Nim version by "Amb" : | |
# https://gist.github.com/amb/4f70bcbea897024452d683b40d18be1f | |
# Timings | |
# === Scalar float64 === | |
# FFT/IFFT test on 4096 points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils | |
import math | |
import complex | |
const | |
SampleRate = 8000.0 # 8kHz | |
TargetFrequency = 941.0 # 941 Hz | |
FFTSize = 205 | |
N = FFTSize # Block size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moved to https://github.com/jean-emmanuel/lua_scripts/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare name "PM String"; | |
declare version "0.1"; | |
declare author "Christopher Arndt"; | |
declare license "MIT License"; | |
declare description "A simple physical model of a guitar-like plucked string"; | |
// Create a JACK/Qt app with: | |
// | |
// faust2jaqt -nvoices 6 -midi pmstring.dsp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: as-is, this does NOT work correctly with faust2lv2, since it does not support MIDI input via the "key" parameter. | |
// It does work with the FAUST web IDE and Faust Live, though. | |
declare name "FB / Noise / FM Drum Voice"; | |
declare version "0.1"; | |
declare author "Christopher Arndt"; | |
declare license "MIT License"; | |
declare description "A drum and percussion synth with three components: band-limited noise through a feedback delay, noise and FM"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Goertzel oscillator bank (scalar): | |
# (seconds: 208, nanosecond: 253406100) | |
# duration: 4440s samplerate: 44100 samples: 195804000 | |
# 0.0000010635809590202449 seconds per sample @ 1000 oscillators | |
# Goertzel AVX oscillator bank: | |
# (seconds: 26, nanosecond: 403254200) | |
# duration: 4440s samplerate: 44100 samples: 195804000 | |
# 0.00000013484532593818306 seconds per sample @ 1000 oscillators | |
# Speedup: 7.887414351371886x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OTFFT library | |
# http://wwwa.pikara.ne.jp/okojisan/otfft-en/optimization1.html | |
# This is +20-50% improvement | |
const thetaLutSize = 2048 | |
const thetaLut = static: | |
var arr: array[thetaLutSize, Complex[float]] | |
let step = 2.0*PI/float(thetaLutSize) | |
for k, v in mpairs(arr): | |
v = complex(cos(step * float(k)), -sin(step * float(k))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnitRangeMapReciprocal { | |
double vMin, vTopFactor, vBottomFactor; | |
public: | |
UnitRangeMapReciprocal() : UnitRangeMapReciprocal(0, 0.5, 1) {} | |
UnitRangeMapReciprocal(double min, double mid, double max) { | |
vMin = min; | |
double k = (mid - min)/(max - mid); | |
vTopFactor = max*k - min; | |
vBottomFactor = k - 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncnet, asyncdispatch, nativesockets | |
proc discover(): Future[string] {.async.} = | |
let socket = newAsyncSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) | |
socket.setSockOpt(OptReuseAddr, true) | |
socket.setSockOpt(OptReusePort, true) | |
socket.setSockOpt(OptBroadcast, true) | |
await socket.sendTo("255.255.255.255", Port(12346), $0b10) | |
var data = await socket.recvFrom(15) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"> | |
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> | |
<xsl:template match="/"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> | |
<head> | |
<title><xsl:value-of select="/rss/channel/title"/> RSS Feed</title> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" /> | |
<meta http-equiv="content-language" content="en_US" /> |
NewerOlder