octal-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Those API revisions, plus some thoughts


From: Neil Nelson
Subject: Re: Those API revisions, plus some thoughts
Date: Sun Mar 25 16:18:01 2001
User-agent: Mozilla/5.0 (X11; U; Linux 2.2.14-5.0 i686; en-US; 0.8) Gecko/20010216

ben wrote:

The following is the heart of a thread-spectrum synthesizer.

#define RUN_ANGLE 1.42475857305659548476e-4 // M_2PI / 44100

  for(i=start_sample;i<=end_sample;i++) {
     for(fc_dx=start_fc;fc_dx<=end_fc;fc_dx++) {
        smpl_fc_sum += get_samp_amp(fc, fc_dx, i) * sin(lnk_angle[fc_dx]);
        lnk_angle[fc_dx] += RUN_ANGLE * get_samp_freq(fc, fc_dx, i);
     }
     // output smpl_fc_sum as the current value of the sound wave
  }


I think additive synthesis is generally more expensive than other
methods, but this could probably be optimized by using inline functions,
a fast sine approximation, etc.  I think the call to sin() is the
slowest part.

Last year I tested the sin() function extensively against a number of table
methods and sin() appeared to be faster overall for my computer and certainly the most accurate. The sin() function is often said to be slow, but this seems
to have been a concern of older computers and compilers.

I would certainly be interested in a method better than additive synthesis
that would provide the detail control over frequency and amplitude that
additive synthesis provides.

Now we need a graphic method of showing and manipulating the amplitude
and frequency curves, and, likely, generating different families of
harmonics.


Creating an interface to easily manipulate those curves would be hard -
there are three dimensions to keep track of (freq vs. amp vs. time), so
it would have to be something like a 3-D envelope editor or a set of
freq vs. amp envelopes, interpolated over time, or something like that.

For any given point in time for a single frequency thread there is only one
frequency and amplitude.  Amplitude and frequency do not vary against
each other and only on the time dimension for a particular frequency thread.
This results in two two-dimensional curves: amplitude over time and
frequency over time.  I have provided routines in the snippets area at
SourceForge for computing polynomial equations for an arbitrary number
of points such that a window having the graph of, say, the amplitude curve
could be modified by using a mouse to move the curve defining points
around and/or adding or removing curve points. A point modification action
would then redisplay the new curve for those points.  Curves beyond a few
defining points are better approximated by overlapping and smoothed low
order equations, an aspect that can be automated.

Regards,

Neil Nelson






reply via email to

[Prev in Thread] Current Thread [Next in Thread]