Hydrogenaudio Forum => Uploads => Topic started by: Andre_K on 2018-08-01 20:30:59

Title: 5.1 channel to binaural converter
Post by: Andre_K on 2018-08-01 20:30:59
Deb installation files for DVDtoHP program (Linux 32 and 64 bits). This program converts audio files for listening with headphones. Original created for converting 5.1 audio files, but it also converts stereo files into binaural files. Every time I listen to music with headphones, I listen to files converted with this program. Most times I used it for normal stereo files, ripped from Cd's. It just sounds more natural! It has also a function for ripping audio from DVD’s (DTS and ac3).
Title: Re: 5.1 channel to binaural converter
Post by: Andre_K on 2018-08-30 15:58:08
Converted (to headphone file) part from DVD “Aero” (the DTS 5.1 file)from JM Jarre and the original part on the CD version. Listen to it with headphone. The CD version has unnatural stereo and is extreme compressed and has clipping. The converted DVD audio is much softer because there is no compression applied. It may be necessary to adjust volume to make a fair comparison. Louder is not the same as better (loudness war), but at first hearing louder seams better.
Why to headphone format? It is almost impossible to make a good down-mix from 6 to 2 stereo channels. There is always the compromise, what to do with the side/back channels. Making a binaural conversion avoids to making this compromise. This extreme example also makes clear what the problem is with headphone usage for stereo listening.
Title: Re: 5.1 channel to binaural converter
Post by: Andre_K on 2019-07-09 09:06:43
New version 3.1: Last version could only support stereo and 5.1 files. Now it also supports everything between stereo and 5.1, such as 5.0,4.0 and 3.0 . It is also very usable to convert unusual audio formats to normal stereo formats (16 bits, 44100 or 48000  Hz).
Title: Re: 5.1 channel to binaural converter
Post by: Andre_K on 2019-08-09 16:26:21
Update 3.2:Version with sofalizer function. Just recently found that ffmpeg last years has got the sofalizer function, almost with the same purpose as my dvdtohp program. Now dvdtohp has a tab, for use this sofalizer function. Most of the trajectory, it uses the same algorithm as dvdtohp. First convert to floating points numbers, then convert to binaural stereo, last step, normalize and convert to 16 bits format.
For use of this function, you need a sofa file. Those can be downloaded from  https://www.sofaconventions.org/mediawiki/index.php/SOFA_(Spatially_Oriented_Format_for_Acoustics) . I found ClubFritz1.sofa gives a good result. I tried with ClubFritz6 and ClubFritz11, with gives distortion. I tried dtf_nh2.sofa which gives a result without frequencies below 300Hz. So be careful which sofa files you choose.
Title: Re: 5.1 channel to binaural converter
Post by: mycroft on 2019-08-10 11:19:03
You need to use latest git master ffmpeg where issues with some sofa files have been solved.
Title: Re: 5.1 channel to binaural converter
Post by: mycroft on 2019-08-10 11:30:28
Also here you can get more wav files: https://shanonpearce.github.io/ASH-IR-Dataset/

This can be used with ffmpeg's afir or headphone filters and more complex filtergraphs (the one with sofalizer are extremely trivial).
Title: Re: 5.1 channel to binaural converter
Post by: Andre_K on 2019-08-14 16:15:29
Original version of ffmpeg was 3.4.6. I tried to compile version 4.2 version, but there were dependency problems. Then I found a ppa with version 4.1.4. The distortion with ClubFritz6 and ClubFritz1 still exists. Then running from command line, I saw something like “Outputstream 96000 Hz” for a 44100 Hz file? The resulting file had a samplingrate of 44100 Hz and was 2.17 * longer(=9600/44100). I tried a file with samplingrate 96000: still distortion.
The problem was (also within dvdtohp): I used the “type=time” option. When I used the “type=freq”  option, the distortion disappeared. But then the output is resampled to a samplingrate forced by the sofa file. ClubFritz1 gives a 44100 Hz.., ClubFritz6 gives 48000 Hz and ClubFritz11 gives 96000 Hz.
I thought sofa files contains Impulse Response files with a samplingrate of 44100 Hz. Then the “type=time” option for audio file with samplingrate of 44100 Hz. should give the best result. I suppose sofa files are constructed in a different way.
Conclusion: The “type=time” option is not always supported and the resulting audio is resampled too a frequency, specified by the sofa file. The unpredictable resampling for every sofa file makes it difficult to incorporate the sofalizer function in dvdtohp.
Title: Re: 5.1 channel to binaural converter
Post by: mycroft on 2019-08-14 17:54:38
You clearly lack some deeper insight in all of this. I know what I talk about as I ported sofalizer filter and wrote other filters that deal with this.

You need 4.2 where this issue have been fixed. And sofalizer picks sample rate depending on sofa file because that way you can have best output. The sofa files can have only single sample rate impulse responses which have fixed sample rate.
There is nothing unpredictable in resampling. Either you resample impulse response file or you resample input audio.
This is some basic info for convolution that those types of filters do.
Title: Re: 5.1 channel to binaural converter
Post by: Andre_K on 2019-08-15 11:58:57
My compliments for your work for such great programs as ffmpeg.

“You need 4.2” In real life this means most Linux users can’t use it. I have the latest Linux Mint version(19.2) with ffmpeg 3.4.6. If I (and others) want to use version 4.2, they have to build it. Not everybody is capable of doing this. Which configure options to use? Happily ffmpeg shows these options when running. Then installing missing packages, not a real problem. But I stopped when the messages of “wrong versions installed” emerged. I know this problem as “dependencies nightmare”. Time will heal every wound. Some day version 4.2 will emerge in the normal depositories.
I know that sofa files are constructed with use of measurements. And the samplingrate used for these measurements is the native samplingrate with best results. I had read somewhere that all these measurements (for sofa files) were done with 44100 Hz. So first step in my program was to convert to 44100 Hz. Then there should be no need for other samplingrate conversions. I never thought that sofalizer would resample to other samplingrates (and the “type=time” version doesn’t do that), even to 96000 Hz. So a 44100 Hz file may end as a 96000 Hz file. The best result, but with no more information than the 44100 Hz file.
Every extra conversion will erode the result. I can use (and will use in future versions) the “type=freq” option. But I also will add an extra resampling. I find the conversion from 44100 to 96000 Hz undesirable. And this will be an extra conversion. My program was designed to be simple usable.

 I am curious. What does sofalizer do with the frequencies you can’t hear. Samplingrate of 96000 Hz gives a bandwidth of 48 kHz. Everything above 20 kHz, you can’t hear. But microphones in an artificial head can still register these frequencies (or probably the microphone can’t even handle these frequencies) . I guess, these higher frequencies just will be filtered away. And the higher samplingrate is used for avoiding rounding errors. The largest problem is still that an artificial head will never behave as a real head. Every head and ear is different in seize and building, it is even asymmetrical. Every sofa file is just a confection size. And a confection suit, made by a professional tailor, is still a confection suit. At some point more precision makes no sense.
Title: Re: 5.1 channel to binaural converter
Post by: Andre_K on 2019-08-18 19:43:11
Version 3.2.1:
Update for the problem (distortion)with some sofa files. It now uses standard the type=freq option, which also works with older ffmpeg (before 4.2) versions (this was type=time).
Older versions had sometimes problems opening audio files without metadata. Solved.
SimplePortal 1.0.0 RC1 © 2008-2021