KEY-REV program mods

Algorithm development and general DSP issues

Moderator: frank

Post Reply
jovesdies
Posts: 33
Joined: Wed Feb 25, 2009 3:55 am

KEY-REV program mods

Post by jovesdies »

Hi,
in the program "key-rev" I had replaced the line :
sof 0.25,-0.125;scale for reasonable pitch range
with:
sof 0.5,0.0
obtaining a nice octave up range and with :
sof -0.25,0.0
for a nice octave down range
I've noted that with this program there is a minimal delay between clean signal and octave signal copared with the octave up down program you wrote some times ago.
It is possible to change the program "key-rev" to obtain a pot for octave up range and a pot for octave down range (without the reverb function) ?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

He's using a shorter delay line in this program for the pitch shift so the overall delay is shorter but it will have other issues (higher frequency noise, poorer performance at low frequencies, etc.) so it is a trade-off between delay time and quality.

The other program should be able to be modified, just change the delay line length and wlds settings to the ones used in key-rev and I think that will do it.
Frank Thomson
Experimental Noize
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

Problems with this code. Is it possible to correct?

;Key change and reverb program for karaoke applications.

;Music (mono) in on left channel (perhaps from vocal remover)
;Microphone in on right channel

;outputs are stereo reverb and synthesized stereo music.

;pot0 controls key
;pot1 controls reverb amount
;pot2 controls reverb time

mem pdel 4096 ;Key change delay
mem dtemp 1 ;temporary DRAM data location

mem ap1 1156 ;declare reverb input all-passes
mem ap2 1278
mem ap3 543
mem ap4 871

mem dap1 2983 ;declare loop APs and delays
mem del1 3678
mem dap2 2345
mem del2 2903
mem dap3 1883
mem del3 4878
mem dap4 2345
mem del4 2203

mem sdel 1000 ;stereo synth delay

equ krt reg0
equ loop reg1
equ apout reg2
equ slout reg3
equ srout reg4

;constants:

equ kap 0.625

;PROGRAM:

skp RUN,3
wldr rmp0,0,2048 ;Load up ramp LFO for key shift
wlds sin0,50,50 ;load chorus generators for reverb
wlds sin1,34,60

rdax adcl,1 ;read music input
wra pdel,0 ;write to delay start

cho rda,rmp0,reg|compc,pdel ;(1-k)*sample[addr]
cho rda,rmp0,0,pdel+1 ;k*sample[addr+1] + ACC
wra dtemp,0 ;Save it off to memory and clear ACC
cho rda,rmp0,rptr2|compc,pdel ;(1-k)*sample[addr+ half ramp]
cho rda,rmp0,rptr2,pdel+1 ;k*sample[addr+ half ramp + 1] + ACC
cho sof, rmp0,na|compc,0 ;Result in ACC, multiply it by (1-XFADE) coefficient
cho rda,rmp0,na,dtemp ;Add in earlier value saved in memory, multiply saved value by XFADE coefficient
wra sdel,0 ;Write it to stereo delay and clear ACC


rdax pot0,1.0 ;get pot 0 (key control)
sof 0.25,-0.125 ;scale for reasonable pitch range
wrax rmp0_rate,0 ;write to rate of lfo2, clear accumulator

;now do reverb on microphone (right input):

;prepare pot2 for reverb time:

rdax pot2,1
sof 0.4,0.4 ;ranges 0.4 to 0.8
wrax krt,0

;do input all passes, bring in signal down 12dB to allow headroom:

rdax adcr,0.25
rda ap1#,kap
wrap ap1,-kap
rda ap2#,kap
wrap ap2,-kap
rda ap3#,kap
wrap ap3,-kap
rda ap4#,kap
wrap ap4,-kap
wrax apout,1 ;save all pass result in apout and pass on

;now do reverb loop:

rdax loop,1
rda dap1#,kap
wrap dap1,-kap
wra del1,0

rda del1#,1
mulx krt
rdax apout,1
rda dap2#,kap
wrap dap2,-kap
wra del2,0
rda del2#,1

mulx krt
rdax apout,1
rda dap3#,kap
wrap dap3,-kap
wra del3,0

rda del3#,1
mulx krt
rdax apout,1
rda dap4#,kap
wrap dap4,-kap
wra del4,0

rda del4#,1
mulx krt
wrax loop,0

;reverb outputs are at del1 and del3

;now synthesize stereo from music program with delays:

rda sdel,1
rda sdel#,1
wrax slout,0

rda sdel,1
rda sdel#,-1
wrax srout,0

;now combine input and reverb signals:

rda del1,1.99 ;read reverb output
sof 1.999,0 ;recover gain
mulx pot1 ;reverb amount
mulx pot1 ;square function
rdax slout,1 ;add in pseudo-stereo program
rdax adcr,1 ;add vocal (dry)
wrax dacr,0 ;write to left channel

rda del3,1.99 ;read reverb output
sof 1.999,0 ;recover gain
mulx pot1 ;reverb amount
mulx pot1 ;square function
rdax srout,1 ;add in pseudo-stereo program
rdax adcr,1 ;add vocal (dry)
wrax dacl,0 ;write to left channel

;Clean blend
mulx POT2
wrax effect, 0
rdax adcl, .5
rdax effect, .5
wrax dacl, 0.0

;now smooth reverb with chorus:

cho rda,sin0,reg|compc,del2+32
cho rda,sin0,0,del2+33
wra del2+64,0

cho rda,sin0,cos|compc,del4+32
cho rda,sin0,cos,del4+33
wra del4+64,0

cho rda,sin1,compc,del3+32
cho rda,sin1,0,del3+33
wra del3+64,0

cho rda,sin1,cos|compc,del1+32
cho rda,sin1,cos,del1+33
wra del1+64,0
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

What problem do you think there is? Please describe the problem and what you expected the code to do.
Frank Thomson
Experimental Noize
Alex MAK
Posts: 89
Joined: Fri Nov 05, 2010 1:00 pm

Post by Alex MAK »

I do not know from where this code appeared for me. Found him in a computer. Name of him "revers key_rev.spn" . It appears at an attempt to build:

<0000>[ Pass 2] [ 1014] Line: 150 "wrax effect, 0 " - ERROR:Undefined Name or Forward Reference - EFFECT
<0001>[ Pass 2] [ 1013] Line: 150 "wrax effect, 0 " - ERROR:Illegal Characters in - EFFECT
<0002>[ Pass 2] [ 1030] Line: 150 "wrax effect, 0 " - ERROR:Unrecognized or obsolete opcode - effect,
<0003>[ Pass 2] [ 1014] Line: 152 "rdax effect, .5 " - ERROR:Undefined Name or Forward Reference - EFFECT
<0004>[ Pass 2] [ 1013] Line: 152 "rdax effect, .5 " - ERROR:Illegal Characters in - EFFECT
<0005>[ Pass 2] [ 1030] Line: 152 "rdax effect, .5 " - ERROR:Unrecognized or obsolete opcode - effect,


revers key_rev.spn [FAILED BUILD] Build Stopped..
6 Log Messages



I want to have on your own in Fv-1 "Revers reverb" and "Revers echo" . Beforehand thankful!
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Well, I do not know where that version of the code is from. It appears to be based on the key_rev.spn program on the http://www.spinsemi.com/programs.php page. Try the one from that page.
Frank Thomson
Experimental Noize
Post Reply