tap tempo snippet

Algorithm development and general DSP issues

Moderator: frank

alpignolo
Posts: 20
Joined: Tue May 27, 2014 8:40 am

Post by alpignolo »

slacker wrote:Hi Slacker, i tried to write a code for control delay time by the taptempo regardless of position of pot1 and change delay time when it is turned back potentiometer.

I replaced this piece of code:

Code: Select all

ldax pot1		;read pot1
sof 1,-0.05		;shift down now -0.05 to 0.95
skp neg,DODELAY		;if negative skip to delay, taptempo mode
ldax pot1		;else read pot1
sof 1/0.95,-0.05/0.95 	;scale to 0 to 1
wrax taptempo,0		;and write to taptempo register, pot controls delay time
with this:

Code: Select all

rdax pot1,1
rdax time_pot,-1
skp zro,DODELAY
ldax pot1      ;else read pot1 
wrax taptempo,1      ;and write to taptempo register, pot controls delay time 
wrax time_pot,0
But it does not work.
Tap tempo works but no pot1.
thanks
musicvoice
Posts: 10
Joined: Mon Jun 27, 2011 4:11 pm

Post by musicvoice »

hi
pot 2 tap input ?
scheamatich please.
best regards.
alpignolo
Posts: 20
Joined: Tue May 27, 2014 8:40 am

Post by alpignolo »

musicvoice wrote:hi
pot 2 tap input ?
scheamatich please.
best regards.
yes, pot2 for tap tempo,
i tried the Slacker's code but i would like to use pot1 for delaytime when i turn it and use taptempo when i push momentary switch on pot2.
The schematics for taptempo on pot2 is this:
Image
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

Hi alpignolo

Your code will not do what you want it to. This part of the tap tempo code

Code: Select all

jam rmp0      ;else latch is high, jam rmp0 (reset to 0)
ldax ramp      ;read ramp, will contain last value of rmp0 before latch went high   
wrax taptempo,0      ;write to taptempo
sets taptempo to the last value that was tapped, this will overwrite the value that your code read from pot1, which is why the pot does not work.

In your code if you change wrax taptempo,1 to wrax ramp,1 this will overwrite the tapped tempo with the value from pot1 and it should work.
alpignolo
Posts: 20
Joined: Tue May 27, 2014 8:40 am

Post by alpignolo »

I made a mistake in my previous post, indeed work only pot 1 but not work tapped tempo.
I have tried to change wrax tap tempo,1 with wrax ramp,1 but the result is the same.

This part of the tap tempo code

Code: Select all

jam rmp0      ;else latch is high, jam rmp0 (reset to 0)
ldax ramp      ;read ramp, will contain last value of rmp0 before latch went high   
wrax taptempo,0      ;write to taptempo
should not overwrite the value of pot1 because is before.
The problem in this code

Code: Select all

rdax pot1,0.5
rdax time_pot,-0.5
skp zro,DODELAY  
ldax pot1      ;else read pot1 
wrax ramp,1      ;and write to taptempo register, pot controls delay time 
wrax time_pot,0
is that the result of subtraction in the first two rows is alway different from zero, then it read always pot1.

I would like that pot1 worked only when it is turned
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

The reason that doesn't work is because there will be some noise on the pot so it won't necessarily read exactly the same value each time. Try this instead

Code: Select all

ldax pot1
and %01111111_00000000_00000000
rdax time_pot,-1
skp zro,DODELAY
ldax pot1      ;else read pot1
and %01111111_00000000_00000000
wrax ramp,1      ;and write to ramp register, pot controls delay time
wrax time_pot,0
This reduces the resolution of the pot reducing or removing the noise so it will read the same value each time if it isn't moved, I tried it and it seems to work fine. It might still be possible to put the pot in a position where it jumps between two values though.

For an explanation of what the "and" commands do have a look here http://www.spinsemi.com/knowledge_base/ ... ing_delays
alpignolo
Posts: 20
Joined: Tue May 27, 2014 8:40 am

Post by alpignolo »

Perfect, now work perfectly!
many
many
thanks
Mcfly
Posts: 46
Joined: Fri Mar 08, 2013 2:38 pm
Location: Argentina

Post by Mcfly »

Hi! Is there a way to use a Sin for controlling the led rate indicator instead of a ramp? The thins is that i need that ramp for another line in the program.
Thanks!

Code: Select all

;Taptempo rate indicator, creates a square wave at the tap tempo rate 
sof 0,0.064    
wrax rmp1_rate,0      ;set rmp1 rate to 1Hz 
cho rdal,rmp1      ;read value of rmp1 
sof -2,0.999      ;level shift to 0 - 1 rising ramp 
sof 1,0.001 
rdax taptempo,-0.5   ;deduct half of the taptempo value 
skp neg,ENDLED      ;if negative skip to ENDLED 
jam rmp1      ;else reset ramp1 
ldax led         ;and invert value of led register, creates square wave at taptempo rate 
sof -1,0 
wrax led,1
wrax	dacl,0  
ENDLED: 
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

I don't think there is an easy way to use the sine. It should be possible to replace the ramp with a counter something like this.

Code: Select all

equ ledramp reg11; put this at the top of the code with the others

;Taptempo rate indicator, creates a square wave at the tap tempo rate
ldax ledramp
sof 1,1/32768 ;add 1/32768 will take one second to go from 0 -1 a 1Hz ramp
wrax ledramp,1
rdax taptempo,-0.5   ;deduct half of the taptempo value
skp neg,ENDLED      ;if negative skip to ENDLED
clr
wrax ledramp,0; reset ledramp to 0
ldax led         ;and invert value of led register, creates square wave at taptempo rate
sof -1,0
wrax led,1
wrax   dacl,0 
ENDLED: 
I think that should work but I haven't tested it and I haven't written any spin asm in a while so there might be some mistakes. Hopefully it gives you the idea.
Mcfly
Posts: 46
Joined: Fri Mar 08, 2013 2:38 pm
Location: Argentina

Post by Mcfly »

Thank you Slacker, i've tried it but i does not work. Led is always on. I'm trying to understand the code but im lost.
slacker wrote:I don't think there is an easy way to use the sine. It should be possible to replace the ramp with a counter something like this.

Code: Select all

equ ledramp reg11; put this at the top of the code with the others

;Taptempo rate indicator, creates a square wave at the tap tempo rate
ldax ledramp
sof 1,1/32768 ;add 1/32768 will take one second to go from 0 -1 a 1Hz ramp
wrax ledramp,1
rdax taptempo,-0.5   ;deduct half of the taptempo value
skp neg,ENDLED      ;if negative skip to ENDLED
clr
wrax ledramp,0; reset ledramp to 0
ldax led         ;and invert value of led register, creates square wave at taptempo rate
sof -1,0
wrax led,1
wrax   dacl,0 
ENDLED: 
I think that should work but I haven't tested it and I haven't written any spin asm in a while so there might be some mistakes. Hopefully it gives you the idea.
Herradura
Posts: 2
Joined: Fri May 22, 2015 9:55 am

tap tempo question

Post by Herradura »

Hi
Read your post with much interest. I guess you chose max delay of 1 second ( if I've read things correctly) as this max delay of fv-1? Very new to this and just about to purchase the Dev board. Can I increase the delay time/drop bandwidth to get slightly longer delays. TryING to make a bass guitar looper where the original loop is repeated infinitely, and the player can play solo cleanly over the top. Could get away with 12 to 15khz bandwidth I guess

Cheers All

H
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: tap tempo question

Post by frank »

Herradura wrote:Hi
Read your post with much interest. I guess you chose max delay of 1 second ( if I've read things correctly) as this max delay of fv-1? Very new to this and just about to purchase the Dev board. Can I increase the delay time/drop bandwidth to get slightly longer delays. TryING to make a bass guitar looper where the original loop is repeated infinitely, and the player can play solo cleanly over the top. Could get away with 12 to 15khz bandwidth I guess

Cheers All

H
The FV-1 has a 32768 sample memory so if you use it all for delay you can calculate the time by 32768/sample rate. Sample rate must be 2x bandwidth. For a bass 10KHz bandwidth should be more than enough so a 20KHz sample rate. 32768/20000 = 1.638 seconds. You could argue you can get away with a 6KHz bandwidth, while the bass may generate harmonics above 6K your amp may be bandwidth limited so try a 12K sample rate which will give 2.7 seconds of delay. It may sound just fine and you get more delay.
Frank Thomson
Experimental Noize
Herradura
Posts: 2
Joined: Fri May 22, 2015 9:55 am

tap tempo question

Post by Herradura »

Thanks Frank, I think 12khz will give good quality and enough delay time. I suppose the hard bit is to get the delay to continuously loop, and use the other channel set to a zero delay, split the bass input signal and send it thru a clean channel. This will allow you to play over the top of the loop, without the bass guitar going thru the effects chain. Thus you have a continuous backing loop mixed in with your solo playing
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

A simple example of a looper is here http://www.spinsemi.com/forum/viewtopic ... ght=record it does both channels but it is easy to remove one channel and use all the memory for just one channel.
Frank Thomson
Experimental Noize
Sandrine
Posts: 16
Joined: Thu Mar 12, 2015 10:19 am
Location: BC Canada
Contact:

Post by Sandrine »

I have a thought on varying the clock rate on the fly. I've used DDS chips (AD9850 board on ebay cheap) for synths/RF gens etc.

They are dead accurate and range from <.1 hz up to 40MHz. An arduino controlling a DDS would allow switching to all sorts of sample rates.

Here it is in the last synth I made
http://www.freshnelly.com/showbox-mysynth.htm

Cheers!
Is there a latin word for "Stage Fright"?
Post Reply