r/DSP • u/rfjeekelder • Aug 23 '20
r/DSP • u/Rough-Advance189 • 25d ago
Hand-wrote the MFCC/mel/DCT/PCA chain in NumPy, then ported it to C++ — both implementations agree to float32 precision
I've been visualizing bird song as a 3D graph instead of a spectrogram:
spectral peaks become nodes, connected by partial continuity, harmonic
ratios, and timbral proximity in a PCA-reduced MFCC space.
Pipeline, all written by hand (no librosa — I wanted every coefficient
auditable):
- STFT with parabolic interpolation for sub-bin peak frequency
- 64-band mel filterbank, Slaney-normalized
- DCT-II orthonormal → 40 MFCCs, c0 discarded, plus deltas
- PCA to 3D via eigendecomposition of the covariance matrix
- Chroma folding + flatness/centroid/spread/flux
The part I thought this sub might find useful: I later ported the whole
thing to C++ for an Android build, and verified the port by compiling the
C++ standalone and comparing it against the Python on identical input.
centroid, spread, flux, tonality, chroma concentration
→ correlation 1.000000, max relative error ~1e-4 (float32)
spectral peaks detected → 3146 in both
PCA explained variance → 22.3% / 18.0% / 12.3%, identical
Two things I'm unsure about and would like opinions on:
For the PCA I used cyclic Jacobi on the covariance matrix rather than
a proper SVD of the centered data. D is only 78 so it's cheap, and the
eigenvectors of the covariance are the right singular vectors anyway —
but I'm aware this squares the condition number. For this data it
matched NumPy exactly, so it didn't bite. Is there a case here where
it would?
Partial tracking is greedy nearest-neighbor in log-frequency with a
~1 semitone gate, strongest peaks choosing first. Optimal assignment
(Hungarian) would be more correct. For trills at 10+ syllables/second,
is greedy actually losing tracks, or is the gate doing enough work?
Code (Python + the C++ port): https://github.com/gustaavoq94/birdgraph
r/DSP • u/vtw_ytube • Aug 06 '17
Convolution made easy to understand, Must Watch!
r/DSP • u/ApartmentNo433 • Oct 09 '23
Any idea why I was passed as a driver?
I have a clean record, thought I had a good interaction with the owner. She held my eye contact the entire time she spoke and I was excited to start. The owner gave her personal number to all to add to our phone so when I heard nothing after 2 full days, I called to ask how they let potentials know because i didn’t find an email. She said email but you didn’t get one. Initially I was too surprised except to thank her but sent her a txt asking what the reason was so I may improve my chances in the future. NOTHING. search. FYI, the application only allowed 2 quick histories so I did use my most recent full time positions and neglected to list that II held a commercial license for a college, I also Doordashed but thought it was such a simple job the other positions would prove i can follow directions and be successful in a tough office environment. I did state that I did not want another office job with angry medical insurance members 70 times a day. Actually, I only said I really didn’t want to sit in an office all day because i enjoy moving.
License clean. i am a female, 5’8”, 170 strong and presented best and casual. WTF? Too old? Over qualified? Under qualified? I still get emails daily asking me to go to an interview and I guess it showed me to never believe I am a shoe-in although I never implied that and took the process professionally and seriously.
r/DSP • u/[deleted] • Jul 02 '20
Defund "Master/Slave" Asymmetric Communication!!!!
As a black engineer I found the term "master/slave" communication a bit dated and proof of the systemic racism found in the engineering realm. Lets join the movement and encourage education programs, textbook authors/publishers, peer review groups, the ieee, technical writers, and researchers to use "primary/secondary", or something cooler, than the offensive "master/slave" when referencing asymmetric communication.
r/DSP • u/BenRayfield • May 09 '19
What software synth plays a function of vector to energy on the speakers, like an n dimensional hill it rolls along?
For example, a guitar string's energy is approx sum of (positionA-positionB) ^ 2 for each 2 adjacent indexs A B C D E F G... in the string. Or more interesting manifolds could be simulated as musical instruments.
r/DSP • u/Basic-Definition8870 • Nov 10 '24
Would I Be Able To Get Into DSP With A CS Bahcelors?
I love music ans math and also programming. And I also love synths.
Most of the other math heavy fields like MI and cryptography require a PhD or an MS, but what about DSP?
r/DSP • u/S-Track • Aug 13 '26
What kind of changes will the development of AI bring to audio DSP?
r/DSP • u/Feynmanfan85 • Jul 12 '21
Compressing Audio
I’ve refined the technique from my previous post, and below is an additional algorithm that can compress a dataset over time (e.g., an audio wave file) given a fixed compression percentage, and it runs in about .5 seconds, per 1 second of audio (44100 Hz mono).
https://derivativedribble.wordpress.com/2021/07/12/compressing-data-over-time/
r/DSP • u/RealAspect2373 • Nov 30 '25
The Resonance Fourier Transform (RFT), an FFT-class, strictly unitary transform.
. **TL;DR:** I’ve implemented a strictly unitary transform I’m calling the **Resonance Fourier Transform (RFT)**. It’s FFT-class (O(N log N)), built as a DFT plus diagonal phase operators using the golden ratio. I’m looking for **technical feedback from DSP people** on (1) whether this is just a disguised LCT/FrFT or genuinely a different basis, and (2) whether the way I’m benchmarking it makes sense.
**Very short description**
Let `F` be the unitary DFT (`norm="ortho"`). Define diagonal phases
- `Cσ[k,k] = exp(iπ σ k² / N)`
- `Dφ[k,k] = exp(2π i β {k/φ})`, with φ = (1+√5)/2 and `{·}` the fractional part.
Then the transform is
`Ψ = Dφ · Cσ · F`, with inverse `Ψ⁻¹ = Fᴴ · Cσᴴ · Dφᴴ`.
Because it’s just diagonal phases + a unitary DFT, Ψ is unitary by construction. Complexity is O(N log N) (FFT + two diagonal multiplies).
**What I’ve actually verified (numerically):**
- Round-trip error ≈ 1e-15 for N up to 512 (Python + native C kernel).
- Twisted convolution via Ψ diagonalization is commutative/associative to machine precision.
- Numerical tests suggest it’s **not trivially equivalent** to DFT / FrFT / LCT (phase structure and correlation look different), but I’d like a more informed view.
- Built testbed apps (including an audio engine/mini-DAW) that run entirely through this transform family.
**Links (code + papers)**
- GitHub repo (code + tests + DAW): https://github.com/mandcony/quantoniumos
- RFT framework paper (math / proofs): https://doi.org/10.5281/zenodo.17712905
- Coherence / compression paper: https://doi.org/10.5281/zenodo.17726611
- TechRxiv preprint: https://doi.org/10.36227/techrxiv.175384307.75693850/v1
**What I’m asking the sub:**
From a DSP / LCT / FrFT perspective, is this just a known transform in disguise?
Are there obvious tests or counterexamples I should run to falsify “new basis” claims?
Any red flags in the way I’m presenting/validating this?
Happy to share specific code snippets or figures in the comments if that’s more useful.
r/DSP • u/JanWilczek • Mar 30 '24
In DSP or audio software prototyping, you often want to just plot something fast. A good example is the magnitude spectrum of an audio signal (magnitude DFT, also called magnitude FFT). How to write a reusable, single-call function to plot it in Python? I explain in this short tutorial:
r/DSP • u/Feynmanfan85 • Dec 03 '18
Using Information Theory to Explain Color Bias
In a previous post, I showed how information theory can be used to explain why it is that human beings perceive changes in luminosity logarithmically, and not linearly, as a function of actual luminosity (see the post below entitled, "Using Information Theory to Explain Color Perception"). In short, I showed that if you assume that what human beings perceive as luminosity is actually a measure of information content, then perceived luminosity should be a logarithmic function of actual physical luminosity, which is indeed the case (see, for example, Fechner's Law). In this post, I'll show how we can use similar analysis to explain why it is that human beings perceive the color green as brighter than the colors red and blue, even when all three colors have equal actual luminosities.
r/DSP • u/givemecoins44 • Sep 13 '22
Kind of want to be a delivery driver but I’m afraid of dogs. Any way around this?
I (22M) want to be a delivery driver but I seen video of people getting chased by/ bitten by dogs and I’ve been afraid of dogs since I was a kid, I’ve never had a dog myself, I don’t really know how to act around them other than to stand still so they don’t get nervous I guess.
I know some mailmen carry pepper spray/bear spray or other things but I don’t want to have to go to war with dogs or be terrorized by them I just want to do my job and make a decent pay. Any advice?
HELP
My instructor has asked me to do a small research paper on the application of digital signal processing in biomedical engineering. I'm planning to use the ECG I did earlier for this work, but as an undergraduate I don't have a lot of research experience. Can anyone tell me how I should start with this spam i’m gonna send to me instructor?
r/DSP • u/Hot_Ices • Aug 02 '18
Can someone share any pdf link of Digital Signal Processing by S K Mitra (4th edition) ?
r/DSP • u/Feynmanfan85 • Jan 17 '20
A Mathematical Language on Sets
r/DSP • u/ZookeepergameMost124 • Jun 07 '24
Detecting "fakery" in video. Determining the degress of focus of objects in pictures.
While it is not an established fact that this footage has been faked, just look at it.
This footage is from Voice of America. It is available on YouTube.
https://www.youtube.com/watch?v=YUkObNlWjsI
For those of you that have worked closely with large aircraft, you know that even on the taxi way, those engines push a lot of really hot air behind them. People just can't operate closely behind them or in front of them. Regardless of their desperation or lack of being safety conscious, you just can't do anything when you're immediately behind a jet engine. Even the sound of the engines while the aircraft taxis is so intense that you're not going to see someone calmly running beside the engine.
Even for someone who is not safety conscious, it is just impossible.
The clothing of the people behind the engines doesn't seem to be affected by the engine blast or the temperature.
There are so many things about this footage that is unnatural. It makes a great subject for study.
Early on when I first saw this video, I noticed right away that the people in the movie, the photographic objects, seemed to have been just inserted....pasted in. The sharpness and focus of each person is not connected to where that person is in the picture. Notice how the people on either side of the aircraft are highlighted as being amongst the most focused elements of each frame. They are the most focused whether they're in the foreground or the background. The people are more focused even than the aircraft taxiing between the foreground and background. The areas of high contrast on the aircraft seem to possess even less spatial frequency than the figures nearer the camera and those very far away.
Also, their gates seem to be a little strange, like video game characters.
The further-away objects appear to be in the same focus as the near ones. While the aircraft seems to have its degree of focus varying with distance in a more natural way like it was filmed in situ.
In analyzing this footage, I used ffmpeg to turn the video into still frames. I used the following command
ffmpeg -i "..\RAW_MOVIES\Afghans Try to Flee at Kabul Airport.mp4" -compression_algo raw -pix_fmt rgb24 ..\STILLS\frame1_%%04d.tiff
I used a set of directories in which I put the mpeg of the video mentioned above into "RAW_MOVIES" and I use a batch file to run ffmpeg.
NOTES
BATCHFILES
STILLS
RAW_MOVIES
imageProcessing
Then, I used Python to do a high-pass filter on each frame, looking for the most in-focus part of the image. I include the Python script.
The high-pass (Laplacian) filtered image is superimpose upon the original in a way that areas of high spatial frequency are highlighted.
I have the idea that a natural photograph won't have highlighted photographic elements distributed all over the photo and at varying locations that are not associated with the focus and the depth of field.
I got some of the code I used from this URL
https://stackoverflow.com/questions/60872630/get-in-focus-pixels-of-an-image
My question is, are there other filters that could be used besides the Laplcian? I'm especially interested in filters that don't select areas of reflection and falsely highlight them as areas of high focus.
#!/usr/bin/env python3
import numpy as np
from PIL import Image, ImageFilter
from skimage.morphology import dilation, square
from pathlib import Path
# Use the path (as a string) input to open an image
# file and create another image from it that highlights
# the sharpest and most focused parts of the image.
def findHighestFocusEdge(path):
# Open input image and make greyscale copy
string = str(path)
image = Image.open(string)
grey = image.copy().convert('L')
stripped = string.rsplit('.', maxsplit=1)[0]
sep = '\\'
stripped = stripped.rsplit(sep)[-1]
outputFileName = 'output/'+stripped+'_x.png'
# Find the edges
edges = grey.filter(ImageFilter.FIND_EDGES)
# Define a structuring element for dilation
selem = square(3)
fatedges = dilation(np.array(edges),selem)
fatedges = Image.fromarray(fatedges)
fatedges.save('edges.png')
# Draw the sharp edges in white over original
RGBedges = Image.merge('RGB',(fatedges,fatedges,fatedges))
image.paste(RGBedges, mask=fatedges)
# Save
image.save(outputFileName)
# Use the path (as a string) input to open an image
# file and create another image from it that highlights
# the sharpest and most focused parts of the image.
def findHighestFocusLap1(path):
# Open input image and make greyscale copy
string = str(path)
image = Image.open(string)
grey = image.copy().convert('L')
stripped = string.rsplit('.', maxsplit=1)[0]
sep = '\\'
stripped = stripped.rsplit(sep)[-1]
outputFileName = 'output/'+stripped+'_x.png'
# Calculating Edges using the passed laplacian Kernel
edges = grey.filter(ImageFilter.Kernel((3, 3), (-1, -1, -1,
-1, 8, -1,
-1, -1, -1), 1, 0))
#edges = grey.filter(ImageFilter.Kernel((3, 3), ( 0, 1, 0,
# 1, -4, 1,
# 0, 1, 0), 1, 0))
#edges = grey.filter(ImageFilter.Kernel((3, 3), ( 1, 4, 1,
# 4, -20, 4,
# 1, 4, 1), 1, 0))
# Define a structuring element for dilation
selem = square(3)
fatedges = dilation(np.array(edges),selem)
fatedges = Image.fromarray(fatedges)
fatedges.save('edges.png')
# Draw the sharp edges in white over original
RGBedges = Image.merge('RGB',(fatedges,fatedges,fatedges))
image.paste(RGBedges, mask=fatedges)
# Save
image.save(outputFileName)
# Create a list of images
def findImages():
p = Path('../STILLS/')
myList = list(p.glob('*.tiff'))
return myList
def main():
fileList = findImages()
# Send each file in the list to this function
# for analysis.
for fileName in fileList:
# findHighestFocusEdge(fileName)
findHighestFocusLap1(fileName)
# print('fileName =',fileName)
if __name__ == "__main__":
main()
r/DSP • u/[deleted] • May 13 '23
resnikoff param,fund wavlt
i want to fit data to make fund wavelets using h246.m which generates vector of coeff. how do i go from h to a wavelet. any new link for rice pick a wavelet applet? author does photogrammetry in china noe