Wednesday, November 11, 2015

Dynamic Range? What and why

The audio output of some android phones is now better than CD quality, but you need suitable software, such as HeadP on Android 5 or greater, to actually use this capability.

But is better dynamic range helpful?  Chris [c] says no – but he is talking about source media and not about playback that has the same difficulties as recording and production, for which his answer is yes!  So what sort of playback needs better dynamic range?

I will attempt to explain without being irritatingly arcane.

1.      Here, dynamic range is the loudest measured by quietest sound that can be produced.
It is loudest relative to quietest; a ratio of loudest to quietest.

2.      There are many measures of loudness. One can measure amplitude gain or peak power, or time-averages of power, for example.

3.      Here I will use peak power in decibels to measure relative loudness.

4.      Then, a sound is 10 decibels louder if it has 10 times more power.

5.      And a sound is 20 decibels louder if it has 100 times more power.

6.      Human hearing can have a dynamic range of up to 130 decibels [b]:   That is a lot!!!!

7.      CD-quality, 16-bit audio has a dynamic range of about 90 decibels in practice [a].

From 6 and 7 you might conclude that CD-quality is good enough [c].  But if playback involves processes similar to recording and production, there are problems:

1.      Any processing, like adding echoes, may require “headroom” to avoid clipping the signal.
This is because the loudest peak is not known in advance. Then maybe only 70 decibels of dynamic range remains. After further processing, maybe only 60 decibels remains.

2.      Then a quiet section will either be too quiet, or too noisy if the volume is increased, because only a few bits remain to encode the sound.

A 32-bit floating point representation of the signal solves the software part of this problem. There remains only the question of whether the output hardware (digital-to-analogue converter and amplifier) on particular phones is adequate. These are changing fast, so any comment here would soon be out of date. Look for a brand that cares about audio.

References
  1. Fries, Bruce; Marty Fries (2005). Digital Audio Essentials. O'Reilly Media. p. 147. ISBN 0-596-00856-2.
  2. Sensitivity of Human Ear  http://hyperphysics.phy-astr.gsu.edu/hbase/sound/earsens.html#c2
  3. Montgomery, Chris (March 25, 2012). 24/192 Music Downloads ...and why they make no sense

Wednesday, October 21, 2015

Echoes and sound-localization in HeadP version 4.1.3.


An update on the state of HeadP is more than year overdue!  Version 4, July 2014 introduced a major change in sound processing to meet the goals outlined in the original blog  Why headphones don't sound like speakers

The following descriptions refer to version 4.1.3


Echoes (optional) are computed as virtual reflections from 4 walls of a rectangular room. You can alter:
  •  The size and shape of the room
  •  The size, shape and position of the source of the sound
  •  Your position as the listener in the room
  •  The character of the source of the sound with a conventional equalizer

What you hear is the result of adding the direct-path audio to all the echoes. All these signals are stereo, where the stereo separation is the width of the source as viewed from the listener. So 10 signals are added: 2 from the direct-path, plus 2 from each of the 4 walls. The ceiling and floor are ignored in this version.

The original intention was to colour the echoes according to the acoustic properties of the walls. While this should probably be an optional feature, I have not done it, first because users have explicitly said they like it that the sound is NOT coloured by echoes. Also, it would require a fair bit of work on my part, and use significant resources of the device. If this is a feature that you would like, please let me know. I will do it if enough people want it!


A problem with adding 10 signals is that the peak amplitude could potentially reach the sum of the signal amplitudes (though reaching that peak is extremely unlikely). To avoid any possibility of corruption, HeadP  is forced to reduce the volume to avoid any possibly of clipping the output.

Some devices now offer 24-bit output. This is a solution to the problem, to be supported by a future version. I would start work now if there were more of you!


HeadP   uses a unique “Head-Related-Impulse-Response” function to generate a perception of “where the sound is coming from”.  Each of the 10 signals has a direction at the listener, and is individually processed by this response function at each ear. So if you have 2 ears, you hear the sum of 20 individual signals.

This response function is based on a very approximate physical model of a head and ears, with shadowing, diffraction, and timing-difference effects. Although the model is adjustable, I find the adjustments do not have much effect. It is an interesting question of perception. I believe the brain will use any consistent information available, of whatever sort, to infer a location of sound.

In particular, one could ask “why do we have ears?” (I refer to that external visible flap of flesh, the pinna or auricle). The pinna of a hunting animal, like a cat or wolf, is fairly obviously a directional instrument. But the geometry in people is different.

I find that HeadP  gives me a clear perception of sound to one side, or behind me.  If my pinna are at least partly shaped to warn me of danger, maybe especial detection of sound to one side or behind is expected, since we rely on forward-facing eyes to spot trouble ahead.

Sunday, October 9, 2011

Why headphones don't sound like speakers


No, I’m not dead - ok, god willing, not sure about that – but I do know for certain that you are not dead.

How can this be?

One good reason I was not road-kill last week is that I could hear the traffic approaching when I was crossing the street.

I would be very uncomfortable if I heard an approaching truck but could not tell its direction! If there is sound, I want to know where from! One can crouch at the shout of INCOMING, but it is not a happy feeling!
The ethereal non-directional sound one gets from conventional audio player headphones suggests the hereafter, but that just makes me nervous!

Now HeadP is not yet a lot better. It actually calculates the direction of direct sound and the principal echoes, but then has no use for this part of the information at present. I do get some sense of where a singer is however. With the default settings, this is above me. If I move away, toward the center of a larger virtual room, I get the impression that the singer is further away, in front of me. This is a start at least.

Echoes are very important. If you are listening to speakers in a typical room, the walls will be reflecting most of the sound that hits them. If you are listening in a tent, this is probably not the case, but Col Gaddafi recently had a bad experience with his tent. So unless you are very close to your speakers, most of the sound you are hearing has been reflected from walls, ceiling and floor.

Music production studios vary a lot in how much allowance they make for this. Some produce very “dry” sound, good for speakers in a real room, but bad for headphones. Other studios add a lot of “reverb”, which is really a compromise that fails to address the problem of sound localization at all. It totally fails to address the main problem we are discussing here.

If you use HeadP, you can choose to automatically switch to a listening environment that is appropriate to the way the music has been produced, and to your preference for the moment.