CALL COPY PCM
This page was last modified 14:55, 17 May 2020 by Mars2000you.

Contents

Effect

Copies part or entirety of an ADPCM/PCM file into another file.

This instruction does not check the file type (ADPCM or PCM). Length and file type are not modified by this operation.

Tip: Use first CALL SET PCM.

Syntax

CALL COPY PCM([#]<SourceVoiceFile>,<DestinationVoiceFile>,<SourceOffset>,<Length>,<DestinationOffset>)

The three last parameters are optional. Parameters can not end with a comma alone.

Parameters

<SourceVoiceFile> is generally a number between 0 and 15, that specifies the ADPCM/PCM file.

However, when it is preceded by #, it will vary between 0 and 17 to indicate one of the built-in ADPCM voices in the Sample ROM (see below Sample ROM ADPCM Voice Data Table), it could even vary between 0 and 29 as the MSX-AUDIO Sample ROM can contain a maximum of 30 ADPCM/PCM voices.

<DestinationVoiceFile> is always a number between 0 and 15.

<SourceOffset> is used to specify the offset from which you will copy the data of the source audio file (several offsets of 256 bytes can be used by an ADPCM/PCM file) - Defaut value is 0.

<Length> is used to specify the number of offsets you want to record - Default value = until the end of the file

<DestinationOffset> is used to specify the offset where you want to start to copy in the destination audio file (several offsets of 256 bytes can be used by an ADPCM/PCM file) - Defaut value is 0.

Sample ROM ADPCM Voice Data Table

This is a list of the voices available in the built-in MSX-AUDIO Sample ROM.

Voice No. Name Offsets Bytes Voice No. Name Offsets Bytes
0 Cuckoo 35 8960 9 Footsteps 1 256
1 Chicken 33 8448 10 Progress 6 1536
2 Cat 20 5120 11 Toy 4 1024
3 Dog 5 1280 12 Applause 2 512
4 Horse 29 7424 13 Tennis 5 1280
5 Lion 43 11008 14 Golf swing 9 2304
6 Laughing people 26 6656 15 Golf cup-in 9 2304
7 Closing of a door 11 2816 16 Sword being waved 1 6 1536
8 Whiskey being poured 4 1024 17 Sword being waved 2 7 1792


Directory structure for each voice in Sample ROM

Bytes Content Values
0 Voice type 0 = ADPCM - 128 = PCM
1 Reserved 0
2-3 Start Adddress
4-5 Data Length
6-7 Sampling Frequency


General structure of Sample ROM

Bytes Content Values
0-1 AB Signature 41/42
2-15 Reserved 0
16-23 Directory for voice 0
24-31 Directory for voice 1
etc...
240-247 Directory for voice 29
248-255 Directory end mark 0
256 and higher Audio data


Examples

CALL COPY PCM(1,2)
CALL COPY PCM(#8,0)
10 SCREEN 0: KEYOFF: CALL AUDIO
20 FOR N=0 TO 17:READ L,T
30 CALL SET PCM (0,0,0,,L)
40 CALL COPY PCM (#N,0)
50 CLS
60 LOCATE 5,12: PRINT "Sample nr ";N
70 LOCATE 5,15: PRINT "Spacebar for next sample"
80 LOCATE 5,18: PRINT "ESC to stop"
90 CALL PLAY PCM (0)
100 K$=INKEY$
110 IF K$=CHR$(32) THEN 150
120 IF K$=CHR$(27) THEN 170
130 FOR J=1 TO T: NEXT J
140 GOTO 90
150 CALL STOPM
160 NEXT N
170 END
180 DATA 35,0,33,1500,20,1300,5,200,29,1200,43,1500,26,1700,11,1000,4,110
190 DATA 1,500,6,250,4,80,2,80,5,600,9,1000,9,1000,6,900,7,900

Related to

CALL CONVA, CALL CONVP, CALL LOAD PCM, CALL MK PCM, CALL PLAY PCM, CALL REC PCM, CALL SAVE PCM, CALL SET PCM

Compatibility

MSX-AUDIO BASIC