Reputation: 51990
I need to extract the sound wave envelope from a set of audio files in a batch job on a headless Linux host.
I think this can be achieved using the Nyquist programming language, a variant of Lisp notably embedded in audacity, and dedicated to sound processing. However, if I have some familiarities with Lisp, I don't have any previous experience with Nyquist.
Is there some primitive in Nyquist to achieve that directly? Or how can I write a short Nyquist program to extract the envelope of a sound?
I tried using the snd-avg function. But it does not seem to produce a smooth envelope (upper half in the screenshot):
(snd-avg
(aref *track* 0) ; first sound
(truncate (/ *sound-srate* 50)) ; 50 Hz to samples
1 op-peak) ; follow peak values
Upvotes: 1
Views: 446
Reputation: 51990
I obtained decently good results by applying a low-pass filter after snd-avg
in order to remove the staircase ripples:
(lp
(snd-avg
(aref *track* 0)
(truncate (/ *sound-srate* 1000)) ; 1kHz
1 op-peak)
50) ; 50 Hz low-pass
Upvotes: 0