Forums

Manipulating the derivative of a sampled sound

Started by Ross Clement (Email address invalid - do not use) May 19, 2006
Hi. This is just a thought exercise, which could easily be downright
silly, badly thought out, entirely pointless, or generally a waste of
time for any number of other reasons. But that never stopped me before.

It's possible to store sampled versions of waveforms, single samples
which are looped, long samples of acyclic sounds, or various
representations inbetween.

The standard method of storing a sample is to store the actual sample
values. An alternative method of storing a sample as delta modulation,
where the first actual sample values are stored, and then store for
each successive sample the difference from the previous sample. In
effect, the sample stored approximates (or, is a sampled version of?)
the differential of the stored sample. Given that we have the first
sample value, we can recover the original signal, which is effectively
an integration using the stored sample to solve for the constant of
integration.

It would also be possible to perform delta modulation on the delta
modulation, which would give a sampled approximation (or version) of
the second derivative. Provided that the first values of the sample and
the second derivative were stored, it would be possible to recover the
original signal.

I wondered if it would be possible to change the nature of the sound by
manipulating the second (or higher) derivatives directly. For a sine
wave, simply multiplying the derivative by a constant achieves nothing
useful because diff( a * sin( b * x ) ) dx = a * b * cos( b * x ). If
we then multiply the derivative by a new constant d, and integrate,
assuming an initial phase of 0, we get: a * d * sin( b * x ). Or, we've
multiplied the original signal by the same constant. Not very useful.
Same applies for the more general case a * sin( b * x + c ); Since any
periodic function can be expressed as a Fourier series, if this applies
to a sine wave, then by induction it will apply to any periodic
waveform. No?

Finally I get to the question. Are there any easy manipulations of the
derivatives (first, second, any) which will produce "interesting" and
potentially musically useful changes to sounds? What would happen if I
filtered the sampled second derivative, say with standard highpass,
lowpass, notch, etc., filters?

Cheers,

Ross-c

Ross Clement (Email address invalid - do not use) wrote:
...
> I wondered if it would be possible to change the nature of the sound by > manipulating the second (or higher) derivatives directly. For a sine > wave, simply multiplying the derivative by a constant achieves nothing > useful because diff( a * sin( b * x ) ) dx = a * b * cos( b * x ). If > we then multiply the derivative by a new constant d, and integrate, > assuming an initial phase of 0, we get: a * d * sin( b * x ). Or, we've > multiplied the original signal by the same constant. Not very useful. > Same applies for the more general case a * sin( b * x + c ); Since any > periodic function can be expressed as a Fourier series, if this applies > to a sine wave, then by induction it will apply to any periodic > waveform. No?
Well... yes. Your argument is correct for sinusoidals. For broadband signals, things become more involved (although it is based on your idea). As far as I recall, FT{d^n f/dt^n } = w^n FT{f(t)} So basically, the more you differentiate, the more you enhance the high-frequency parts of the spectrum. However, it ought to be interesting to hear what effects one might get during integration (n<0), and "fractional derivatives", where n is a non-integer number.
> Finally I get to the question. Are there any easy manipulations of the > derivatives (first, second, any) which will produce "interesting" and > potentially musically useful changes to sounds?
These are two questions in one. First, do these techniques produce interesting results? I don't know. You have to try. Second: are such techniques easy to implement? The non-integer n integration/differentiation might not be, in time domain. Maybe you are able to design some sort of approximation to an FIR filter that does the job.
> What would happen if I > filtered the sampled second derivative, say with standard highpass, > lowpass, notch, etc., filters?
Don't have the faintest clue. You'll have to try. It's a fascinating problem. I remember I enjoyed playing with these sorts of techniques when I first learned image processing. Rune
Ross Clement (Email address invalid - do not use) wrote:
..
> The standard method of storing a sample is to store the actual sample > values. An alternative method of storing a sample as delta modulation, > where the first actual sample values are stored, and then store for > each successive sample the difference from the previous sample. In > effect, the sample stored approximates (or, is a sampled version of?) > the differential of the stored sample.
It's an approximation. The difference filter has impulse response h_1 = [1/2 -1/2] (scaled to have 0dB gain at Nyquist). The differentiator filter is a antisymmetric acausal IIR filter with impulse response h_D = [ ... -1/4, 1/3, -1/2, 1, 0, -1, 1/2, -1/3, 1/4, ... ] (ellipses denote the obvious extension to infinity). You can get a better approximation by windowing this impulse response.
> Given that we have the first > sample value, we can recover the original signal, which is effectively > an integration using the stored sample to solve for the constant of > integration.
Yes, this perfectly reconstructs to original sequence. Even though the first difference filter h_1 has a zero at DC (and therefore is not invertible) you can reconstruct the original sequence by storing the first sample and integrating from there on. Note that integration is an instable filter, there will be numerical issues to consider in the reconstruction process.
> It would also be possible to perform delta modulation on the delta > modulation, which would give a sampled approximation (or version) of > the second derivative. Provided that the first values of the sample and > the second derivative were stored, it would be possible to recover the > original signal.
The difference of the difference is called (wait for it) the second difference. The n-th difference filter h_n is defined as the n-fold convolution of the first difference, ie. h_n = h_1^(*n). Differencing is widely used in time series analysis to remove polynomial trends (an n-th difference filter removes an n-th order polynomial from the data - hence the need to store the n initial values for the reconstruction).
> Finally I get to the question. Are there any easy manipulations of the > derivatives (first, second, any) which will produce "interesting" and > potentially musically useful changes to sounds? What would happen if I > filtered the sampled second derivative, say with standard highpass, > lowpass, notch, etc., filters?
For linear processing, there won't be much difference (see caveat below), because linear processes commute. In other words, applying a filter g to the differenced signal and then integrating is the same as applying g to the original sequence: h_n * g * h_n^-1 = h_n * h_n^-1 * g = g (provided you store the first sample - otherwise you loose the DC content), where h_n and h_n^-1 denote differencing n times and integrating n times (plus adding the integration constant). The caveat is: since audio signals tend to contain less high-frequency than low-frequency content, the differenced signal will tend to have lower amplitude - this can be exploited for numerical benefit, as is described by Keith here: http://groups.google.com/group/comp.dsp/msg/7a639cf7a6e9fc9b There exists other non-linear applications for the differencing filter in audio: namely as a sidechain filter in digital audio dynamic range compression units. The differencing removes low frequency content and thus avoids low-frequency modulation of the compressor gain. Another application could be to split the signal with the difference filter into high- and low-pass bands, then do some non-linear processing to the low-pass signal and finally add the processed low-pass signal to the original high-pass signal. This attenuates aliasing due to non-linear high-frequency distortion.
> > Cheers, > > Ross-c
Regards, Andor
"Ross Clement (Email address invalid - do not use)" <clemenr@wmin.ac.uk>
wrote in message
news:1148030636.828283.245590@i40g2000cwc.googlegroups.com...
> Hi. This is just a thought exercise, which could easily be downright > silly, badly thought out, entirely pointless, or generally a waste of > time for any number of other reasons. But that never stopped me before. > > It's possible to store sampled versions of waveforms, single samples > which are looped, long samples of acyclic sounds, or various > representations inbetween. > > The standard method of storing a sample is to store the actual sample > values. An alternative method of storing a sample as delta modulation, > where the first actual sample values are stored, and then store for > each successive sample the difference from the previous sample. In > effect, the sample stored approximates (or, is a sampled version of?) > the differential of the stored sample. Given that we have the first > sample value, we can recover the original signal, which is effectively > an integration using the stored sample to solve for the constant of > integration. > > It would also be possible to perform delta modulation on the delta > modulation, which would give a sampled approximation (or version) of > the second derivative. Provided that the first values of the sample and > the second derivative were stored, it would be possible to recover the > original signal. > > I wondered if it would be possible to change the nature of the sound by > manipulating the second (or higher) derivatives directly. For a sine > wave, simply multiplying the derivative by a constant achieves nothing > useful because diff( a * sin( b * x ) ) dx = a * b * cos( b * x ). If > we then multiply the derivative by a new constant d, and integrate, > assuming an initial phase of 0, we get: a * d * sin( b * x ). Or, we've > multiplied the original signal by the same constant. Not very useful. > Same applies for the more general case a * sin( b * x + c ); Since any > periodic function can be expressed as a Fourier series, if this applies > to a sine wave, then by induction it will apply to any periodic > waveform. No? > > Finally I get to the question. Are there any easy manipulations of the > derivatives (first, second, any) which will produce "interesting" and > potentially musically useful changes to sounds? What would happen if I > filtered the sampled second derivative, say with standard highpass, > lowpass, notch, etc., filters? > > Cheers, > > Ross-c >
I would say anything with differentiation is too noisy. In control systems we often talk of PID but the D term is not a real differentiator - only band limited. M.P *** Posted via a free Usenet account from http://www.teranews.com ***