sound processing - avarage amplitude?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Niklas Paro

    #1

    sound processing - avarage amplitude?

    Hello

    I would need way to check the amplitude (over time) for a sound file in
    python. I'm sure this can be done, for example the audioop.rms function
    seems to be able return amplitude values. However, it would be really
    great to get the results in dB, which does not seem to be the case.
    Anyone who has more information about this, or a way to convert the
    results? I've searched google but info about audioop seem to be quite
    scarce. Also, does audioop function perfectly also for wave files? Also,
    cross-platform solutions are of course preferred, but I'm running linux
    (with oss).

    I've also looked somewhat into tkSnack (http://www.speech.kth.se/snack/)
    which has a dBPowerSpectrum function which might be doing at least
    partially what i want it to, however, the returned values are approx.
    -100 ... which I find odd. The "real", recorded sound was somewhere in
    the 50-60dB range.


    thanks in advance
  • Christos TZOTZIOY Georgiou

    #2
    Re: sound processing - avarage amplitude?

    On Sat, 19 Mar 2005 17:18:42 +0200, rumours say that Niklas Paro <nparo@abo.fi >
    might have written:
    [color=blue]
    >Hello
    >
    >I would need way to check the amplitude (over time) for a sound file in
    >python. I'm sure this can be done, for example the audioop.rms function
    >seems to be able return amplitude values. However, it would be really
    >great to get the results in dB, which does not seem to be the case.
    >Anyone who has more information about this, or a way to convert the
    >results? I've searched google but info about audioop seem to be quite
    >scarce. Also, does audioop function perfectly also for wave files? Also,
    >cross-platform solutions are of course preferred, but I'm running linux
    >(with oss).[/color]

    audioop is platform independent. You just might need to import wave also.
    [color=blue]
    >I've also looked somewhat into tkSnack (http://www.speech.kth.se/snack/)
    >which has a dBPowerSpectrum function which might be doing at least
    >partially what i want it to, however, the returned values are approx.
    >-100 ... which I find odd. The "real", recorded sound was somewhere in
    >the 50-60dB range.[/color]

    Where is your 0dB mark? If it's at maximum amplitude (1), then any value
    (except zero) can be expressed as (negative) dB by the following function:

    def amp2dB(amplitud e):
    return 20*math.log(amp litude, 10)

    If you're converting from the 0...32767 range of 16bit PCM files, first divide
    the amplitude by 32767.0 and pass the result to amp2dB.
    [color=blue]
    >thanks in advance[/color]

    Hope this helps.
    --
    TZOTZIOY, I speak England very best.
    "Be strict when sending and tolerant when receiving." (from RFC1958)
    I really should keep that in mind when talking with people, actually...

    Comment

    Working...