This file contains 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
#include <algorithm> | |
#include <cassert> | |
#include <cmath> | |
#include <concepts> | |
#include <iostream> | |
#include <memory> | |
#include <random> | |
#include <span> | |
#include <sys/types.h> | |
#include <vector> |
This file contains 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
:root { | |
--color-bg: #1e1e1e; | |
--color-fg: #d4d4d4; | |
--color-fg-100: #555555; | |
--color-fg-200: #646464; | |
--color-fg-300: #dcdcdc; | |
--color-fg-400: #9cdcfe; | |
--color-input-fg: #d4d4d4; | |
--color-input-bg: #3c3c3c; | |
--color-link: #3794ff; |
This file contains 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 Data.Complex (Complex((:+))) | |
data IIRParams = IIRParams | |
{ b0 :: Float | |
, b1 :: Float | |
, b2 :: Float | |
, a0 :: Float | |
, a1 :: Float | |
, a2 :: Float | |
} |
This file contains 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
#include <iostream> | |
#include <vector> | |
#include <stdexcept> | |
#include <algorithm> | |
#include <cmath> | |
#include <iomanip> | |
#include <ranges> | |
bool allClose(const std::vector<double>& vec, double value, double rtol) { | |
return std::ranges::all_of(vec, [=](double v) { return std::abs(v - value) <= rtol; }); |
This file contains 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
/* | |
* | |
* | |
* - `nth_order_system` Class: Manages the nth-order filter, including its | |
* internal state and coefficients. | |
* - `compute_sample`: Computes a single output sample based on the input and | |
* current state using Direct Form II Transposed structure. | |
* - `set_coefficients`: Sets new filter coefficients. | |
* - `reset`: Resets the internal state variables. | |
* |
This file contains 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
#!/bin/bash | |
set -e | |
TARGETDIR="$HOME/org/" | |
stderr () { | |
echo "$1" >&2 | |
} |
This file contains 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 numpy as np | |
from scipy.signal import iirdesign, freqz | |
import matplotlib.pyplot as plt | |
# Define the desired frequency response | |
def desired_frequency_response(w): | |
return np.abs(np.sin(2 * np.pi * w) + 0.5 * np.cos(4 * np.pi * w)) | |
# Frequency points | |
freqs = np.linspace(0, 1, 8000) |
This file contains 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("stdfaust.lib"); | |
freq = hslider("freq", 440, 20, 20000, 0.01); | |
process = os.osc(freq) <: _, _; | |
faust -lang llvm sine_wave.dsp -o sine_wave.ll | |
-} |
This file contains 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
#include <algorithm> | |
#include <chrono> | |
#include <cmath> | |
#include <execution> | |
#include <iostream> | |
#include <numeric> | |
#include <random> | |
#include <stdexcept> | |
#include <vector> |
This file contains 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
#include <algorithm> | |
#include <chrono> | |
#include <execution> | |
#include <iostream> | |
#include <numeric> | |
#include <random> | |
#include <vector> | |
class RandomNumberGenerator { | |
public: |
NewerOlder