Creating single cycle waveforms from samples

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,

We'd like to create single cycle waveforms from sampled synths. Here's an extract from a posting on the sampling forum which explains what we're trying to achieve. I figured that perhaps the development forum is a better place to ask the question, so am posting here. I would be very grateful for any help.
I would like to create single cycle waveforms from samples of various synths. The waveforms have to be exactly 1024 samples long and loop perfectly. What is the best process to follow to create nicely looped samples of the highest quality?

If I record at 44kHz, then if I record a note at 43Hz, this should be around 1024 samples long - however due to slight differences of tuning, it may be a few samples out. Perhaps its better to record a lower frequency, or record at a higher sample rate and resample it to the correct rate? Anyway, if anyone has experience doing this, I would be very grateful for advice.

so..how do you create your single cycle waveforms?
Thanks
Ben

Post

The way I did it in roid was to use soundforge and simply tune the sample so that the cycle was a little bit longer than I wanted it. Then, depending on the situation I either resample it to the wanted length, or just fade the end out so that I got a zero at the wanted length.

Post

Oh, And I should add (like I often do) that if you then export as 32bit float Raw format and use JUCE binary builder you get the sample data as a C source file with the samples as static arrays. Very convenient.

Post

Yes, I saw that other thread.

Your 43Hz is not precise enough, nor is the sample rate of 44kHz. 43.0Hz @ 44.0kHz = 1023.26 samples long, 43.0Hz @ 44.1kHz = 1025.58 samples long.

Sampled at 44.100 Hz a wave of 1024 samples long is 43.07 Hz which is an F minus 23,44 cts
Sampled at 48.000 Hz it's 46.88 Hz or an F# plus 23.26 cts.
Sampled at 96.000 Hz it's 93.75 Hz, also an F# plus 23.26 cts.

Most cards perform slightly better at 48/96kHz than at 44.1kHz. And maybe the synth sounds a bit more natural around 93Hz than at 43Hz, since you're most likely to do upsampling later.

I see two ways: either detune the original synth (preferred but can be cumbersome) or transpose the sample with an audio editor like Adobe Audition. I suppose you can work out the exact ratios yourself.
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

Can't you use your resynthesis stuff? :)

If one would record a "lengthy" sample of a waveform and analyse its fourier series creating a 1024 long single cycle version of it would be a breeze. But the fourier series analysis has to be quite good I guess.

OTOH you could just do a near-perfect resample of the waveform since it's offline stuff. Sinc resample away!

edit: just make sure you start with a waveform containing at _least_ as much harmonic content as you need, so a lower note than samplerate/1024 probably preferred.

Post

Hi,

Thanks very much for the replies :)
The way I did it in roid was to use soundforge and simply tune the sample so that the cycle was a little bit longer than I wanted it. Then, depending on the situation I either resample it to the wanted length, or just fade the end out so that I got a zero at the wanted length.
Yeah - I guess that is a reasonable approach. I suppose the resampling could also be done in SoundForge. It would just be a question of:
1) Sample the synth at 43Hz, ideally at a high sample rate such as 92kHz.
1) Crop the sample to a single loop, making sure that the waveform begins and ends as close as possible to a zero crossing.
2) Go to File->Properties and look up the number of samples.
3) Go to Process->Resample, select highest accuracy and turn on anti alias filter, and set target sample rate as NewSampleRate = (1024/number of samples)*CurrentSampleRate
4) Go to Process->Resample and select 'Set the sample rate only' and set the sample rate back to '44100Hz'
5) Edit the waveform using the pencil tool whilst fully zoomed in to ensure that it starts and ends at precisely zero

Does anyone see any problems with this approach? Or have any recommendations for improvements? Does anyone have a tool they would be willing to share which carries out a similar process automatically?
Your 43Hz is not precise enough, nor is the sample rate of 44kHz. 43.0Hz @ 44.0kHz = 1023.26 samples long, 43.0Hz @ 44.1kHz = 1025.58 samples long.
Yeah - I did realise that this wasn't precisely the correct value, but I didn't want to clutter my post with loads of digits.
I see two ways: either detune the original synth (preferred but can be cumbersome) or transpose the sample with an audio editor like Adobe Audition. I suppose you can work out the exact ratios yourself.
The nicest solution is to record the synth at precisely the right frequency, but I don't think this is feasable, especially when recording modular synths. The transposition solution amounts to the same as the resampling process, I believe.
And maybe the synth sounds a bit more natural around 93Hz than at 43Hz, since you're most likely to do upsampling later.
The disadvantage of recording at 93Hz, is that if you then wish to play a note one octave down, it will be missing the top half of the spectrum. One solution would be to offer multisampling at (say) each octave. Most of the time I would have thought there wouldn't be much point in this, since it would be the same as the lower sample upsampled and appropriately filtered. Does anyone have any comments on this issue?
If one would record a "lengthy" sample of a waveform and analyse its fourier series creating a 1024 long single cycle version of it would be a breeze. But the fourier series analysis has to be quite good I guess.
I guess you could do it this way - does anyone actually use this method in practice?

Thanks
Ben

Post

Ben [Camel Audio] wrote:The nicest solution is to record the synth at precisely the right frequency, but I don't think this is feasable, especially when recording modular synths.
Ahem, modulars are the easiest to detune. They all have a pitch control of some sort. These were the days before digital tuners existed, and you had to tune them once every hour or so anyway to keep the bastards in tune.
Ben [Camel Audio] wrote:The disadvantage of recording at 93Hz, is that if you then wish to play a note one octave down, it will be missing the top half of the spectrum.
"Half" of the spectrum? Only one tenth... Throw in a low-pass filter and nobody misses the highest octaves.

By sampling a 93Hz tone at 96kHz you STILL have your waveform of 1024 samples long, not? So when used at 44.1kHz you have all harmonics preserved up to 22kHz with notes all the way down to 43Hz. Provided that the original synth indeed produces harmonics up to 48kHz...

Either way, you'll get there. So many ways to skin the cat...
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

Hi,
Ahem, modulars are the easiest to detune. They all have a pitch control of some sort. These were the days before digital tuners existed, and you had to tune them once every hour or so anyway to keep the bastards in tune.
I would have thought it would be hard to tune it so that it is precisely 43.0664 Hz - but I have no experience of modulars, so perhaps you're right.
"Half" of the spectrum? Only one tenth... Throw in a low-pass filter and nobody misses the highest octaves.
If you go one octave down, you halve the frequency, so if your original waveform is recorded at 93Hz, and you play a note at 46.5Hz, (and assuming we are working at 44kHz), it will be missing the harmonics from 11kHz - 22kHz. Maybe I'm missing something - I often do :)

I would be very interested to hear from anyone who has experience of creating waveforms for synths - with details of how they did it.

Thanks
Ben

Post

Tuning a synth to 43.0664 Hz is as difficult (or as easy) as tuning to exactly 55.000 Hz ;-)
Ben [Camel Audio] wrote:
"Half" of the spectrum? Only one tenth...
If you go one octave down, you halve the frequency, so if your original waveform is recorded at 93Hz, and you play a note at 46.5Hz, (and assuming we are working at 44kHz), it will be missing the harmonics from 11kHz - 22kHz. Maybe I'm missing something - I often do :)
No, you got it allright. But you used a linear scale for measuring the spectrum, so that accounts for "half" of it. On a logarithmic scale the upmost octave is not that large. Sorted that one out, never mind... ;-)
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

Ben [Camel Audio] wrote: The disadvantage of recording at 93Hz, is that if you then wish to play a note one octave down, it will be missing the top half of the spectrum. One solution would be to offer multisampling at (say) each octave. Most of the time I would have thought there wouldn't be much point in this, since it would be the same as the lower sample upsampled and appropriately filtered. Does anyone have any comments on this issue?
If you sample something that is detuned at a really low frequency, then it will sound much much less detuned as its pitched up. Try it - set up some synth patch with over-the-top detune, sample it at C0, then play the sample back at C5 or whatever. It will sound MUCH less detuned.

Post

Don't mean to step out of my depth here; I have no recommendation for capturing a single-cycle sample of a synth for use as a wavetable. I do, however, work for a manufacturer of synth modules and have discussed the characteristics of analog sound an absurd number of times. All I have to say is this: if you are trying to capture the sound of a particular synth, or analog sound in general, a single-cycle wavetable will not aid you in achieving this. Feel free to disregard that, of course, since I have no idea what you are doing. Having said that, sampling the oscillator at it's lowest frequency will give you more data with which to preserve the characteristics of the oscillator (or at least the shape of the waveform it produces). Regardless of the waveform the synth tells you you're getting, a scope will tell you how flawed that waveform actually is. These flaws account for part of the reason why you can distinguish the difference between, for example, the Buchla 258 and the Serge NTO.
aciddose wrote:you empty headed animal food trough wiper, your mother was a hamster and your father smelt of elderberries!

Post

If you sample something that is detuned at a really low frequency, then it will sound much much less detuned as its pitched up. Try it - set up some synth patch with over-the-top detune, sample it at C0, then play the sample back at C5 or whatever. It will sound MUCH less detuned.
I am aware of this phenomena - due to the difference between pitch and frequency. However, 'detuned' implies two fundamental frequencies, and since I just wish to get a single cycle of a sound with a single fundamental, that isn't an issue.

Thanks
Ben

Post

I think he just means detuned as in not perfectly pitched, rather than beating waveforms...

DSP
Image

Post Reply

Return to “DSP and Plugin Development”