Equal Loudness Curves Implementation
May 13, 2008 at 7:31pm
Equal Loudness Curves Implementation
i’m currently searching for a way to implement the good ole’ equal loudness curves in Max/MSP… short of digging up ISO data or using some kind of crudely-drawn table lookup, the only way i can see doing this is to implement the equations:
i’m not a super-huge math guy, and it appears that in this paper they give equations with constants that are undefined…
has anyone had success in implementing an amplitude scaling function based on the curves? i’m looking into some kind of db to A-weight conversion, or something like that, but i’m currently at a loss.
Ideas are welcome… i just want the amplitude to follow the equal loudness curves for a pure tone generated by cycle~…
May 13, 2008 at 10:32pm
Quote: firstname.lastname@example.org wrote on Tue, 13 May 2008 12:31
Look in the examples folder /examples/spatialization/panning/
May 14, 2008 at 6:41am
Matthew McCabe schrieb:
I think you don’t need the exact curve. Just take the distance between
May 14, 2008 at 5:25pm
it is also nice to use peek~ where you either draw your own curves
On Wed, May 14, 2008 at 7:41 AM, Stefan Tiedje
May 14, 2008 at 6:34pm
I think the OP is asking about the Fletcher-Munson equal-loudness curves which don’t have anything to do with panning (http://en.wikipedia.org/wiki/Fletcher–Munson_curves) but rather filtering the spectrum of a sound to adjust for the fact that our ears are more sensitive to certain frequency ranges and less to others. Correct me if I’m wrong.
I don’t know of an implementation in Max, but I sure would like one :)
May 14, 2008 at 10:46pm
Quote: email@example.com wrote on Tue, 13 May 2008 21:31
It is quite easy to find the data for A-weighted sound. The abbrevation is dbA and very common. You will find a load of redundant technical descriptions, here is the curve at Wikipedia:
But if you have special requirements, read the article at Wikipedia, it contains enough information to tell you that A-weighting is not the ultimate method and that there is no ultimate method at all.
If you make something for yourself, to be used in your environment, be aware that a defined curve for audible sound depends on a room. No standardized method can take the room modes and other acoustical behavior of your (!) room into account. You can buy a reasonable good measurement instrument and measure exactly at the point where you are going to hear the sound. But if your room is sub-optimal and acoustically untreated, you might experience big differences within a couple of centimeters.
You can of course also use your ears, always a good idea when you deal with audio stuff :-)
May 15, 2008 at 1:44pm
oops, too little sleep, too much max… :)
On Wed, May 14, 2008 at 7:34 PM, John MacCallum
May 15, 2008 at 3:45pm
Hi guys —
indeed, i am talking about the equal loudness contours, and not panning. :)
this is a difficult project, indeed… let me go into a bit more detail, maybe it’ll be clearer…
i’m involved with a neuropsychological study of pure tone perception, so ideally the subjects will be wearing headphones.
now, i know they are sinful sometimes, but in this situation it is the best way to prevent distractions. the topic of the study demands that we control for volume, since it is pitch perception that is being tested…
so, here’s the question… if the amplitude of the headphone output is fixed, say at a particular dB SPL level… perhaps then one of the weighting scales will be appropriate?
i’d like to do this with loudspeakers but it’s just not possible… :(
May 15, 2008 at 4:29pm
> so, here’s the question… if the amplitude of the headphone output is fixed, say at a particular dB SPL level… perhaps then one of the weighting scales will be appropriate?
ok, so why not dump maybe three curves (for three fixed dB SPL levels inside the headphones) in buffers and do a lookup what the amplitude scaling factor is for a given frequency?
1 phon is by definition 1 db SPL @ 1kHz.
your 8k value should be something like 8 dB or 2.51 while you 63 Hz value should be around 15 dB or 5.6 at 80 dB SPL
the rest of the values you can just get from the curves. before you hurt your brain trying to get all the math exactly right (i am like you, no math wizard _at all_), why don’t you just manually put in 10 values for each of the three reference SPLs, linearly interpolate between those values and see if you get all that working?
if this is all working for you, it will be a relatively easy step to get more accurate lookup tables (if you even need them)
You can very easily store your linear amplitude values in buffers if you just scale the values down by a factor 100 and offset by -1. when storing and back again on lookup. This gives you a range of 0 to 200 for your scaling factors which equals -infinity to +46 dB. that should be enough crank up even your 31 Hz at a reference of 60dB SPL.
hope this helps.
ps: i used figure 2 on page 6 of the pdf you linked to guesstimate my values. eventually you should do this very accurately, of course.
May 15, 2008 at 5:53pm
Quote: firstname.lastname@example.org wrote on Thu, 15 May 2008 17:45
If you are going to measure pitch recognition via headphones you are in the low level range and A-weighting fits well. And you can get all curves you need for that. For such a research project I would not experiment on my own because this part of the research is all done, cross-checked a thousand times and ready to use. Better transform existing curves to your system and exchange them in case you find something better.
Despite of my limited experience I don’t see the problem in Max/MSP because you know the circumstances and deliver the tones. Of course you have to think about about the signal and the waveform and perhaps you need to look how others do this if you want to compare your findings to theirs. Clean signal ramping, type of waveform etc.
But you say “if the amplitude of the headphone output is fixed”. Sounds logical but isn’t trivial: Good linear audio interface. Matched headphones for several test persons, frequency-wise, amplitude-wise. How can you rely on the exact sound output of such small speakers? How do you get a definable output from a headphone preamp? What does the preamp do to your exact frequencies and amplitude? Influence of the cables. Might require some expensive gear. Probably special devices for measurement tasks, depending on your requirements.
Jun 3, 2008 at 7:47pm
> But you say “if the amplitude of the headphone output is fixed”.
understandable criticisms all around… we’ll be using a MOTU 828mkII with a nice set of Sennheiser headphones.
as for calibration, we’ll be at the speech and hearing clinic here at the hospital which has an in-ear microphone that can measure the SPL at the tympanic membrane. so, the level can be re-calibrated every time the equipment is turned on.
i don’t think it’s 100% necessary to be _exact_, i’m trying to get a “best-effort” implementation of the equal loudness curves… still looking for suggestions if anyone is still reading this thread!
Jun 4, 2008 at 8:46am
This Matlab script spits out curves based on the current ISO standard:
Assuming it just comes as Matlab source, you should be able to port it.
Matthew McCabe wrote:
> i don’t think it’s 100% necessary to be _exact_, i’m trying to get a
Jun 5, 2008 at 8:05am
I believe this is the MATLAB script that owen wanted to post but I didn’t find it in the message so… here it is
function [spl, freq] = iso226(phon);
af = [0.532 0.506 0.480 0.455 0.432 0.409 0.387 0.367 0.349 0.330 0.315 ...
Lu = [-31.6 -27.2 -23.0 -19.1 -15.9 -13.0 -10.3 -8.1 -6.2 -4.5 -3.1 ...
Tf = [ 78.5 68.7 59.5 51.1 44.0 37.5 31.5 26.5 22.1 17.9 14.4 ...
%Deriving sound pressure level from loudness level (iso226 sect 4.1)
%Return user data
Apr 3, 2009 at 5:44am
Sorry to repopen an old thread, but did any have luck implementing the matlab code? I’m not a matlab user, but I’m curious to see if this was a success. I would greatly benefit from this.
Apr 3, 2009 at 12:11pm
if someone would be so kind and explain what f, af, Lu, and Tf means in those matlab tables, it will be very easy to make a max patch out of it.
the only thing what is a bit dumb is that in a music software context we normally use dbA (20.^n/10) and not dbSPL (10.^n) and it is bit hard to think in dbSPL.
-110 (who is also looking forward to it)
Apr 3, 2009 at 12:23pm
hi everyone -
i actually ended up going with an inverse A-weighted EQ curve and adjusting my pure tone stimulus – it’s not ideal but it’s an effort. it works pretty well as far as i can hear.
roman: i believe the matlab function above returns an array of gain values based on the desired phon level. it’s kind of a conundrum because the end result is going to be dependent on the amount of gain on the signal _after_ it leaves the computer, i.e., how loud headphones or monitors are turned up.
it’s a difficult problem…
Apr 3, 2009 at 4:03pm
Roman, it would be extremely appreciated if you were able to make a patch that implemented this! Thanks!!!
Apr 3, 2009 at 4:45pm
A direct and quick translation of the m script to Max can be done quite easily and could give something like that :
– Pasted Max Patch, click to expand. –
Copy all of the following text.Then, in Max, select New From Clipboard.
hope this helps
Apr 3, 2009 at 4:59pm
Awesome actually. Continued thanks!!
Apr 3, 2009 at 6:43pm
didnt had the chance to check the max5 patch above but yeah it is really not much more than a table (or buffer) and a *~.
>because the end result is going to be dependent
that makes it indeed a bit more difficult, i think we forgot that.
at least i understand now why there are 4 lists of coefficients and not only 2 like i would have exspected first.
this reminds me on my try to add a “humidity” parameter to an air absorbtion filter and had to find out that the effect fog has on absorbtion is all but linear.
edit: you might find more help here
Apr 3, 2009 at 8:09pm
well, of course you could always use your friendly neighborhood SPL meter and stick a cycle~ at 1khz. the phon level matches the db SPL at 1khz —
in other words, if you’re going for 40phon, and you run a cycle~ 1000 out at your selected amplification level, and the meter reads 40db, you’re good to go!
You must be logged in to reply to this topic.