playback of Audio Clips

Algorithm development and general DSP issues

Moderator: frank

Post Reply
kradsith
Posts: 5
Joined: Wed Dec 20, 2006 7:05 am

playback of Audio Clips

Post by kradsith »

Hello All,

I received my Dev board 2 days ago and it has surpassed my expectations already.

New to DSP programming and having some ASM programming experience. I am wondering if it
Last edited by kradsith on Thu Dec 21, 2006 9:15 am, edited 1 time in total.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

You could have the FV-1 record a short clip then play it back. Here is a small example program that records the left and right channels and will play them back. Record/play is controlled by the position of POT0.

Code: Select all

; Define delays
delL	mem	16383
delR	mem	16383
;
; If POT0 is 0 to 0.5 we are in record mode
; If 0.5 to 0.999 we are in playback mode
;
ldax	pot0	; Read in POT0
sof	1.0,-0.5	; Add -0.5 to the POT0 value so it ranges -0.5 to +0.5
skp	gez,play	; If ACC is >=0 we are in playback mode so jump to play
ldax	adcl	; Read in ADC left
wra	delL,1.0	; Write to left delay line
wrax	dacl,0	; and to DAC left
ldax	adcr	; Read in ADC right
wra	delR,1.0	; Write to right delay line
wrax	dacr,0	; and to DAC right
skp	zro, end	; Jump to end
;
; Play back mode
play:
clr		; Clear ACC
rda	delL#,1.0; Read tail of left delay
wrax	dacl,0	; Write it to DAC left
rda	delR#,1.0; Read tail of right delay
wrax	dacr,0	; Write it to DAC right
;
end:
Frank Thomson
Experimental Noize
kradsith
Posts: 5
Joined: Wed Dec 20, 2006 7:05 am

Post by kradsith »

Frank,

You replied way to quick and made it look way to easy.

Thanks!

Kradsith
Mcfly
Posts: 46
Joined: Fri Mar 08, 2013 2:38 pm
Location: Argentina

Post by Mcfly »

Hi Frank, in playback mode, is there any way to soften the transition between the end and the start of the audio clip. Something like a fade in and fade out.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Not that I can think of, the start and end are always moving so you would need to track where you are in playback then do a cross fade as you get to the end. There really isn't a way I can think of to do this in the code.
Frank Thomson
Experimental Noize
Sandrine
Posts: 16
Joined: Thu Mar 12, 2015 10:19 am
Location: BC Canada
Contact:

Post by Sandrine »

Maybe he means removing a DC click. That's easy to do using a "zero crossing" state delay. I've done it with my sampler project and it seems to work.
Set the loop points at only zero crossing moments (also direction can improve it) and that gets rid of the click sound.
With low level signals it's not as noticeable because there isn't such a difference.

Of course for the granulizer section (not FV-1) I used an actual quick fade for the slower rates, then the above for the higher rates (>50 loops/second)
Is there a latin word for "Stage Fright"?
Mcfly
Posts: 46
Joined: Fri Mar 08, 2013 2:38 pm
Location: Argentina

Post by Mcfly »

Sandrine wrote:Maybe he means removing a DC click. That's easy to do using a "zero crossing" state delay. I've done it with my sampler project and it seems to work.
Set the loop points at only zero crossing moments (also direction can improve it) and that gets rid of the click sound.
With low level signals it's not as noticeable because there isn't such a difference.

Of course for the granulizer section (not FV-1) I used an actual quick fade for the slower rates, then the above for the higher rates (>50 loops/second)
Yes, that's what im talking about. Any advice for coding a zero crossing detection? Thank you.
MacroMachines
Posts: 71
Joined: Fri Dec 12, 2014 10:45 pm
Location: Detroit,MI
Contact:

Post by MacroMachines »

there is a skip instruction specifically for zero cross
SKP ZRC
http://MacroMachines.net
Digital Control for your Analog Soul.
alpignolo
Posts: 20
Joined: Tue May 27, 2014 8:40 am

Re:

Post by alpignolo »

frank wrote: Wed Dec 20, 2006 11:07 am You could have the FV-1 record a short clip then play it back. Here is a small example program that records the left and right channels and will play them back. Record/play is controlled by the position of POT0.

Code: Select all

; Define delays
delL	mem	16383
delR	mem	16383
;
; If POT0 is 0 to 0.5 we are in record mode
; If 0.5 to 0.999 we are in playback mode
;
ldax	pot0	; Read in POT0
sof	1.0,-0.5	; Add -0.5 to the POT0 value so it ranges -0.5 to +0.5
skp	gez,play	; If ACC is >=0 we are in playback mode so jump to play
ldax	adcl	; Read in ADC left
wra	delL,1.0	; Write to left delay line
wrax	dacl,0	; and to DAC left
ldax	adcr	; Read in ADC right
wra	delR,1.0	; Write to right delay line
wrax	dacr,0	; and to DAC right
skp	zro, end	; Jump to end
;
; Play back mode
play:
clr		; Clear ACC
rda	delL#,1.0; Read tail of left delay
wrax	dacl,0	; Write it to DAC left
rda	delR#,1.0; Read tail of right delay
wrax	dacr,0	; Write it to DAC right
;
end:
Hi Frank,
there's a way to remove the "click"/"glitch"?
Thanks
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: playback of Audio Clips

Post by frank »

Not really, you could try but you need to track the head/tail write address and cross fade between the head and tail. I have not done this on the FV-1 and it is not simple since the user can record/play at any point in time and as a result any address could be the head/tail point.
Frank Thomson
Experimental Noize
ZibiSound
Posts: 66
Joined: Fri Mar 15, 2013 3:02 pm

Re: playback of Audio Clips

Post by ZibiSound »

Hello frank,
forgive me little off-topic, but I got a question. How can I change lenght of recorded sample? Eg, I record full sample (all delay memory), goes into playback mode and now, if pot is 1, processor plays all sample lenght (0 -> 32767), when pot is 0.9 processor plays only 0 -> 29490, etc.
ZibiSound
Posts: 66
Joined: Fri Mar 15, 2013 3:02 pm

Re: playback of Audio Clips

Post by ZibiSound »

@frank colud you give me some idea, please?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: playback of Audio Clips

Post by frank »

Not easy to do on FV-1, would not even try.
Frank Thomson
Experimental Noize
ZibiSound
Posts: 66
Joined: Fri Mar 15, 2013 3:02 pm

Re: playback of Audio Clips

Post by ZibiSound »

Ok, so maybe at least can I change sample lenght while recording?
Post Reply