CALL PLAY PCM
This page was last modified 15:18, 17 May 2020 by Mars2000you.

Contents

Effect

Plays an ADPCM/PCM audio file.

Tip: Use first CALL SET PCM.

Syntax

CALL PLAY PCM(<VoiceFile>,<Mode>,<Offset>,<Length>,<SamplingFrequency>,<Channel>)

Only the first parameter needs to be specified in all cases. Parameters can not end with a comma alone.

Parameters

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

<Mode> is used to specify the playing mode:

  • 0 = normal mode (default value)
  • 1 = repeat mode

<Offset> is used to specify the offset where you want to start to play the 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 play - Default value = until the end of the file

<SamplingFrequency> is exprimed in Hz and generally can vary from 1800 to 16000. However, when you want to play an ADPCM file in local mode, using the Sample RAM or the Sample ROM, the sampling frequency can vary from 1800 to 49716. The default value is the value set by the CALL SET PCM instruction.

<Channel> specifies the MSX-AUDIO channel to be used:

  • 0 = channel of first MSX-AUDIO chip
  • 1 = channel of second MSX-AUDIO chip

However, when using the Sample RAM or the Sample ROM, the playback is only possible on the channel used to connect the device.

This parameter generally does not need to be specified because it is already correctly initialised with the value set by the CALL SET PCM instruction.

Examples

CALL PLAY PCM(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: NEXTJ
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 COPY PCM, CALL LOAD PCM, CALL MK PCM, CALL REC PCM, CALL SAVE PCM, CALL SET PCM

Compatibility

MSX-AUDIO BASIC