I've been meaning to post this for a while, thinking it's just in my head or something. Finally got my act together to make a simple exploring patch.

Here's a ChucK program that loops some frequencies on SawOsc. As it gets higher, I think I hear some artifacts that shouldn't be there - subfrequencies that sound like they used to do on my old Amiga when I played samples with higher frequencies than the soundchip could take. It would be interesting to hear if any of you experience the same result. I'm attaching a sound sample (outputs looped back into an output on my Ultralite sound interface - slightly different version of the program but the sound is the same). I've also tried with the internal sound card on my MacBook Pro, same result.

I've tried adding --srate44100 and --bufsize1024 on the ChucK command line, no difference.

Yeah. It's actually supposed to do that.
It's called frequency warping.
Here's a little background:
A sawtooth wave like any periodic waveform is in a mathematical sense composed of harmonics. Sine waves playing at a base frequency and it's integer multiples.
The thing with sawtooth and square wave especially is that they are very sharp and it means that their harmonics stay strong well beyond the limits of human hearing.
The problem arises because you cannot produce those high frequencies with the samplerates we use. The harmonics climb to nyquist (frequency of half the sampling rate) and then start descending back towards zero. This sounds awful. You can verify the effect yourself by playing a sinewave sweep that goes up in frequency endlessly. After getting really high it will start comming back down, reaches zero and starts going up again.

What we need to do is cut the harmonics off at nyquist. Luckily ChucK comes with BlitSaw (bandlimited sawtooth wave) that does this.

Aha - thanks a lot for that very fast and informative reply! I even see that I delved into stuff mentioned in your signature! A new topic that I didn't know about.

I'm actually not completely in the clear because I was running into this when I was messing about with CurveTable. I've always been intrigued by "drawing your own waveform" kind of synthesis, and was hoping that I could make some interesting timbres with this. Maybe you're not really supposed to work with waveforms this way... drawing curves with sharp edges will always get you into these frequency warping issues maybe?

If you really need the sound but at the same time want to lower the warping,
you may want to work with a higher sample rate..
so if your soundcard / audio interface support that, you can try and hear out.

Blit is short for band limited oscillator. It produces a set of harmonics with equal gains.

The two patches bellow sound the same but if you look at the waveforms they're completely different!
Human hearing isn't phase aware so it doesn't matter how the harmonics are related to each other in phase as long as their relative gains are the same.
Blit is useful when you want to do timbre manipulation with filters. Blit is what is called spectrally flat so it doesn't impinge any additional characteristic to the sound.

The difference is that Blit produces harmonics with equal gains and BlitSaw weights them according to the alternating harmonic series. That is the kth partial is weighted ( -(-1)^k )/k.
So the first sinewave has a weight 1.0.
the second -0.5
the third 0.33333...
the fourth -0.25
and so on....

BlitSquare skips over every even harmonic. It's odd in spectrum._________________To boldly go where no man has bothered to go before.

I've also used wavetable synthesis where you interpolate between adjacent buffers...

Funny you mention that. Because it's exactly what I did with my FourierPool. It can be found in the Instrument library I just posted on the other thread.

It's based on IFFT (Inverse Fast Fourier Transform) that is an UAna (Unit Analyser) in chuck.
The basic idea is to place sinewave partials in to the discrete frequency bins using linear interpolation for fractional bin values.
It almost has it all. It's perfectly band limited by definition (assuming you use the best settings to eliminate artifacts), allows precise control over the timbre (assuming you are a float function wizard), but it's not especially fast._________________To boldly go where no man has bothered to go before.

That's a great thing to know, Frostburn, I always thought the phase mattered. Looking forward to hearing some additive synthesis tunes.

For a single sound source it's harmonic phase relations aren't audible. (well maybe a little but it's not much)
They still make a difference when you mix different sources together, especially if distortion is involved._________________To boldly go where no man has bothered to go before.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum

Please support our site. If you click through and buy from our affiliate partners, we earn a small commission.