help-octave
[Top][All Lists]

## Re: Broadening a sine wave

 From: Ian McCallion Subject: Re: Broadening a sine wave Date: Sat, 1 Aug 2020 11:36:10 +0100

```On Fri, 31 Jul 2020 at 02:19, Bob Atkins <ka1gt@hotmail.com> wrote:
>
> I have an application for which I need to generate a "broadened sine wave".
> An example of such a waveform would be the reflection of a wave from a
> rotating cylinder.  Reflection of a sine wave, frequency F from the center of
> that cylinder would be reflected back at frequency F.  Reflection from the
> side of the cylinder approaching me would be reflected back at a frequency
> F+D, where D is the doppler shifted signal from some part of the approaching
> surface. The value of D would depend on exactly where the flection took
> place. Similarly, on the other side of the cylinder which was moving away
> from me, the reflection would be at F-D. The amplitude of the received
> reflected signal from the sides of the cylinder would be also be lower than
> that from the center. If you look at the FFT of the received reflection, it's
> not a single frequency, but broadened peak.  That's what I want to simulate.
> and create a .wav file from. The exact profile of the broadening isn't
> important at this point, just a technique to do it! Gaussian would be fine to
>
> I can generate a sine wave and save to a .wav file. That's easy. But how do I
> broaden it? I suppose I could sum a bunch of sine waves of very similar
> frequencies and different amplitudes but that seems like a slow, clumsy and
> laborious way to do it.  But maybe not.  There may be something very clever
> that could be done by taking the FFT of the original sine wave, doing some
> manipulation with it and then doing in IFFT, but the math of that is beyond
> me.  There's might be some other trick or set of functions in Octave that is
> obvious to those skilled in signal processing, but which escapes me.
>
> Any clue in which direction to look would be much appreciated.

You could frequency modulate your sine wave with another sine wave.
Pioneered by Yamaha this is one of the techniques electronic keyboards
(used to?) use for broadening the sounds they generated. Re the
parameters you'd need, the modulating frequency would need to be high
enough that it did not just sound like wow and flutter (mechanical
recording terminology!). The modulation depth would be quite small.

I also think fft, modify, ifft is a good approach if you need control
of the spectrum. Take the fft of yoursample sine wave (which will have
a very sharp peak with small values elsewhere (representing the
finiteness of the sample). and simply insert values into other
elements of the fft.

Here are two functions to convert between fft index and frequency.
These should enable you to modify the fft with more confidence as to
the effect you'll get. Note the duration of the sample affects the
relationship between frequency and index into the fft.

Cheers... Ian
```

fi2hz.m
Description: Binary data

hz2fi.m
Description: Binary data