Digital Recording/Playing

Function:     Implement a .45s digital recorder/player on the C54x DSKPlus

Location:     ftp://ftp.ti.com/pub/tms320bbs/c5xxdskfiles/Rcdr.exe
By:              Thomas Millikan


Digital Recorder/Player Application Code: dskprcdr.exe

Starting off:
The file "dskprcdr.exe" can be downloaded to demonstrate the digital recording/playing of music on the C54x DSKPlus. Save "dskprcdr.exe" into it’s own directory. Then run the executable (either in DOS or Windows) allowing it to explode into the following list of files:

        dskprcdr.exe    - The original file that was downloaded
        Ac01init.asm    - Initializes the analog interface on the DSK Plus
        Main.asm        - Main assembly program
        Main.cmd        - Assembler/Linker command file
        Main.obj        - object file for main assembly program (executable)
        Readme.txt      - In depth explanation of the assembly code
        Vectors.asm     - Initializes the C542 interrupt vector table

By downloading and running "dskprcdr.exe" you can gain insight into the fundamentals of digital recording and playing. Digitized audio is used in CD’s, voice-mail, cellular phones, and on the Internet. This sample program can help you understand how digital audio is sampled and recorded.

Load Main.obj onto the DSK and run it to record a .45s sample of voice/music introduced through the input min-jack. The output can be heard through the output mini-jack by changing the "func" variable to "play" , recompiling, and then running the program again (See the hints section on: changing the recorder to play mode)

Theory:
The program records .45s of music/voice by storing digitized samples of the music into a buffer in memory. The size of the buffer directly affects the duration of music that can be recorded. This relationship can be understood through the equation:

Duration (s) = BS (samples) / Fs (samples / s)

Hints:
To change the sampling frequency, look to the lines:

        
File: "Ac01init.asm"
        REG1    .set    124h    
        REG2    .set    20fh

The sampling frequency is defined by:
        Sampling Frequency = MCLK/ ( 2 * A * B)
where:
        MCLK = 10Mhz
        A    = Bits 0 to 8 of REG1 (for example: REG1 = 124, then A = 24)
        B    = Bits 0 to 8 of REG2 (for example: REG2 = 20f, then  B= 0f)
Refer to page 2-20 in the "TLC320AC01C User’s Manual" for more information.

To change the size of the buffer, look to the lines:

File: "Main.asm"
        buf_beg    .word   01800h  ; buffer starting point
        buf_hlt    .word   027ffh  ; buffer ending point

By changing the beginning (buf_beg) to a lower value, you increase the buffer size, effectively increasing the duration of music recorded.

(BS = buf_hlt - buf_beg)

Note: Do not increase buf_hlt, it is already at the maximum memory address for on-chip RAM Also, do not decrease buf_beg below 01100h, or you will write over the PC communications kernel. Refer to the "DSKPlus Memory Map" on page 1-5 in the "TMS320C54x DSKPlus User’s Guide.

To change the digital recorder to play mode, look to the lines:

File: File: "Main.asm"
        func       .word   0h      ; 0=record, 1=playback

By changing this variable from "0h" to "1h" and recompiling, your recorder becomes a player. After changing this variable, save the file under a different name (for example: "Main_Play.asm"). Then compile "Main_Play.asm" , and load "Main_Play.obj" into the DSP to play the music. You now have one file to record the music (Main.asm) and another to play the music (Main_Play.asm).