Git Product home page Git Product logo

stft's Introduction

STFT

Build Status Docs Status

This is a package for calculating the short time fourier transform (spectrogram) or any other transform in a lapped and windowed fashion.

Installation

You can install this library using pip:

pip install stft

Usage

Loading a file and calculating the spectrogram, its inverse and saving the result.

import stft
import scipy.io.wavfile as wav

fs, audio = wav.read('input.wav')
specgram = stft.spectrogram(audio)
output = stft.ispectrogram(specgram)
wav.write('output.wav', fs, output)

stft's People

Contributors

nils-werner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

stft's Issues

after ISTFT, the audio is not the same as original

import stft
import scipy.io.wavfile as wav

fs, audio = wav.read('input.wav')
specgram = stft.spectrogram(audio)
output = stft.ispectrogram(specgram)
wav.write('input-anchor.wav', fs, output)

'input-anchor.wav' sounds not like 'input.wav' at all.

New release on PyPI?

Hi! I'm using this package indirectly through the mdct package. I get FutureWarnings that I see are already fixed in the repo, but are not released on PyPI. Could you make a new release? Thanks :)

Reconstruction has artefacts

I successfully ran the example. However, the reconstruction is not the same as the original. Perhaps due to the lack of the phase information?

Dimension mismatch for arbitrary overlap/hopsize

I'm experimenting with an audio of 35751 samples (sampled at 25kHz sampling rate) using a framelength of 5000 and overlap of 16 which is 312 hopsize. It seems that there's a dimension mismatch at the line
data = data * window Is there any workaround for this issue? Thanks!

AttributeError: module 'stft' has no attribute 'spectrogram'

Problem

I'm not able to call the function stft.spectrogram, after following the tutorials here. Here is my console output:

makeing spectrogram for file: data/055 - Angels In Amplifiers - I'm Alright.wav
/usr/lib/python3/dist-packages/scipy/io/wavfile.py:273: WavFileWarning: Chunk (non-data) not understood, skipping it.
  WavFileWarning)
Traceback (most recent call last):
  File "/mnt/c/Users/tstan/Documents/Class spring 21/ML/Project/stft.py", line 1, in <module>
    import stft 
  File "/mnt/c/Users/tstan/Documents/Class spring 21/ML/Project/stft.py", line 18, in <module>
    specgram = stft.spectrogram(audio)
AttributeError: module 'stft' has no attribute 'spectrogram'

About my system

I've ran into this on both Windows and Linux (runnign wsl--yes it runs a python executeable on the linux side)
I've tried fixing this with running both python 2.7 and 3.7.

Any help on how to fix this?
Thanks,
-T

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.