⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adt&slapback.asm

📁 电子元件资料-170M-pdf版.zip
💻 ASM
📖 第 1 页 / 共 2 页
字号:
/* **************************************************************************************************
*   MONOSTEREO_DELAY.ASM                                                                            *
*                                                                                                   *
*   Slapback ('Doubling') Effect (also called Mono Automatic Double Tracking)                       *
*   One popular use of the digital delay is to quickly repeat the input signal with a single        *
*   reflection at unity gain. By making the delay an input signal around 15-40 milliseconds,        *
*   the resulting output produces a "slapback/doubling " effect.  The slight differences in the     *
*   delay create the effect of the two parts being played in unison.  The effect is created by      *
*   adding a delayed signal together with the original, where a single input source is mixed with   *
*   the delay, and the result is sent to both output channels.  With short delays, slapback can     * 
*   thicken the sound of an instrument or voice when mixed for a mono result, although              *
*   cancellations can occur from comb filtering side effects when the delay is under 10 ms,         *
*   which will result in a hollow, resonant sound.  Longer slapback delay effects were commonly     *
*   used in the 1950's/1960's music industry.                                                       *
*                                                                                                   *
*                                                                                                   *
*   Mono ADT I/O Equation and Structure:                                                            *
*                           y(n) = x(n) - ax(n - D)                                                 *
*                           yLeft(n) = yRight(n) = y(n)                                             *
*                                                                                                   *
*        x(n) ------------------------------------------|>------>O--------> y(n)                    *
*               |                                       1/2      ^                                  *
*               |                                                |                                  *
*               |                _______________                 |                                  *
*               |               |               |                |                                  *
*               |               |               |                |                                  *
*               |-------------->|     Z^(-D)    |------|>--------|                                  *
*                               |               |      1/2                                          *
*                               |_______________|                                                   *
*                                                                                                   *
*                                                                                                   *
*   Stereo Automatic Double Tracking (Stereo Doubling) - "Concert Announcer Simulation"             *
*   Automatic Double Tracking, which is used by audio engineers in the music industry to create     *
*   a sense of spaciousness in stereophonic systems.   This effect is set up to playback the        *
*   original "dry" signal in one stereo channel and the delayed signal in the other channel.        *
*   This creates the impression of a stereo effect using a single mono source. By making the        *
*   delay an input signal around 15-40 milliseconds, the resulting output produces a                *
*   "stereo doubling" effect.                                                                       *
*                                                                                                   *
*                                                                                                   *
*   Stereo ADT I/O Equation and Structure:                                                          *
*                                        yLeft(n) = x(n)                                            *
*                                        yRight(n) = x(n - D)                                       *
*                                                                                                   *
*       x(n) --------------------------------------------------|>-----------> yLeft(n)              *
*                      |                                        1/2                                 *
*                      |			                                                                *
*                      |             _______________                                                *
*                      |            |               |                                               *
*                      |            |               |                                               *
*                      |----------->|     Z^(-D)    |-----------|>-----------> yRight(n)            *
*                                   |               |           1/2                                 *
*                                   |_______________|                                               *
*                                                                                                   *
*                                                                                                   *
*                                                                                                   *
*   These effects are great for 'spicing' up an instrument or vocal track, such as compensating     *
*   for a singer who is slightly out of key.  To truly simulate a doubling effect, some random      *
*   delay line modulation can be added, since 2 voices are never truely in sync with one another.   *
*                                                                                                   *
*   IRQ1 pushbutton is used to vary the delay length on-the-fly.                                    *
*   IRQ2 selects between either Slapback or Stereo Doubling effects.                                *
*                                                                                                   *
*                                                                                                   *
*                                                                          John Tomarakos           *
*                                                                          ADI DSP Applications     *
*                                                                          Revision 2.0             *
*                                                                          4/28/98                  *
*                                                                                                   *
*****************************************************************************************************/

/* ADSP-21060 System Register bit definitions */
#include 	"def21065l.h"
#include 	"new65Ldefs.h"

.GLOBAL		Init_Delay_Buffer;
.GLOBAL		Slapback_Echo;
.GLOBAL		Stereo_Double_Tracking;
.GLOBAL		change_delay_settings;
.GLOBAL		change_audio_effect;
.GLOBAL		effects_counter;
.EXTERN		Left_Channel_In;
.EXTERN 	Right_Channel_In;
.EXTERN 	Left_Channel;
.EXTERN 	Right_Channel;
.EXTERN		RX_left_flag;

/* ------------- DATA MEMORY FILTER BUFFERS ---------------------------------*/
.segment /dm	dm_delay;

#define DelayLine  	1632			/* Depth, or TD = D/fs = 1680/48000 = 35 msec   */
#define DelayLine2  3000 			/* Depth, or TD = D/fs = 3000/48000 = 62.5 msec */
#define DelayLine3	6000			/* Depth, or TD = D/fs = 3000/48000 = 125 msec  */
#define DelayLine4	12000			/* Depth, or TD = D/fs = 3000/48000 = .25 sec   */
#define DelayLine5	24000			/* Depth, or TD = D/fs = 3000/48000 = .50 sec   */
#define DelayLine6	48000			/* Depth, or TD = D/fs = 3000/48000 = 1.0 sec   */
			
.var	w[DelayLine6 + 1];			/* delay-line buffer, max delay = D */

.endseg;

/* ----------- INTERRUPT/FLAG DELAY FX DEMO CONTROL PARAMETERS ---------*/
.segment /dm	IRQ_ctl;

/* Reverb Control Parameters, these control 'knobs' are used to change the response on-the-fly */
.VAR	delay_time = 1000;				/* controls length (L6 register)of predelay buffer */
										/* length value always << max buffer length! */

.VAR	IRQ1_counter = 0x00000004;		/* selects preset 1 first on IRQ1 assertion */
.VAR	effects_counter = 0x00000001;	/* default is slapback effect */

.endseg;

/* ---------------------------------- PROGRAM MEMORY CODE ------------------------------------- */

.segment /pm pm_code;

Init_Delay_Buffer:
	B6 = w;  	L6 = @w;     			/* delay-line buffer pointer and length for ADT Effect */
	M6 = 1;

	LCNTR = L6; 						/* clear delay line buffer 2 to zero */
    DO clrDline UNTIL LCE;
clrDline:         dm(I6, M6) = 0;

	rts;


/* ///////////////////////////////////////////////////////////////////////////////////////// */
/*      Slapback Echo - Mono Doubling Audio Effect (ADT) using a digital delay-line 	     */
/*      Digital Delay Effect to create a mono echo effect                                    */
/*                                                                                           */
/*      This routines scales & mixes both input channels into 1 audio stream                 */
/* ///////////////////////////////////////////////////////////////////////////////////////// */
	
Slapback_Echo:  						/* process both channel inputs */	   	
   	/* get input samples from data holders */
   	r0 = dm(Left_Channel_In);          	/* left input sample */
   	r1 = dm(Right_Channel_In);         	/* right input sample */

	r1 = ashift r1 by -1;				/* scale signal by 1/2 for equal mix */
	r2 = ashift r2 by -1;				/* scale signal by 1/2 for equal mix */
	r1 = r2 + r1;						/* 1/2xL(n) + 1/2 xR(n) */

	L6 = dm(delay_time);
   	/* tap output of circular delay line */
   	r3 = dm(i6, 0);    					/* point to d-th tap and put in data register */
										/* fetch address with no update */

	/* add delayed signal together with original signal */
    r1 = ashift r1 by -1;				/* scale input signal by 1/2 for equal mix */
	r3 = ashift r3 by -1;				/* scale delayed signal by 1/2 for equal mix */
	r4 = r3 + r1;						/* 1/2xL(n) + 1/2 xR(n) */

   	/* write output samples to SPORT0 I2S channel A transmitter */
	r4 = ashift r4 by 1;				/* turn up the volume a little */
   	dm(Left_Channel)  = r4;    			/* left output sample */
   	dm(Right_Channel) = r4;	  			/* right output sample */

   	/* put input sample into tap-0 of delay line, post-modify address after storage of input */
   	dm(i6, -1) = r1;  					/* put value from register r1 into delay line */
										/* and decrement address by -1 */
    r4 = 0;
	dm(RX_left_flag) = r4;				/* clear RX_left_flag since we have processed incoming data */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -