项目作者: psaikko

项目描述 :
A visualization of the Fourier transform
高级语言: Python
项目地址: git://github.com/psaikko/slow-fourier-transform.git
创建时间: 2018-03-11T19:15:59Z
项目社区:https://github.com/psaikko/slow-fourier-transform

开源协议:

下载


slow-fourier-transform

Replicating part of the 3Blue1Brown Fourier transform visualization on some real data.

installation

pip install -r requirements.txt

usage

python3 transform.py input_path

Where input_path is the location of a .wav file of at least 1 second

example

Using the startup.wav file as input, the script first plots the first second of the waveform data:

The waveform samples are then plotted on a polar coordinate axis, with time as the angular coordinate. The scaling of time to angle is increased over time, initially with 1 second of sound data covering one rotation around the polar axis (“1 hz”).

The distance of the “center of mass” of these points from the origin indicates the intensity of the frequency in the plotted data.

An example of the animation from 400 to 440 hz, showing a peak around 415hz.

Plotting the horizontal and vertical shifts of this center of mass over a frequency range of 1 to 1000 hz gives us something analogous to the Fourier transform.