achabotl / pambox

Python auditory modeling toolbox.
http://pambox.org
BSD 3-Clause "New" or "Revised" License
35 stars 8 forks source link

Level adjustment should work for binaural signals too #31

Open achabotl opened 9 years ago

achabotl commented 9 years ago

In speech.Exeriment.adjust_levels, it should be possible to adjust the levels correctly even if the signals are binaural. A way to do this is simply:

average_level = np.mean(utils.dbspl(signal))

Average level should therefore always be a single number, independently of if signal has one, two, or more channels.

achabotl commented 9 years ago

Something like this should do the trick:

mean_level = np.mean(utils.dbspl(signal))
adjusted_signal = target * 10 ** ((target_level - mean_level) / 20)