Re: [LAD] Identify Peek in Drum Samples

From: Stefano D'Angelo <zanga.mail@email-addr-hidden>
Date: Mon Dec 20 2010 - 11:41:08 EET

2010/12/20 Oliver Jaun <olijaun@email-addr-hidden>:
> Hello
>
> I bought the natural drum samples (http://www.naturaldrum.com/). It contains
> WAVs and presets for Kontakt and Halion. Now I'd like to create some
> gigasampler files in order to use it with linuxsampler.
>
> The documentation of the natural drum sample library is quite good. The only
> thing missing is the "loudness" of each sample in order to map each sample
> to a velocity level from 0-127.

Loudness is a complex beast (i.e., lots of psychoacoustics involved).

> What would you  recommend in order to calculate the "peek" of each drum
> sample automatically? Is there a library which could do this? I would also
> be happy with a command line tool like this:
>
> $ peek bla.wav
> Peek value: 12345
>
> I could then write a C++-App using libgig.
> Any ideas? Libraries? Algorithms?

Something like this could do the trick for you (pseudocode):

attack = 0.99
level = 0
peek = 0

for each sample
    level = (1 - attack) * level + attack * abs(sample)
    peek = MAX(peek, level)

(I suppose that samples have 0 mean, i.e. DC component filtered out)

The attack thing should be close but less than 1, you can try different values.

Stefano
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Mon Dec 20 12:15:02 2010

This archive was generated by hypermail 2.1.8 : Mon Dec 20 2010 - 12:15:03 EET