Re: [ecasound] Metronome problems

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [ecasound] Metronome problems
From: Kai Vehmanen (
Date: Tue Nov 04 2003 - 01:42:54 EET

On Sat, 1 Nov 2003 wrote:

> "Kai Vehmanen -" writes:
>> True, the sin-wave generation is done quite naively (uses sin()), and
>> could be implemented much more efficiently.
> could is a nice word :-) I tried to find a more efficient
> implementation to no avail. Du you know of a more efficient sound
> generation plugin (I have been thinking about using a square wave

Actually I'll have to take my previous statement. Ecasound's metronome
(-pn:metronome) does _not_ use sin(). Rather the sine wave is generated by
'sine_fcac' LADSPA plugin which comes with the LADSPA SDK. 'sine_fcac'
generates a precomputed sin-table, so it's pretty fast.

I guess the efficiency problem comes from the use of the preset system.
The metronome is defined as:

metronome = -el:sine_fcac,880,1 -eemb:%1,10 -efl:2000 \
        -ppn:bpm -ppd:100 -pd:Sineosc_metronome

... i.e. three separate components. By putting all the code into single
plugin (either LADSPA or native ecasound effect), you'd probably lower the
CPU consumption quite a lot (thanks to more cache-friendly memory usage).

There are plenty of example code out there if someone is interested:

- LADSPA SDK: src/plugins/sine.cpp
   - table-basd sine-wave generation
- ecasound: libecasound/audiofx_envelope_modulation.cpp
   - signal gate that opens X times per second
- JACK: examples/metro.c
   - a complete metronome implemented as a JACK client app
   - btw; you can use this as is with ecasound
- ardour: ardour/libs/ardour/
   - wavetable-based metronome-click generation
- ardour: ardour/libs/ardour/
   - how the session click is generated

... you just have to put the piece together. :)

If you want to take a quick'n'dirty approach, try adding the following to
your ~/.ecasound/effect_presets:

metronome_light = -el:sine_fcac,880,1 -eemb:%1,10 \
        -ppn:bpm -ppd:100 -pd:Sineosc_metronome_light

... and use it with -pn:metronome_light,120.

 Audio software for Linux!

New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Nov 04 2003 - 01:45:59 EET