Deutsch English Français Italiano |
<noise-20241025174236@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: Re: How to check whether audio bytes contain empty noise or actual voice/signal? Date: 25 Oct 2024 16:43:11 GMT Organization: Stefan Ram Lines: 31 Expires: 1 Jul 2025 11:59:58 GMT Message-ID: <noise-20241025174236@ram.dialup.fu-berlin.de> References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com> <mailman.48.1729873488.4695.python-list@python.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de jvhDOWm/P4B5ZUBLguC+/wHCx14UWSxZqWI8uzrTLzuW4A Cancel-Lock: sha1:x5ArkzpHqMyDSc5HqV842/KNA8k= sha256:1cERKZnEiOpEiQRUFUzHbHkLM+ElPDqNdg7ZpgwuBIE= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 2685 marc nicole <mk1853387@gmail.com> wrote or quoted: >I hope this question is not very far from the main topic of this list, but >I have a hard time finding a way to check whether audio data samples are >containing empty noise or actual significant voice/noise. The Spectral Flatness Measure (SFM), also called Wiener entropy, can separate the wheat from the chaff when it comes to how noise-like a signal is. This measure runs the gamut from 0 to 1, where: 1 means you've hit pay dirt with perfect white noise (flat spectrum), 0 is as pure as a Napa Valley Chardonnay (single frequency). (Everything in between is just different shades of gnarly.) import numpy as np from scipy.signal import welch def noiseness(signal, fs): # Compute the power spectral density f, psd = welch(signal, fs, nperseg=min(len(signal), 256)) # Compute geometric mean of PSD geometric_mean = np.exp(np.mean(np.log(psd + 1e-10))) # Compute arithmetic mean of PSD arithmetic_mean = np.mean(psd) # Calculate Spectral Flatness Measure sfm = geometric_mean / arithmetic_mean return sfm