Audio input as delay modulation source?

Algorithm development and general DSP issues

Moderator: frank

Post Reply
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Audio input as delay modulation source?

Post by knutolai »

Hi

So I'm trying to use the incoming audio signal to modulate a vibrato effect (instead of using an LFO).

My idea was to set sin0 to 0Hz, write the audio to sin0_range and use the cosine (max at zero?) as the modulation source for the vibrato (delay).

My code does not create any vibrato, but here it is anyways:

Code: Select all

; Self modulation FM
;
; Pot0 = SMOD Level 

; Memory declarations:
mem    chodel    1024 

; Registers:
equ	temp	reg0	; Temporary value reg

skp    run, 	START 
;	lfo	freq	amp
wlds	SIN0,	0,	0	; Write & Load sin0 at 0Hz
START: 

; Input to chorus:
ldax 	adcl		; Read left input
wra	chodel, 1		; Write to head of chorus delay line, keep value in acc 

; Prepare modulation source:
sof	-2, 0		; compress and (potentially) clip signal
sof	0.03, 0.5	; Range 0.5 +/- 0.03
mulx	pot0		; Add depth ctrl
mulx	pot0		; Square depth ctrl
wrax	sin0_range, 0	; Load into sin0 range register, clear ACC
wrax	sin0_rate, 0	; Load 0 into sin0 rate reg, clear ACC

; Do chorus lines: 
cho	rda, SIN0, COS|REG|COMPC, chodel^ 	
cho	rda, SIN0, COS, chodel^+1 	
		
wrax	dacl, 0 		; Write result to left output 
In not at all sure where to go from here as I can't seem to find any resources on modulating the delay directly.

Any suggestions?
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Post by knutolai »

From another thread (http://www.spinsemi.com/forum/viewtopic ... 7d36b046d4)

Code: Select all

RDA 14444,1.0 
WRAX 57,0.0 
RDA 28594,1.0 
WRAX 58,0.0 
Could I perform modulation through direct delay ram addreess readouts like this?

http://www.spinsemi.com/Products/datash ... Manual.pdf

Page 21 and 45 seems to be relevant. Still a little hard to grasp
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

I tried to compile the code you posted above but it had errors and would not compile, this could be as copy/paste added lots of spaces in the code.

I edited the code on my pc and recompiled it, it sort of works but I don't think it does exactly what you are expecting, it does now have vibrato.

you are also clearing the acc after writing the sin0 range so I have changed that to keep the value in the acc for the next line to write to the sin0 rate.

I have pasted the code below, give it a try as a starting point.
use pot 0 at minimum first as it get wild very quickly.

Basically all I have changed is not to clear the acc after the sin0 range line.

Code: Select all

; Self modulation FM 
 
; Pot0 = SMOD Level 

; Memory declarations
 
  mem	chodel	1024 

; Registers
 
 equ	temp	reg0   		;Temporary value reg 

 skp	run,	START 		;lfo   freq   amp 
 wlds	SIN0,	0,	0   	; Write & Load sin0 at 0Hz 
 
START: 

; Input to chorus
 
  ldax	adcl      			; Read left input 
  wra	chodel,1      		; Write to head of chorus delay line, keep value in acc 

; Prepare modulation source

 sof	-2, 0      		; compress and (potentially) clip signal 
 sof	0.03,0.5   		; Range 0.5 +/- 0.03 
 mulx	pot0      			; Add depth ctrl 
 mulx	pot0      			; Square depth ctrl 
 wrax	sin0_range, 1   		; Load into sin0 range register, keep in ACC 
 wrax	sin0_rate, 0   		; Load 0 into sin0 rate reg, clear ACC 

; Do chorus lines
 
 cho	rda,SIN0,COS|REG|COMPC,chodel^     
 cho	rda,SIN0,COS,chodel^+1     
       
 wrax	dacl, 0       		; Write result to left output
 
www.stanleyfx.co.uk
"It's fairly straight forward, if you want to start it press start, you can work out the rest of the controls yourself."
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Post by knutolai »

Thank you for looking it over! Yes I think the errors are due to the copy/paste. Compiled without trouble on my pc (clean, unaltered output)
you are also clearing the acc after writing the sin0 range so I have changed that to keep the value in the acc for the next line to write to the sin0 rate.
The rate is intentionally set to 0. My guess was that COS would write out the max. positive amplitude when rate = 0. So if I left the rate at 0 and modulated the amplitude I would in essence bypass the LFO (modulating the static LFO max amplitude), but keep the "cho rda"-method. All just wild guesswork on my end. Including the code in my post was probably more confusing than helpful :lol:

Tried your modified code. Quite interesting at higher pot0 settings! But not what I'm after.

The goal is to use the audio input signal itself to modulate the vibrato instead of a sinewave LFO. The modulation "rate"/"shape" would be equal to the complex shape of the guitar signal and the "depth" would be dependent on the playing dynamics + pot0.

I've achieved the effect in an analog circuit. It's quite pleasing in a squirmy, parasitic fashion :twisted:
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

knutolai wrote:
The goal is to use the audio input signal itself to modulate the vibrato instead of a sinewave LFO. The modulation "rate" would be equal to the complex shape of the guitar signal and the "depth" would be dependent on the playing dynamics + pot0.

I've achieved the effect in an analog circuit. It's quite pleasing in a squirmy, parasitic fashion :twisted:
I guess you are looking to achiever a dyna vibrato effect, for this part you may need to rectify the guitar signal to achieve the dynamic part , i'm pretty sure one of the spin examples does exactly this in the reverb/vibrato effect. I will have a look to see if I can find the code example I am thinking of. I'm pretty sure this will get you closer to what you are aiming for.
www.stanleyfx.co.uk
"It's fairly straight forward, if you want to start it press start, you can work out the rest of the controls yourself."
knutolai
Posts: 65
Joined: Wed Nov 23, 2016 9:43 am
Location: Bergen, Norway

Post by knutolai »

Maybe I could use the servo technique to perform the modulation instead of "cho rda"-statements?

http://www.spinsemi.com/knowledge_base/ ... _technique

Code: Select all

skp	run,1	;only establish the LFO on the first sample pass
wldr	rmp0,0,4096	;set rmp0 to its widest range

cho	rdal,rmp0	;load in the current RMP0 pointer
rdax	mpos,-1	;subtract the desired position
wrax	rmp0_rate,0	;write the position error to the ramp rate register
Not quite sure how this works, but will read over the LFO app-note.

http://www.spinsemi.com/Products/appnot ... N-0001.pdf
Post Reply