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.