Skip to content

Instantly share code, notes, and snippets.

View jurihock's full-sized avatar
💭
Think different.

Jürgen Hock jurihock

💭
Think different.
View GitHub Profile
@endolith
endolith / sinc_interp.m
Created October 19, 2011 01:05
Perfect sinc interpolation in Matlab and Python
% From http://phaseportrait.blogspot.com/2008/06/sinc-interpolation-in-matlab.html
% Ideally "resamples" x vector from s to u by sinc interpolation
function y = sinc_interp(x,s,u)
% Interpolates x sampled sampled at "s" instants
% Output y is sampled at "u" instants ("u" for "upsampled")
% (EXPECTS x, s, and u to be ROW VECTORS!!)
% Find the period of the undersampled signal
T = s(2)-s(1);
@vancluever
vancluever / gnome-tracker-disable.md
Last active July 17, 2024 18:17
GNOME Tracker Disable

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here: http://lduros.net/posts/tracker-sucks-thanks-tracker/

After discovering it chowing 2 cores, I decided to go about disabling it.

Directories

@fasiha
fasiha / README.md
Last active October 2, 2022 22:36
Pitch (fundamental frequency) detection using (1) harmonic product spectrum, (2) Blackman-Tukey spectral estimator, and (3) Welch spectral estimator.

Experimenting with pitch detection and spectral estimators

See the question and discussion on StackOverflow: How to get the fundamental frequency using Harmonic Product Spectrum?.

We’re trying to estimate the fundamental frequency of a voiced A4 note (440 Hz). (See the question for link to audio clip.)

Harmonic product spectrum

Result: full data, 0 to 2 KHz

@jconst
jconst / jhPitchShift.cpp
Created February 26, 2018 19:36
Implementation of "Ocean" pitch-shifting method via a modified version of smbPitchShift.cpp
// Modified version of SMB's pitch shift to use the algorithm described in
// Nicolas Juillerat & Beat Hirsbrunner's 2010 paper "LOW LATENCY AUDIO PITCH
// SHIFTING IN THE FREQUENCY DOMAIN".
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <Accelerate/Accelerate.h>

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and
@Tomassito
Tomassito / download-file.js
Last active March 11, 2022 23:53 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
link.click();
@rbw
rbw / part_of_day.py
Last active October 17, 2022 22:44
Get part of day (morning, afternoon, evening, night) in Python3.6+
#!/usr/bin/env python3
def get_part_of_day(h):
return (
"morning"
if 5 <= h <= 11
else "afternoon"
if 12 <= h <= 17
else "evening"
@fschwar4
fschwar4 / sinc_interpolation.py
Last active April 15, 2024 11:22
Fast Python implementation of Whittaker–Shannon / sinc / bandlimited interpolation.
import numpy as np
from numpy.typing import NDArray
def sinc_interpolation(x: NDArray, s: NDArray, u: NDArray) -> NDArray:
"""Whittaker–Shannon or sinc or bandlimited interpolation.
Args:
x (NDArray): signal to be interpolated, can be 1D or 2D
s (NDArray): time points of x (*s* for *samples*)
u (NDArray): time points of y (*u* for *upsampled*)