When expressing a power ratio, the number of decibels is ten times its logarithm to base 10. Two different scales are used when expressing a ratio in decibels, depending on the nature of the quantities: power and field (root-power). I suspect there may still be some smoothing of some kind (there are references to hops in the code, but I can't quite suss out what they're doing).Īs you noted, your two results differ by a constant factor that is approximately 2.įrom Wikipedia's entry on Decibel (my emphasis): It's still not an exact match, but it's much closer. With the two changes I have mentioned, the graphs compare as follows: I have not found a way to export their spectrum, but I have manually read off the first few values (note, not the dB value) as theirvalues = [ This leads to a change of calculation to s_mag = np.abs(values) * 2 / data_length They appear simply to divide by the size of the window in the code when calculating the magnitude. I have also verified this in the v4.0.1 source code (in svcore/base/AudioLevel.cpp, line 54) double dB = 10 * log10(multiplier) The first big difference is that they are using the "power ratio" definition of the decibel, from this Wikipedia page: Where is the problem with my script, why do I get a different result? The script converts the 32bit float audio file into a dBFS spectrum diagram, using the first 4096 samples as the window, as Sonic Visualizer does. Target_name = audio_file.parent / (audio_file.stem + '.png') Plt.semilogx(x_labels, flat_data, color='tab:blue', label='Spectrum (with filter)') Plt.semilogx(x_labels, s_dbfs, alpha=0.4, color='tab:blue', label='Spectrum') X_labels, s_dbfs = db_fft(data, frequency)įlat_data = savgol_filter(s_dbfs, 601, 3) S_mag = np.abs(values) * 2 / np.sum(weighting)įrequency, data = wavfile.read(str(audio_file)) If I match the curve from Sonic Visualizer to my script's output, it is obvious the conversion of the levels lacks some factor:Ī minimal version of my script, using the 'demo.wav' file above, looks like this: from pathlib import Pathįrequencies = np.fft.rfftfreq(data_length, d=1. So I assume, there is a problem in my script converting the FFT result to dBFS. At 100Hz, Sonic Visualizer is at -40dB and my Script is at -65dB. Now I tried to reproduce this result using my Python Script, but get a different result:Įverything looks right, except the scale of the dB values. Before I started, I analyzed the file using Sonic Visualizer, which got me the following result: I am working on a script which is creating a spectrum analysis from an audio file using SciPy and NumPy. You can download the 32bit float WAV audio file here. I ask this question in the hope someone will find the problem. Sonic Visualiser 3.0 is available for free download from the official website (17 MB download size, installer package, standalone application for Windows, Mac OS, and Linux).It seems I have an issue in the implementation of a function to create a frequency spectrum from an audio file. Sonic Visualiser can be downloaded directly from the page linked below and works on Windows, Mac OS, and Linux-based systems. These “Vamp” plugins can be loaded from the official website, along with a selection of LADSPA and DSSI effects plugins which are also compatible with the software. Another cool feature of Sonic Visualiser is its ability to use plugins to achieve custom analysis functionality not included in the base software. Of course, it is also possible to perform traditional “linear” time stratching. One interesting feature I was not expecting is a time-stretch function that can be set to gradually reduce or increase the speed of the loaded audio file. In this new update, the annotations can also be imported/exported via various text file formats. These can act as either section markers or be programmed to indicate beat or pitch events. The program can also create annotations on top of the analyzed audio material. Other notable improvements include the ability to export vector graphics in SVG format, along with better support for high-resolution displays and extremely long audio files.Īpart from the newly introduced features mentioned above, Sonic Visualiser still has the ability to import WAV, OGG, and MP3 files, and display them visually as a waveform, spectrogram, or to perform key analysis (after installing the additional Vamp plugin). Perhaps the most important new features are the ability to record audio, meaning that Sonic Visualiser can now be used to directly analyze the audio captured by your computer’s audio inputs. The brand new 3.0 update of Sonic Visualiser comes with several major improvements compared to the previous versions of the software. Centre for Digital Music has released Sonic Visualiser 3.0, an updated version of the free software suite for visual analysis of audio material.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |