This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: fast additive copy method
- From: Joël Krähemann <weedlight at gmail dot com>
- To: Carlos O'Donell <carlos at systemhalted dot org>
- Cc: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Sun, 10 Aug 2014 22:43:56 +0200
- Subject: Re: fast additive copy method
- Authentication-results: sourceware.org; auth=none
- References: <1407648757 dot 15843 dot 2 dot camel at localhost dot localdomain> <CAE2sS1hTvkvkhiUfJS521466W-n2p9MOL+2U-OtJNN=WkFNYxA at mail dot gmail dot com>
Am Sonntag, den 10.08.2014, 17:20 +0200 schrieb Carlos O'Donell:
> On Sun, Aug 10, 2014 at 7:32 AM, JoÃl KrÃhemann <weedlight@gmail.com> wrote:
> > Hi, I'm doing a soft synth and I'm looking for fast additive copy
> > methods. Does glibc provide such functions?
>
> Please define fast additive copy methods?
>
> What types do you need to add together?
>
> If using floating point arithmetic: does the answer need to be
> correctly rounded, can the answer be imprecise etc. etc. ?
>
> Simple computation like add and copy are just done by the language.
>
> e.g.
>
> a = a + b;
>
> There is some ability for the compiler to turn this into a
> fused-multipley-and-add instruction which is quite quick.
>
> e.g.
>
> a = a + b => a = 1 * a +b (implemented on x86* with FMA by the compiler).
>
> However, the addition is also quite quick, and may take less cycles so
> the compiler might choose just an add.
>
> Cheers,
> Carlos.
Hi, I'm doing a soft synth therefore in RAM is copied audio buffers in a
repining way. The function ags_audio_signal_copy_buffer_to_buffer()
should be optimized.
I do an additive copy for each frame:
frames_per_second = 44100
frames_per_tic = 940
grand_total_frame_count_per_tic =
(78 * frames_per_tic + frames_per_tic) +
(16 * frames_per_tic + frames_per_tic)
This is only for one drum and one matrix sequencer. This is about:
4233600 additions and clipping per second using signed short.
https://sourceforge.net/p/ags/code/HEAD/tree/src/ags/audio/ags_audio_signal.h
https://sourceforge.net/p/ags/code/HEAD/tree/src/ags/audio/ags_audio_signal.c
I found this on the net but didn't read it yet since it isn't clear if
there's an applicable patent:
http://www.dafx.ca/proceedings/papers/p_181.pdf FAST ADDITIVE SOUND
SYNTHESIS USING POLYNOMIALS