[LAD] Converting single-cycle wave to harmonic spectrum
willgodfrey at musically.me.uk
Mon May 10 16:28:45 CEST 2021
On Mon, 10 May 2021 15:51:38 +0200
Fons Adriaensen <fons at linuxaudio.org> wrote:
>On Mon, May 10, 2021 at 03:17:12PM +0200, Jeanette C. wrote:
>> There are numerous audiofiles around containing one single cycle wave to
>> be used with multiple wavetable synthesizers, both in hard and software.
>> I can only assume that these are matched to the number of samples they
>> contain. Some of them CERTAINLY proclaimed this fact,
>OK. In that case the actual frequency will be R / N where R is the sample
>rate and N the length in samples. This is very probably not exactly an
>musical pitch in the equally tempered scale, but that doesn't matter
>since the wavetable synth will have to resample it anyway.
>So in this case, all you need is an FFT with a size equal to the lenght
>of your single cycle sample. There is no faster method.
>I just checked, FFTW3 can do any size.
>Normally you'd just use the real-to-complex fft. For prime lengths, this
>may become slower than normal (N^2 complexity instead of N log N). If this
>matters (it probably won't), you could use the complex-to-complex fft with
>the imaginary part set to zero, this will be faster (always N log N).
>In all cases, the N / 2 + 1 first elements of the output will correspond
>to the harmonics, so you just the square root of the power of each.
Not entirely clear on what you are doing, but you may find PadSynth the be a
better option. It already creates perfectly looping samples (not sure if you can
fiddle that for a single cycle) and will then export these over as a number of
different pitches/key numbers.
Will J Godfrey
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
More information about the Linux-audio-dev