OSS4 won't install properly

OSS specific Linux discussion (x86/amd64)

Moderators: cesium, dev, kodachi, hannu

Re: OSS4 won't install properly

Postby keantoken » Thu Jul 14, 2011 3:39 pm

Okay, I used Audacity to compare the output from DeaBeef's resampler and Petrov's resampler. Here are the commands I used:

Code: Select all
keantoken@ubuntu:~/Setup_Files/exact-audio-player$ ./pcm_conv "BWV_1034_e-moll_Part_II_Allegro_(24_bit_96_kHz).wav" "Petrov" -b 16 -f 48000
=================================================================
Module Info:

Short name: WAVE PCM Converter
Long name : Convert PCM format for WAVE files
Copyright : Copyright (c) 2009-10 PetrovSE
Version   : 1.0.2.4
Build     : Sep 14 2010, 10:51:15
=================================================================

Input file : BWV_1034_e-moll_Part_II_Allegro_(24_bit_96_kHz).wav
Samples rate    = 96000 Hz
Channels        = 2
Bits per sample = 24 (fixed)

Output file: Petrov
Samples rate    = 48000 Hz
Channels        = 2
Bits per sample = 16 (fixed)

   LFE   SL   L   C   R   SR
LFE    -----   -----   -----   -----   -----   -----
SL     -----   -----   -----   -----   -----   -----
L      -----   -----   1.000   -----   -----   -----
C      -----   -----   -----   -----   -----   -----
R      -----   -----   -----   -----   1.000   -----
SR     -----   -----   -----   -----   -----   -----

[|||||||||||||||||||||||||||||||||||||||||||||||||||]  99.0 %
Ok.

File duration  : 162.679302 sec
Processing time: 3.723648 sec ( 2.29% of real time)


I used the transcoder in DeadBeef with the "Secret Rabbit resampler", using the settings rate=48000 quality=best.

I opened both of these files in Audacity, inverted the track converted with Petrov's converter, and mixed it with the file converted with DeadBeef. The resulting file is essentially "DeadBeef-Petrov". Since the signal was too low to register on the FFT scale, I amplified it by 48db, a multiple of 6db, to avoid volume aliasing.

I have attached the screenshot of the spectrum analysis, and the exported textfile in case someone knows how to use it.

So it is clear there IS a difference between Petrov's resampler and the standard "best quality" resampler. Unsurprisingly, the biggest differences lie in the treble region. The rest of the spectrum seem to follow the envelope of the original file's spectrum, indicating the errors below the treble range aren't highly frequency-dependent.

Because the difference file was amplified by 48db, the scale on the spectrum graph should no be taken for granted. On this scale -72db corresponds to -120db, which is said to be the lower limit to human hearing. This gives us an estimate of the scale of these differences. The largest difference below treble is -113db. The treble difference rises above -120db at 17KHz and peaks at -107db at 23KHz.

The file I used was "BWV 1034 Allegro" from here:

http://www.lessloss.com/bach-sonatas-in ... p-197.html

- keantoken
Attachments
Petrov_Vs_DeadBeef.zip
(138.67 KiB) Downloaded 502 times
keantoken
Member
 
Posts: 35
Joined: Fri Jul 08, 2011 2:54 am

Re: OSS4 won't install properly

Postby igorzwx » Thu Jul 14, 2011 5:51 pm

keantoken wrote:I used the transcoder in DeadBeef with the "Secret Rabbit resampler", using the settings rate=48000 quality=best.
I opened both of these files in Audacity, inverted the track converted with Petrov's converter, and mixed it with the file converted with DeadBeef.


You could easily convert it with Audacity, it has the "Secret Rabbit Code" inside (Edit → Preferences → Quality, then File → Export, it will export to the "default format", which is set in "Quality"). The Windows version of Audacity has a similar resampler, but not the same.
Code: Select all
$ sndfile-resample

  A Sample Rate Converter using libsndfile for file I/O and Secret
  Rabbit Code (aka libsamplerate) for performing the conversion.
  It works on any file format supported by libsndfile with any
  number of channels (limited only by host memory).

       libsamplerate-0.1.7 (c) 2002-2008 Erik de Castro Lopo
       libsndfile-1.0.24

  Usage :
       sndfile-resample -to <new sample rate> [-c <number>] <input file> <output file>
       sndfile-resample -by <amount> [-c <number>] <input file> <output file>

  The optional -c argument allows the converter type to be chosen from
  the following list :

       0 : Best Sinc Interpolator
       1 : Medium Sinc Interpolator (default)
       2 : Fastest Sinc Interpolator
       3 : ZOH Interpolator
       4 : Linear Interpolator

$ pacman -Qo sndfile-resample
/usr/bin/sndfile-resample is owned by libsamplerate 0.1.7-2


keantoken wrote:So it is clear there IS a difference between Petrov's resampler and the standard "best quality" resampler.


There must be a difference, because these resamplers are really different things:
Code: Select all
$ ./pcm_conv -i
Short name: FFT-DCT4-MDCT
Long name : FFT, DCT4 and MDCT by Cooley-Tukey, Good-Thomas and Winograd algorithms
Copyright : Copyright (c) 2007-10 PetrovSE
Version   : 1.0.4.0
Build     : Oct 19 2010, 13:09:40


The version 1.0.3.0 of Petrov's pcm_conv (and his OSS4 plugin for DeadBeef, and his ALSA plugin) has two "scientific resamplers" inside:
Code: Select all
$ ./pcm_conv -H
-T            Transform type: dct, fft (default: dct)
-W            Window type: vorbis, hanning (default: vorbis)

-n            Show internal information
-i            Show wide modules information

If you want to test them too, you may contact Sergey by e-mail.
Petrov's ALSA plugin libasound2-plugin-fftrate_0.8 is available for download on the Russian Ubuntu forum http://forum.ubuntu.ru/index.php?PHPSES ... #msg939449 The latest version is 0.9, it sounds better. It can be easily installed on any Linux, just unpack the .deb file with the archive manager and copy the files to the place (e.g. arateconf to /usr/bin or /usr/local/bin ).

Do you hear the difference in sound quality? Do you perceive it? What is your "subjective" opinion?
igorzwx
Supporter
 
Posts: 987
Joined: Sun Jun 28, 2009 9:31 pm

Re: OSS4 won't install properly

Postby keantoken » Thu Jul 14, 2011 8:11 pm

The sound seems to be in general clearer and more life-like. Reverberations and spatial sense are stronger and more realistic, which in my experience means time-related distortions have been lowered. The background is quieter, and instruments are easier to separate from each other. The flute in that file seems to be a good test for resamplers (compared to what I usually listen to anyways). Often these kinds of instruments will be overwhelmed by other instruments and reverberations which are distorted. This can be a symptom of harmonic distortion, which makes all instruments sound strangely the same, or time distortions which affect the spatial sense by which we can tell whether a sound is made by two instruments or just one. Since time distortion seems to be the dominant one for resamplers I think it is safe to say it is the culprit. With Petrov's resampler quiet instruments are not so overwhelmed by loud ones.

That is the most I can make out, trying to compare the sound to what I think "real" sounds like, without accidentally making things up. Subjectively, I enjoy the Petrov resampler more. It is more emotionally engaging, there is less getting between me and the music.

For those who want to understand the scientific reason Petrov's resampler is better, look through these links:

http://www.google.com/search?client=ubu ... 8&oe=utf-8

They mostly concern image resampling, but the FFT algorithm is universal, the same algorithm used for images can be applied to music. Wait, that's an idea, convert a music file into a string of pixels and use photoshop to manually resample it! Could probably make a script to do that automatically, the problem would be making sure each program used was free of buggy math operations.

- keantoken
keantoken
Member
 
Posts: 35
Joined: Fri Jul 08, 2011 2:54 am

Re: OSS4 won't install properly

Postby igorzwx » Thu Jul 14, 2011 8:51 pm

keantoken wrote:The sound seems to be in general clearer and more life-like.


I could agree with this. It sounds really "hypnotizing", especially with Indian classical music (bansuri, tabla, etc.)
http://de.wikipedia.org/wiki/Hariprasad_Chaurasia
http://en.wikipedia.org/wiki/Zakir_Hussain_(musician)

You should certainly try more advanced versions. I am not authorized to distribute them, and it does not make much sense. The author need feedback and bug reports. There is still a lot of work, there are still some "exact scientific methods" to be implemented to make it more perfect.
Last edited by igorzwx on Sun Dec 04, 2011 11:37 pm, edited 1 time in total.
igorzwx
Supporter
 
Posts: 987
Joined: Sun Jun 28, 2009 9:31 pm

Re: OSS4 won't install properly

Postby keantoken » Fri Jul 15, 2011 12:27 am

I don't know much about math, but when I saw it was an FFT algorithm I realized what it was. A good idea!

While It seems the FFT-based resampling should be more accurate than any kind of interpolation, there is still a limit to how much of the original signal can be reconstructed. For one thing, signals above the samplerate will heterodyne backwards in frequency, and no algorithm can tell this apart from the musical signal with 100% accuracy. At the same time filtering out these extra signals before A-D conversion causes unwanted complexity which may decrease sound quality by introducing phase shift, and maybe harmonic distortion.

Another reason for this is that an FFT made from a finite number of samples has a resolution limit. It cannot recover information that was lost in the original conversion.

Using higher samplerates such as 96k or 192k may shift these errors out of the audible range of hearing, if they are in fact audible. This is why high samplerates are preferred when there will be many sample conversions.

- keantoken
keantoken
Member
 
Posts: 35
Joined: Fri Jul 08, 2011 2:54 am

Re: OSS4 won't install properly

Postby igorzwx » Fri Jul 15, 2011 1:15 am

keantoken wrote:I don't know much about math, but when I saw it was an FFT algorithm I realized what it was. A good idea!

While It seems the FFT-based resampling should be more accurate than any kind of interpolation, there is still a limit to how much of the original signal can be reconstructed. For one thing, signals above the samplerate will heterodyne backwards in frequency, and no algorithm can tell this apart from the musical signal with 100% accuracy. At the same time filtering out these extra signals before A-D conversion causes unwanted complexity which may decrease sound quality by introducing phase shift, and maybe harmonic distortion.

Another reason for this is that an FFT made from a finite number of samples has a resolution limit. It cannot recover information that was lost in the original conversion.


You may discuss this with Sergey Petrov.

keantoken wrote:an FFT made from a finite number of samples has a resolution limit. It cannot recover information that was lost in the original conversion.

This is true. It cannot recover information which was lost during "computer recording" of "analog sound". That is why it is preferable to record with maximal possible resolution (as you correctly noted). For example, Olympus LS-11 can record 24bit 96kHz format. It can also record 16bit 48kHz format, but, in this case, more information is lost during recording. The result of recording is a two-dimensional set of data (t,A), time and amplitude of the signal. Imagine a function A = F(t) and a graph of it. This graph is displayed in Audacity as "default view" (waveform), when you open an audio file with Audacity. A higher sample rate means more points in time, a higher bit rate means more points in amplitude http://manual.audacityteam.org/index.ph ... ital_Audio
In a word, there are "heretics and dissidents" who may not agree to record with Audacity, simply because they own Olympus LS-11 or Zoom H4.
http://www.frequencycast.co.uk/olympusrecorders.html
http://digitalmedia.oreilly.com/2008/05 ... eview.html
http://www.oreillynet.com/pub/a/oreilly ... order.html
http://digitalmedia.oreilly.com/audio/p ... omparison/

keantoken wrote:Using higher samplerates such as 96k or 192k may shift these errors out of the audible range of hearing, if they are in fact audible. This is why high samplerates are preferred when there will be many sample conversions.

Or may not. It is just an interpolation. It is never exact by definition. You cannot produce "information" from the absence of "information". "Higher samplerate" simply means "smaller step by time". Just a "common sense", just the obvious, no science at all, simply charlatanism. There is, however, a kind of Cargo Cult Information Theory which can easily produce "credible information" from the absence of information. This theory has already produced a lot of "fundamental results" including the most fundamental "Cargo Cult Sampling Theorem": http://en.wikipedia.org/wiki/Nyquist%E2 ... ng_theorem
The purpose of this theorem is to imitate the rituals of mathematics. Otherwise, nobody may believe that it is something "scientific". To fool the public, they use "mathematical terminology", to solve the practical problem, they use heuristic functions discovered by "trial-and-error". These heuristic functions are implemented in ADC and DAC. It has nothing to do with mathematics and with science in general. Just the ancient method of "trial-and-error" which was invented in the Stone Age. This method is also used by our brothers in Vanuatu to improve the shape of "wooden earphones" and "bamboo antenna", and of "wooden microphone", of course http://www.lhup.edu/~DSIMANEK/cargocul.htm
igorzwx
Supporter
 
Posts: 987
Joined: Sun Jun 28, 2009 9:31 pm

Previous

Return to Linux

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron