Skip to content

Instantly share code, notes, and snippets.

View mauro-belgiovine's full-sized avatar
:octocat:

Mauro Belgiovine mauro-belgiovine

:octocat:
View GitHub Profile
@lynzrand
lynzrand / _image.md
Last active September 3, 2024 15:04
Dissonance calculation for up to 19 harmonics with microtonic scales shown -- also see https://gist.github.com/endolith/3066664

out

@endolith
endolith / DFT_ANN.py
Last active March 7, 2025 15:22
Training neural network to implement discrete Fourier transform (DFT/FFT)
"""
Train a neural network to implement the discrete Fourier transform
"""
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
N = 32
batch = 10000
@alimanfoo
alimanfoo / find_runs.py
Created November 5, 2017 23:53
Find runs of consecutive items in a numpy array.
import numpy as np
def find_runs(x):
"""Find runs of consecutive items in an array."""
# ensure array
x = np.asanyarray(x)
if x.ndim != 1:
raise ValueError('only 1D array supported')
@endolith
endolith / readme.md
Last active August 13, 2024 11:27
Sethares dissmeasure function in Python

Adaptation of Sethares' dissonance measurement function to Python

Example is meant to match the curve in Figure 3:

Figure 3

Original model used products of the two amplitudes a1⋅a2, but this was changed to minimum of the two amplitudes min(a1, a2), as explained in G: Analysis of the Time Domain Model appendix of Tuning, Timbre, Spectrum, Scale.

This weighting is incorporated into the dissonance model (E.2) by assuming that the roughness is proportional to the loudness of the beating. ... Thus, the amplitude of the beating is given by the minimum of the two amplitudes.