Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shows resonances that aren't there #90

Closed
thirstyice opened this issue Dec 20, 2018 · 19 comments
Closed

Shows resonances that aren't there #90

thirstyice opened this issue Dec 20, 2018 · 19 comments

Comments

@thirstyice
Copy link

thirstyice commented Dec 20, 2018

All the frequency analyzers show bands of louder sound at resonances of 90Hz (180, 270, 360, etc) that isn't there in the original signal, confirmed by analyzing the sound with another application at the same time. It's like the audio is being run through a filter that amplifies those resonances before it gets analyzed.
Maybe could also be the result of some king of aliasing between the sample rate of the analyzer and the audio sample rate?

Tested on MacOS X 10.11.6 Mac Pro

Update: Also happens on macOS 10.13.6 MacBook Pro

@tlecomte
Copy link
Owner

Hi @thirstyice ! There are indeed IIR low-pass filters that are applied before subsampling to perform the frequency analysis in a multirate fashion. This was implemented to achieve reasonable performance, because narrow filters at low frequencies would be very expensive otherwise.

There is one graph of the filter response of one of the analyzers at http://friture.org/features.html and as you can see there are ripples, but of limited amplitude.

Would you please be able to provide a screenshot or some other data to show the precise effect you have noticed ? Maybe we missed something until now in the way the filters are applied.

Thank you very much !

@thirstyice
Copy link
Author

Here's a screenshot of the effect. I'm putting in a pure sine tone at 70Hz at a low level, but it shows the resonances of 90Hz much more strongly.
Screen Shot 2019-03-19 at 15 52 14

@axredneck
Copy link

axredneck commented Sep 9, 2019

Arch Linux, Pulseaudio, any music, the same issue. Other analyzers (e.g. Baudline) don't show these resonating 90/180/etc. Hz frequencies.
edit: in my case resonances are at 96/192/etc. Hz.

@jdchmiel
Copy link

Exact same issue here. OSX 10.14.6 Kind of a big deal when trying to look at the low freq content.

@tlecomte
Copy link
Owner

I tried to reproduce it but I cannot. Here is what I tried:

Here is the result:

image

This is a very very low level signal, -73 dBFS Peak (0 dBFS means a signal that fully uses the -1...1 digital scale). It is not powerful enough for the level widget (left of the screenshot) to display anything. Still the 70 Hz resonance clearly dominates the background noise. There is a secondary peak at 140 Hz, which is likely to be an harmonic that is really present in the source signal.

Also, I now realize that you said that "all analyzers" in Friture show this problem. I mentioned in my previous comment that some ripples might come from the IIR filters used in Friture for fast multirate processing, but actually no such filters are used for the FFT analyzer. So the source of the resonances you see cannot be these filters. The FFT analyzer is really pretty much just a pristine short-window FFT applied on top of the source signal.

Would you be able to give more details on your setup, to identify where the false resonances come from ?

@axredneck
Copy link

axredneck commented Sep 22, 2019

Looks like Friture analizes right way but captures wrong way. For example, it's 141Hz generated by this online tone generator and captured by Friture:
2019-09-22-181845_1920x1080_scrot
Arch Linux, Pulseaudio.
Can i help somehow else to find and fix this bug?

@axredneck
Copy link

axredneck commented Sep 24, 2019

Meanwhile Windows version (0.36-20190201) under Wine doesn't have this bug.

@tlecomte
Copy link
Owner

Meanwhile Windows version (0.36-20190201) under Wine doesn't have this bug.

That's very interesting. That points to how Friture deals with Pulseaudio or Alsa for capture.

Looks like Friture analizes right way but captures wrong way. For example, it's 141Hz generated by this online tone generator and captured by Friture:
...

It looks like the signal is interrupted very often, something that's called "overflows".

Could you show what inputs are available in the settings window ? If you have several entries for the same input, can you try the other ones ?

Also, in the About window, under the Statistics tab, what number do you have after a minute or so in the "Number of overflowed inputs (XRUNs)" row ?

@jdchmiel
Copy link

no Xruns on OSX 10.14.6

@axredneck
Copy link

axredneck commented Sep 24, 2019

Native:
2019-09-24-234813_1920x1080_scrot
2019-09-24-233110_1920x1080_scrot
(can't make a screenshot of dropdown for some reason, but there are 32 channels somehow)

Wine, the same system:
2019-09-24-232911_1920x1080_scrot
2019-09-24-233007_1920x1080_scrot

@axredneck
Copy link

edit: native is 0.37, Windows version is 0.36

@axredneck
Copy link

axredneck commented Sep 24, 2019

If you have several entries for the same input, can you try the other ones ?

Doesn't help.

@tlecomte
Copy link
Owner

tlecomte commented Nov 20, 2019

I realized that we actually have the very same problem of missing parts in the signal on Windows when choosing a DirectSound input. MME inputs are ok though. So it might just be that MME has huge buffers and is less sensitive to Friture retrieving the data "too late", while other audio host apis are more sensitive and make us lose samples.

I'm trying https://github.com/spatialaudio/python-rtmixer to see if it can have an impact, and I'll post my findings here.

tlecomte added a commit that referenced this issue Dec 4, 2019
Friture has issues keeping up with audio input, which tends to produce overflows, that appear as glitches in the audio signal.

This has largely been unnoticed for years because Windows MME is very forgiveable in that regard. But Windows Directsound, for example, is much more sensitive. Similarly, Alsa or PulseAudio in Linux also show a lot of glitches (even if PortAudio might not report any overflow).

Here this is fixed vy taking advantage of python-rtmixer, a library that sits on top of python-sounddevice (the PortAudio wrapper). Python-rtmixer provides an audio callback that is implemented in C (and compiled with the help of CFFI) and doesn’t invoke the Python interpreter, therefore avoiding waiting for things like garbage collection and the GIL.

Reference: https://python-rtmixer.readthedocs.io/en/0.1.0/index.html

The result is glitch-free audio signal even with Windows DirectSound.

We believe this solves #90
tlecomte added a commit that referenced this issue Dec 8, 2019
Friture has issues keeping up with audio input, which tends to produce overflows, that appear as glitches in the audio signal.

This has largely been unnoticed for years because Windows MME is very forgiveable in that regard. But Windows Directsound, for example, is much more sensitive. Similarly, Alsa or PulseAudio in Linux also show a lot of glitches (even if PortAudio might not report any overflow).

Here this is fixed vy taking advantage of python-rtmixer, a library that sits on top of python-sounddevice (the PortAudio wrapper). Python-rtmixer provides an audio callback that is implemented in C (and compiled with the help of CFFI) and doesn’t invoke the Python interpreter, therefore avoiding waiting for things like garbage collection and the GIL.

Reference: https://python-rtmixer.readthedocs.io/en/0.1.0/index.html

The result is glitch-free audio signal even with Windows DirectSound.

We believe this solves #90
@tlecomte
Copy link
Owner

@axredneck @thirstyice @jdchmiel thanks again for your reports. I believe this issue is now fixed. I now get a good signal both with Windows DirectSound or with Linux (tested in a VM running Ubuntu 14.04). Friture 0.41 has just been released with this improvement. Let me know if it works! Thanks!

(I'm closing this issue, we can always reopen if the problem is still there)

@axredneck
Copy link

axredneck commented Dec 10, 2019

Unfortunately i have this error:

...
  File "/usr/lib/python3.8/site-packages/friture/plotting/glCanvasWidget.py", line 6, in <module>
    import pyrr
ModuleNotFoundError: No module named 'pyrr'

though i have python-pyrr package installed on my Arch Linux, so i can't check if the bug is fixed.

@axredneck
Copy link

Thank you, it's fixed.

@tlecomte
Copy link
Owner

@axredneck out of curiosity, what did you have to do to get it fixed ? Thanks!

@axredneck
Copy link

@tlecomte, reinstall python-pyrr.

@thirstyice
Copy link
Author

Fixed on Mac too, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants