Ga naar Nederlandstalige tekst

## Website by Andre Kappert

Profiel van André Kappert weergeven

## Content

DVDtoHP

Sound recordings are mixed for listening with speakers. Even the best headphones can’t hide this.It is as looking through a fishbowl, but than auditive. Strongly enlarged, but also strongly bent, with strong dispersion of frequencies. If a sound source moved in a straight line from the left speaker to the right speaker, it will sound with a headphone as if this movement is circular with a variable speed, from ear to ear. The speed of this movement is also frequency dependent. In figure 1 you see the arrangement of an ordinary sound system with 2 speakers. Let's suppose you are listening to a choir with 120 members. The  members seems to be evenly distributed behind the speakers, the angle limited by the angle of the speakers. What happens when listening this with headphones is reflected in figure 2.

Problem 1:Every ear is reached by the sound of both speakers but the sound of the opposite speaker is somehow damped. The higher the frequency of the sound ,the more the damping. Because with speakers the sound of 2 sources reaches the ear, the sound is amplified. The amplification of the lower frequencies is stronger. This doesn’t happen with headphones so the lower frequencies seems to come from a longer distant the higher frequencies(red is representing the lower frequencies, blue the higher frequencies, in the speaker figure these spots overlap) . Every sound is a compound of higher and lower frequencies.  With headphones these sound don’t seem come from one point but comes from an area. The different frequencies are split. Not only the distant will vary but also the angle will be different because the HRTF (human ratio transfer function) is a function of frequency and angle. Some headphones compensate for the weak low frequencies but this don’t work for the diffraction as function of the angle.
Problem 2:When all the signal is on one channel, with speakers the source seems to be come from behind one speaker, this is the largest possible angle, and it still sounds natural. When listening with headphones the sounds  originated directly in one ear. The other ear is in totally silence. This normally only happens when a mosquito is near your ear and don’t sound pleasant. It can causes even stress because these sound sources seems to come from very close.
Problem 3:The hearing system is trying to calculate the position of the sound source. It is doing this by using the difference in amplitude and by using the difference in phase. Two different systems with the best result for different frequency-bands. But there is overlap at certain frequencies. For these frequencies the systems had to come for the same result as location. These frequencies are located in the most import frequency-band where the hearing is most sensible (1000 Hz to 5000HZ). With headphones these two system don’t give coherent results any more. It is tiring for the hearing system to make sense from these 2 different results. It should also be the reason that with listening to headphones the sound always seems to come from behind.
Solution: Add to the signal of one channel of the headphone, with a delay and filtered according the HRTF, the signal of the other channel.  A sort of artificial head recording. The signal is now as it should be with listening with speakers. The delay takes care of the right phase, the HRTF takes care of the right amplitude. The problem is to find the right HRTF It can be found with testing with a simple sinus test signal. My program DVDtoHP can be used for fine adjustment of the HRTF.
I made a LADSPA filter for doing this job. It can be used with sound editing programs or media players, able to supporting LADSPA filters. In figure 3 is a graphical representation of a test signal of pink noise. Figure 4 is the resulting filtered version. The difference is considerable.

Figure 3: Example consistent of pink noise

Figure 4:With stereotobinaural LADSPA treated example, with gain =1.0

The same technique is used in the program DVDtoHP, but expanded to the rear speakers and the front and LFE speakers so you can listen to 5.1 recording with headphone.  The sound still seems to come from behind so I guess that this is not caused by discrepancy between phase and amplitude information, so there is still possibility for improvements if I understand what is causing this. But the spreading of the sound is much improved.  You now can pinpoint the instruments exactly to the location, the separation of the instrument is improved.

A similar product is the bs2b filter (Bauer stereophonic-to-binaural DSP). The major difference is that my version is specially made for 5.1 recordings, in the form of AC3 and DTS files(Linux version), and it is also usable for stereo. Both are crossfeeder, but bs2b seems to simulate an original analog filter. My version keeps it simple, it uses a delay and a filter, almost the same as in natural. Bs2b excludes the effect of comb filter in the upper range of frequencies through the nonlinear property of phase-frequency response of these filters. I see the the comb filter effect as unavoidable as in a normal speaker situation. With 2 speakers it is also happening. The provided delay gives a simulated position of the speakers, the damping had to be adjusted so that the damping and the delay leads to the same position. The filter is a convolution filter. For comparison of my filter and the bs2b filter, there is a radiobutton in the program HP_Player for choosing between these filters.

The Linux version is a .deb installation program also used by Ubuntu. It also installs a simple audioplayer(HP Player) what could be started from the menu. This program chooses automatically the right converter for the 6 0r 2 channel audio file. It can almost play any audio format (except the wma format). For this program a fast computer is necessary (more than 1.7 GHz duo core simple notebook). The windows version of HP_Player is limited. The best results are expected with 5.1 audio files, but this version only works with stereo files and only with limited formats. The implementation of all the functions was to difficult or impossible in Windows. For windows and Linux, there is also a VST version. When working with a DAW, good monitors are necessary to listen the result. With this filter plugged in the master, it is also possible to mix and master with headphones (and remove the filter in the final result else the recording only sounds great when listened with headphones and not with speakers).

Updated 11 juli 2018:Dependencies libav-tools and libqt4pas5 removed because not available in modern repository of Linux Mint.

Download LADSPA and VST plugin for Windows 7,8 and 10 (VST 32 bits version and 64 bits version).

## DVDtoHP

DVDtoHP is meant to extract audio tracks from music DVD's. This is about the Linux version, but the Windows version is almost the same. There is also a Windows and a Macintosh version to download. The audio information on DVD is mostly available in different forms. The best quality is the .dts(5.1) track, second choice is the .ac3(5.1) track. Sometimes there is a stereo track available (in ac3 or lpcm format). The stereo tracks are often not the best quality, too much compression and even clipping. First experiment I have tried to down-mix the 6 channels to a 2 channel recording with audacity. When the rear channels were mixed with the front channels sometimes weird sound-effects or messy stereo image were created. When the rear channels where just left out, some important sound information was missing.
A different approach was necessary. It isn’t possible to recreate the sound-image of 6 speakers with 2 speakers or it should be an "artificial head" recording (or binaural recording) in a surround-sound setup, listened with headphones. DVDtoHP simulates an "artificial head" recording. Sound from a left channel reaches first the left ear and with a delay it also reaches the right ear. Higher frequencies are muffled more than lower frequencies. This is simulated by deliver the signal from the left side filtered and delayed to the right side and visa versa. The rear and front channels get a different delay and filter. The rear channels get a longer delay and are more muffled than the front channels.
It is difficult to predict how this will sound to different people. Every person has a different HRTF, Head Related Transfer Function caused by different size and build of head and ears. In fact a normal stereo recording shouldn't be listen-able with a headphone. Sound is delivered totally independent to the ears, in normal situations this only happening when a bee is buzzing in one of your ears. The human brain is still capable of processing these sounds. I believe the human brain is even better capable to process the sound from the artificial human head used in this program.
An example: take a recording of a low frequency signal with one channel in anti-phase with the other channel. When listening with speakers you will hear almost nothing (sometimes this actual happen when the wires of a speaker are wrongly connected), when listening with headphone you will hear the full power of the recording. A proof that a recording can sound totally different when listened with headphone. When processed by this program you will hear almost nothing as if you listen it with speakers.
The program is able to convert not only 5.1 audio but also stereo files ( wav, flac, mp3 etc.). Listening to the converted files, sound as if you are listening to speakers, giving the intended sound experience as meant by the mixer. The CD's are mixed for speakers in the normal configuration, not for headphones.
The program is capable of converting multiple files at the same time, using the multi-core processors optimal. The converting could be done in the background of normal computer use.
The program has three buttons. The first start a window in which you can choose which audio track you want to extract from the DVD. It will be saved in the original format, no conversion will take place. The file will be saved in the original dts, ac3 or wav format. The program uses mplayer program to extract, so package mplayer must be installed.
The second button starts the conversion, first it asks for audio input file, second it asks for the saving file name. If the extension is mp3 or flac it will ask for meta data, and automatically compress the audio file. Then a wait screen will start with the progress. This is an independent window, allowing you to start another conversions from the control program. The program uses ffmpeg ( from ffmpeg package )to decompress the file to a 6 channels floating points file.
Then my program will convert this file to a 2 Channels floating points file. Then it will normalize and convert it to an ordinary microsoft wav 16 bits, 2 channels file. Last step it could be compressed with lame program or flac program if extension was flac or mp3.
The program depends on the program ffmpeg of package ffmpeg for decompressing dts and ac3 files to floating points, sox of package sox for eventually resampling the file to 44100 (the quality of sox seems better than ffmpeg for resampling). For ripping the DVD it uses mplayer of package mplayer. For compression it use Lame of package lame and Flac of package flac. All these programs will automatic installed by the deb installation program. For other Linux versions the bare program is provided. The dependencies must be provided by the user.
It is unclear for me if Package libdvdread4 (you have to activate it with "sudo /usr/share/doc/libdvdread4/install-css.sh" in terminal) needs to be installed. This is necessary for descrambling DVD. Somehow this package was installed always automatically on my computer, so  I never checked the necessity of this Package (I had even forgotten the existence of the package).

### Updated version

Added the ability to create and load a personalized version of the HRTF (head related transfer function). In the first version I had used a HRTF obtained from the Internet, randomly taken from a graphic found by coincidence. First version I had no big attention for an exact HRTF, because this would be a different function for every human and it is not easy to measure a personalized version of the HRTF. All listening with headphones sounds as if you were sitting with your back to the orchestra (a phenomenon normal for listening with headphone!). This problem should be caused by a not exactly correct HRTF, sadly this problem is not solved. I have tried versions with extra phase control and extra delay control, but this didn't solved it. The spreading of the sound over the space is now improved and it sounds more natural.

### How to create own HRTF (layman could use the default HRTF).

Delayfront: the delay caused by the longer distant from the left front speaker to the right ear in comparison from the distance to the left ear. 2.5e-4 seconds is 11 samples at 44100 samplerate, and it means 7.5 cm extra distant. I suggest not to change it, if to large all the sounds seems to come from very near.
DelayBack: The delay from the speaker on the left side to right ear in comparison to the left ear. 6.12e-4 sec. Is 27 samples with 44100 samplingrate and means 18 cm.
Beeplength:Length of the testbeep.
SampleFreq: Sampling frequency of testbeep, not important.
Testlength: Testbeep is repeated from left to right, this is the total length of testsound.
The list headed “List of HRTF”: The actual HRTF ,first number is frequency, second number is the damp for the front speakers, the third is the damp of the speakers on the right and left side. Last frequency in list is always 24000 Hz, because DVD recordings has a bandwidth of 24000 Hz .
The list headed “Testfreq Width”:First number is frequency of testbeep, second number is bandwidth of testbeep. More frequencies (lines) are possible. I suggest to keep a bandwith of 1 hz and only one frequency.
HalfPulse checkbox:gives testbeep sharp attack, only use it in final testing because it increases bandwidth
Nameof:Here you can choose a name for the HRTF

### Testing:

Use headphone, push button “Test Front Audio”. If adjustment is correct, the sound you hear should originated from speakers at an angle of 30 degrees behind of you. If the sounds seems to come more from the center, you had to make the second number for that frequency in the HRTF list smaller. If the sound seems to come from to far sideway, you have to make it larger. Repeat this for every frequency in the HRTF list. If necessary add extra frequencies to the list. The test signal should sound symetrical. At frequencies between 1000 HZ and 4000Hz something strange could happen. For my ears the test signal was not longer symmetrical. This was caused by a wrong HRTF for this frequency. The delay leads to another sound direction than the information of the damping. The brain could not solve this sound-image and comes for every ear with a different solution. Adjusting the level of damping to the right HRTF level made this more symmetrical, because the information from delay and the information of damping are no longer conflicting. Exactly this is the reason for creating your own HRTF, and why headphone listening with the sound-processing from this program is more pleasant.
With “Test Side Audio” button the testbeep should become from your side. First try to make the number of the last column for the testfreq larger. If the sound seems to come from a point not exactly from the side (more centred) then make this number again smaller. Find this boundary. If you make it to small the origin seems to getting to close to your head, and this is difficult to hear from the test signal. (These numbers are not used with stereo recordings, only DVD has this channels). Repeat this for all the frequencies in the HRTF list.
Test both buttons for all frequencies again with the “HalfPulse checkbox” checked.
In the list of test frequencies you can set the testfrequency, The second number is the bandwidth of the testfrequency. The testfrequency is generated by filtering a delta function or white noise width the bandwidth. The source is chosen by checkbock "white noise".

Save the result with the “save file” button. If saved with the name”default.hrtf” in the home directory, the HRTF will be automatically loaded every time with the start of program.

### Examples (for testing with headphone)

The examples are just from stereo recordings, because it should be royalty free. The best quality should come from DTS recordings. The recording(Example1) is made with Hydrogen drumcomputer, just the stick and the kick moving from left to the right. The original sound as if the first hit comes from a point near your left ear, the next from an unclear point in the middle, the last from a point near the right ear. The converted file sounds as if the instrument made a normal trajectory. The most extreme positioning (absolutely left or right) doesn't come from a point near to your ear. The converted to binaural audio examples sound much more natural. The original versions sound annoying if listened with headphone. Sometimes it sounds as 2 mono signals.  A more extreme example is Example2, Noise on one channel. In the original, the sound originate in your ear and is totally unnatural. The converted version sound as if its originate of a speaker at an angle of 30 degrees right behind you, and is much natural. It is still coming from behind you, but nicely placed in space. At home I listen only to converted recordings with headphone because I find it more pleasant. If the original was a 5.1 recording the binaural converted recording should sound much wider. There exists a version of "Aero" of Jean Michel Jarre specified as a "Dolby headphone" version. I think for making this, they used a similar process. I thought my version from ripping the DVD sounds better.

Example1: Origineel and Converted Binaural

Example2 (Extreme example):Original and converted Binaural

For the same effect I have created a LADSPA filter version. In goes the normal stereo or 5.1 version, out comes a version adapted for listening with headphone. Windows version is 32bits also working in windows 64 bits. For working with Audacity, place the stereotobinaural.dll file in the directory “C:\Program files(x86)\Audacity\Plug_Ins” . Enable it in the Effect menu. The effect is now visible as “stereo to binaural”. In Linux, just double click the deb installation file. For visibility in Audacity, enable it in the Effect menu. In OSX place the libstereotoheadphone.so in the directory "Application/Audacity/Plug-Ins". For visibility in Audacity, enable it in the Effect menu. The effect is now visible as “stereo to binaural”.

Updated 11 july 2018:(Linux)Dependencies libav-tools and libqt4pas5 removed because not available in modern repository of Linux Mint.

Updated 14 august 2018:(Linux,Windows)Added support for DSF and DFF files (from Super Audio CD's)

Updated 07 july 2019:(Linux,Windows)Added support for not only stereo and 5.1, but also every format between (like 5.0)

Update 05 august 2019:Added support for sofalizer from ffmpeg. For experimenting with sofa files. First try, 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. Solved: problem was with type=time, now use type=freq option.

Update 07 september 2019:added support for opus format, import and export.

DVDtoHP version For Windows (64 bits and 32 bits) with all dependencies

!!!!! If link for Windows version doesn't work then download from freewarefiles.com (search for dvdtohp,older version without DSF support and without 5.0 support)

The windows version uses ffmpeg.exe, mplayer.exe, sox.exe, lame.exe and flac.exe. They are all placed in the download file because their locations and versions are more controllable. Downloads and info of the used programs are on the next websites.

Macintosh Maverick instruction

Unzip zip file, application is in extracted map. With use of Homebrew the dependencies had to be installed. Open Terminal in Maverick, type in Terminal

ruby -e "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

next: type in Terminal

brew tap homebrew/dupes

These 2 lines where necessary for me to install GDB in Maverick for use with Lazarus (Just type in Terminal  now brew install gdb to install GDB). All the dependencies could now easy installed with the same instruction.
brew install libav
brew install mplayer
brew install flac
brew install cdparanoia
brew install sox

## CDRipper, GUI voor cdparanoia

A graphical interface for cdparanoia. The program gets CD info with abcde, if it is not on the CDDB server it search for CD text info with cd-info from package libcdio-utils and compresses the ripped audio file with LAME to mp3 or with flac to flac files. It automatic places the cd info in the mp3 file. While ripping a new track it compresses at the same time the previous ripped tracks, making use of more cores of the processor. If there were any errors during ripping it displaces the errors location in a clear way. The messages of cdparanoia aren’t always that clear. The button "Rip Cd to Headphone audiofile" rips the whole Cd in one file and also creates a binaural soundfile for headphone( see DVDtoHP). This is my personal favorite button.

Small screen images

Large screen image

Iaddi (1+1 in letters) Calculator with text input, 3 variables. Calculates numerical integration and numerical differentiation. Creates a graphic of the function. Does not need any permissions.
Functions: *, / , + , - , ^ ( power of), sin(), cos(), tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, sqr, sqrt, exp, ln, log, abs, rnd, random, rndg (random met Gaussian distribution), cot, csc, sec, acot, acsc, asec, coth, csch, sech, acoth, acsch, asech, sign, round, torad (from degree to rad), todegr (from rad to degree).
Boundaries for drawing graphic and integration can be given by using Start x, End x, start y and end y.
If start x and end x are the same, the boundaries for y are calculated automatically.
If start y and end y are the same, the boundaries for y are calculated automatically.

Warning:Integration can not recognize singularities, input of infinity is not possible. When a graphic with a singularity is drawn it is necessary to restrict the y boundaries by fill in start y and end y

## Send in letter “Elektuur”

A send in letter from me was publicized in the Dutch magazine “Elektuur” January 2001. This letter regards the recording quality of cd's, especially about clipping. On the Internet I found there where a few translations or summarizing in German ,French and English. Recently I found a few references in Germany to this letter. That's why I placed the original letter and English translation on this site.

### Translation of send in letter from Elektuur January 2001

Dear Editor — roughly a year ago you had an article in Elektor Electronics about CDs that were supposedly recorded with overdriven signals. An oscilloscope was used to look at the outputsignal of a CD player playing Jean Michel Jarre’s ‘Oxygen 7- 13’. It was clear that the peaks of the waveform were flat where the signal was greater than what could be reproduced by the CD. This is also known as clipping. Using an oscilloscope in this way can’t really tell us how much the CD player affects the signal quality. Between the CD and oscilloscope will be an oversampling digital filter, a digital-to-analogue converter and finally an analogue filter. The most accurate way to check a CD is to extract the track digitally and store it as a WAV file. This will be an exact digital copy of the CD, assuming there were no read errors. The creation of the WAV file shouldn’t be a problem since it is a function that is found in most current CD ‘rippers’. A computer program can then be used to analyse the contents of this WAV file. A WAV file consists of a header followed by the thousands of samples that make up the digitised sound. The 16-bit format used on CDs gives these samples a range from -32768 to 32767. In order to have a closer look at these WAV files I have written a program that can analyse them. As the first step, the program creates a histogram of the WAV file. This counts how often each sample value occurs in the WAV file, and gives a display as shown in Figure 1.

Figure 1

The values near zero occur most often; the more you go to the extremes of –32768 and 32767, the less often they occur. If there was any clipping at the recording stage, all strong signals will be rounded to the extremes of -32768 and 32767, which results in two peaks at the ends of the histogram. This way you can see if there is any clipping present and at what level (it is possible for it to occur at different values than -32768 and 32767, due to badly set up A/D converters). Next, the program displays the actual waveform stored in the WAV file. This window has a search facility that searches for clipping values, as determined by the previous histogram function. I have used this program to analyse the track “...Baby One More Time” by Britney Spears, from her CD “...baby one more time”. It was obvious that there was a lot of clipping in this track, but the display returned by the histogram was the most surprising. This is shown in Figure 2.

Figure 2

It contains the number of occurrences in the WAV file for samples with values from 4 to 515. After every two values that occur over a 1000 times, there follows a value that rarely or never occurs at all. You could only get such a histogram when a 16-bit recording is re-recorded after amplification by a factor of 1.5. Samples with values of 1, 2, 3, 4, 5, 6, 7 etc. are multiplied by 1.5 to give 1.5, 3.0, 4.5, 6.0, 7.5, 9.0, 10.5 etc. These values then have to be rounded to integers before being written to the CD. This gives the result 2, 3, 5, 6, 8, 9, 11 etc. You’ll see that every third value is missing from this series of numbers. By looking at the waveform where clipping occurs, it is possible to deduce by how much the recording of the CD was overdriven. I estimate this to be a factor of about 1.5. From this I conclude that the original mix, which was recorded perfectly, was remixed with an amplification of 1.5, causing clipping in the new recording. The track “Gloria, lonely boy” on the CD “Metamorphose” by Jean Michel Jarre was then analysed, in order to see if his latest CD had signs of clipping. Here too it seemed that the recording was overdriven. But once more it was the histogram that returned some fascinating information (Figure 3).

Figure 3

The smallest and largest samples found in the recording were -32022 and 32021 respectively (0.977 of the maximum range). These were also the levels at which clipping occurred. From the histogram it can be seen that every fortieth value is twice as large as its neighbours are. From these observations you can conclude that this CD is a remix of an original CD recording. The samples have been multiplied by 0.977 before being converted back into CD format. This raises the question why this meaningless conversion was carried out on the recording. The only reason I can think of is that the remix was made to hide the fact that the recording was overdriven. Anybody who uses an oscilloscope to look for clipping would set the trigger level at the largest possible signal level, about 99.9% of the maximum signal possible. The remix would cause the signal to remain below this level so the oscilloscope would never trigger and the clipping would remain undetected. The person making the remix would have known that clipping occurred and was determined to hide this fact. The correct procedure would have been to make a slightly softer remix from the master tape and avoid any clipping that way. The record industry is currently promoting the new Super Audio CD (SACD), which has an improved quality. They would be better off stopping the messing around with the recordings. These fudges also sound bad in SACD format and making careful recordings in CD format will result in bigger improvements than the change to SACD format.

A. Kappert, Deventer

Some people think that these results are caused by compression. But at making cd's, compression means reinforcing the weak passages, reinforcing the strong passages is not possible because these already reach their limit. With a sound editing program the wave shape can be examined. Here is the result made with the provided program of”… baby one more time” at the position 114.885 sec.

Figure 4

Every pixel to the right is a new sample. One of the channels shows clear clipping over a large length and in severe degree. The wave shape have been clearly damaged because of this. Compression will change the envelope of a signal but won't affect the shape. Long before the signal becomes to large the volume will be slowly turned down to prevent clipping. An estimation can be made over the original signal size,I estimate it 1.5 larger. Remains the question about why this signal is strengthens. It appears that by comparison of sound quality of Hi Fi signals, the first preference goes out to the strongest signal. Also at radio broadcasts, the recordings with the largest sound strength attract the most attention.

Figure 5

To addition in figure 5 “oxygen 7”of J. M. Jarre on 27.37 seconds. Here clearly the “saw tooth” is cut off, in this way losing a lot of harmonics in the sound. At “Methamorphoses” the signal appeared to be weakened with 2,5%. It appeared that cd mastering equipment is protected against clipping. To get around this protection, it is necessary to weaken the signal, but at that moment it is known that clipping occurred.

### Last Version download (with APE and FLAC file support,20 November 2016)

To Download ( updated ) analyse program (cdwavanalyse,linux Ubuntu or Mint, 64 bits deb)

To Download ( updated ) analyse program (cdwavanalyse,linux Ubuntu or Mint, 32 bits deb)

Old windows version with only wav file support

## Mandelbrot fractals

This program draws Mandelbrot fractals. With a left mouse click you can zoom in, with a right mouse click you can zoom out. It is possible to zoom in with factor 1E16.