0
$\begingroup$

For a project, I'm reading in hundreds of short (4 sec) wavefiles and giving them to scipy fft for the frequency information for further processing/experimenting in various ways. Problem is, I want to run the program many times while changing params, code, test new ideas, etc, but each time I'm rereading, re-fft-ing the original wavefiles. I'm wondering if there is a smart way to "save" the fft numpy arrays for quick retrieval, so I'd only have to read them in once, if this is possible and not a dumb idea.

$\endgroup$
1
$\begingroup$

That doesn't seem worth the bother.

FFT of a 7 second long wave file on my windows 10 laptop using Matlab takes about 5 milliseconds. So unless you have a particularly slow setup, you will not save a significant amount of time by storing the FFTs instead of just reading the raw wave file and doing the processing again each time.

That doesn't seem to justify the extra development effort for a non-standard file format.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Fair enough, thanks for the input. I guess I'm worried because I'll eventually scale up to tens of thousands of files. But if rereading takes roughly the same amount of time then yeah, why bother. Thanks. $\endgroup$ – biathlonc Mar 10 at 0:54
  • $\begingroup$ You also need to consider file management. One large set of wave files is easier to manage than multiple set with maybe different FFT versions or generations, etc. $\endgroup$ – Hilmar Mar 10 at 1:01
  • $\begingroup$ good idea, thanks Hilmar. $\endgroup$ – biathlonc Mar 10 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.