Aliasing from clipping

Algorithm development and general DSP issues

Moderator: frank

Post Reply
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Aliasing from clipping

Post by Digital Larry »

I thought I'd be real clever and make an oscillator that puts out both sine and square waves. Here's my attempt. Be vewy vewy careful as the output goes right to the DAC.

Code: Select all

;------ Smoother
RDAX POT0,1.0000000000
RDFX REG0,0.0001500000
WRAX REG0,0.0000000000
;------ Oscillator II
SKP RUN ,3
SOF 0.0000000000,0.5000000000
WRAX REG1,0.0000000000
WRAX REG2,0.0000000000
RDAX REG2,1.0000000000
MULX REG0
RDAX REG1,1.0000000000
WRAX REG1,-1.0000000000
MULX REG0
RDAX REG2,1.0000000000
WRAX REG2,1.0000000000
MULX POT1
WRAX REG3,1.0000000000
SKP NEG,2
SOF 0.0000000000,0.5000000000
SKP GEZ,1
SOF 0.0000000000,-0.5000000000
MULX POT1
WRAX REG4,0.0000000000
;------ Output
RDAX REG4,1.0000000000
WRAX DACL,0.0000000000
RDAX REG3,1.0000000000
WRAX DACR,0.0000000000

Pot 0 is frequency
Pot 1 is the level control - turn this all the way down to start

Square is on the left, sine on the right.

As I make the frequency go up and down I hear a bunch of "hash" tracking the sound but only on the left. I presume that this is aliasing caused by the brute force clipping to create the square wave.

In some DSP systems this would be handled better by oversampling, which as far as I know can't be done on the FV-1. I can try low pass filtering it, but since aliasing generates components that can be below the input signal's fundamental, I don't know how effective that's going to be.

Any suggestions on band-limiting within the algorithm to minimize the aliasing in the first place?

Maybe it's not such a big deal as I would probably be using this mostly for LFOs, but just wanted to discuss it in general.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

My general conclusion is that using a 0.0-1.0 sine wave, possibly distorted by a few passes of self-multiplication is a better approach for generating square-ish LFO waveforms.

I read a few articles about this today and trying to clean up after creating a brute force square wave is a pretty difficult if not impossible task.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

I found the answer - miniBLEPS! I like the word. Probably impractical to make them on the FV-1.

http://www.experimentalscene.com/articles/minbleps.php
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Interesting, can't do a DFT and IDFT in the FV-1 but an interesting bit of code.
Frank Thomson
Experimental Noize
Post Reply