Skip to content

Instantly share code, notes, and snippets.

View faroit's full-sized avatar
🚀
Crafting narrow ai

Fabian-Robert Stöter faroit

🚀
Crafting narrow ai
View GitHub Profile
@faroit
faroit / denoise.py
Last active April 29, 2026 12:00
DeepFilterNet2 single-file denoiser CLI (single file or recursive folder, with inline uv deps)
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9,<3.12"
# dependencies = [
# "torch>=2.0,<2.2",
# "torchaudio>=2.0,<2.2",
# "deepfilternet==0.5.6",
# "numpy<2",
# "soundfile",
# ]
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "mlx-audio",
# "numpy",
# "pyqtgraph",
# "PyQt6",
# "sounddevice",
# ]
# ///
@faroit
faroit / alpha_stable_noise_movie.py
Last active August 23, 2021 07:17
alpha stable noise
import matplotlib.animation as animation
import matplotlib.pyplot as plt
from collections import deque
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation
import scipy.stats
plt.style.use('seaborn-pastel')
@faroit
faroit / Dockerfile
Created July 26, 2019 20:18
torchaudio installation using using only conda
FROM continuumio/miniconda3
RUN apt-get update
RUN apt-get install -y gcc build-essential g++
RUN conda install -c conda-forge sox
RUN conda install -c pytorch pytorch
RUN git clone https://github.com/pytorch/audio.git
RUN cd audio && python setup.py install
@faroit
faroit / pescador_sampling.py
Created July 18, 2019 15:26
Using pescador to sample random chunks from spectrograms (saved as npy matrices)
import numpy as np
import data
import pescador
import random
def excerpt_generator(
dataset, idx,
ex_length=100, ex_hop=100,
shuffle=True, rnd_ex=False, seed=42
import numpy as np
import pescador
import torch.utils.data
np.random.seed(42)
nb_tracks = 100
track_length = 30
excerpt_length = 10
@faroit
faroit / count.py
Last active June 16, 2017 12:05
Count audio track duration
import soundfile as sf
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Count duration of input files')
parser.add_argument('inputs', nargs='+', help='input file names')
args = parser.parse_args()
@faroit
faroit / 32ch_chromium.patch
Last active March 19, 2017 16:19
Add more than 8 channel support to chromium
From 40b2c9fb9e3104f437d9f9d420f48e456c788c92 Mon Sep 17 00:00:00 2001
From: Fabian-Robert Stoeter <mail@faroit.com>
Date: Fri, 17 Mar 2017 12:17:46 +0100
Subject: [PATCH] add support for more than 8channels
---
media/base/channel_layout.cc | 10 ++++++++--
media/base/channel_layout.h | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
@faroit
faroit / keras_generator.py
Created March 19, 2017 00:43
threadsafe_generator
import numpy as np
import threading
def threadsafe_generator(lock=None):
def wrap(f):
"""A decorator that takes a generator function and makes it thread-safe.
Taken from
http://anandology.com/blog/using-iterators-and-generators/
@faroit
faroit / pairwise.md
Created October 11, 2016 21:35
pairwise distance comparisons

PYTHON

import scipy.spatial.distance as dist
import numpy as np
import timeit

X = np.random.random((1000, 1000))

def run():
 c = dist.cdist(X, X, 'euclidean')