Idea for generating a lower octave.

Algorithm development and general DSP issues

Moderator: frank

Post Reply
sad1024
Posts: 34
Joined: Mon May 24, 2010 3:34 pm

Idea for generating a lower octave.

Post by sad1024 »

Take input. Determine envelope voltage. Add half the envelope voltage to the input so its always positive. Take the square root of it. Invert at each zero crossing to get the lower octave. Filter out any transients. Now just turning it into code.
sad1024
Posts: 34
Joined: Mon May 24, 2010 3:34 pm

Code.

Post by sad1024 »

equ input reg0
equ ef reg1 ;Set up registry

ldax adcl ;read input into acc
wrax input, 1 ;write input for later use
absa ;take absolute value
rdfx ef, .001
wrlx ef, 1 ; low pass filter
ldax ef
mulx 0.5 ; take half envelope
rdax input, 1 ; add input
log 0.5, 0
exp 1,0 ; take the square root

From here on I don't know how to write the code.
sad1024
Posts: 34
Joined: Mon May 24, 2010 3:34 pm

Post by sad1024 »

Does anybody know what should come next?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Well, I think there is an error in the logic, looking at the theory:
Take input. Determine envelope voltage. Add half the envelope voltage to the input so its always positive.
I believe that is incorrect. Imagine a constant amplitude sin wave that goes +1 to -1, taking the absolute value and finding the envelope give an envelope voltage of 1, adding 1/2 of that to the input results in a signal that goes from -0.5 to +1.5, not always positive. This is what your code appears to do (I haven't run it)

See this thread on doing an octave down using zero crossing detection
http://www.spinsemi.com/forum/viewtopic.php?t=185
Frank Thomson
Experimental Noize
sad1024
Posts: 34
Joined: Mon May 24, 2010 3:34 pm

Post by sad1024 »

Your right, but it looks like the average amplitude of the envelope will be less than the peak amplitude, so it will need to be multiplied by greater than unity, (1.4142??). It will take me a while to get comfortable enough with the code to detect the zero intercepts. Thanks.
Post Reply