Contents |
Effect
Initializes an ADPCM/PCM file to be used as sound instrument (voice).
Syntax
CALL SET PCM(<VoiceFile>,<Device>,<Mode>,<SpecificParameter>,<Length>,<SamplingFrequency>,<Channel>)
The two last parameters are optional. Parameters can not end with a comma alone.
Parameters
<VoiceFile> is a number between 0 and 15, that specifies the ADPCM/PCM file. This number is also used in the following instructions: CALL CONVA - CALL CONVP - CALL COPY PCM - CALL LOAD PCM - CALL MK PCM - CALL PLAY PCM - CALL REC PCM - CALL SAVE PCM.
<Device> is a number between 0 and 5, that specifies the location of the ADPCM/PCM file.
According the used device, the three next parameters can vary (and sometimes are not used).
Device | Name | Mode | Specific parameter | Length |
---|---|---|---|---|
0 | Sample RAM of first MSX-AUDIO chip | 0 or 1 | not used | used |
1 | Sample ROM of first MSX-AUDIO chip | not used | ROM audio file number | used |
2 | Sample RAM of second MSX-AUDIO chip | 0 or 1 | not used | used |
3 | Sample ROM of second MSX-AUDIO chip | not used | ROM audio file number | used |
4 | Computer RAM | 0 or 1 | Array name | not used |
5 | Computer VRAM | 0 or 1 | Address | used |
<Mode> specifies the PCM mode (it is not used for files in Sample ROM as all these files have a built-in mode parameter):
- 0 = ADPCM
- 1 = PCM
<SpecificParameter> is not used for files in Sample RAM. Otherwise, it specifies
- the ROM audio file number (between 0 and 29) when Sample ROM is used - 18 ADPCM voices are built-in in the Sample ROM (see below Sample ROM ADPCM Voice Data Table) and the MSX-AUDIO Sample ROM can contain a maximum of 30 ADPCM/PCM voices.
- the array name for files in computer RAM
- the address for files in computer VRAM.
<Length> is not used for files in computer RAM. The unit of length is 256 bytes.
<SamplingFrequency> is exprimed in Hz and 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 8000 Hz.
<Channel> specifies the MSX-AUDIO channel for recording and playback:
- 0 = channel of first MSX-AUDIO chip
- 1 = channel of second MSX-AUDIO chip
When omitted, the device is not connected if you use device 0 to 3. For files in computer RAM or VRAM, channel 0 is used by default.
Note: after initialisation with CALL AUDIO, audio file number 0 is assigned to the Sample RAM of the first MSX-AUDIO chip and the other audio files have a length of 0. It is equivalent to CALL SET PCM(0,0,0,,128)
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 SET PCM(0,0,0,,32)
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 AUDIO, CALL CONVA, CALL CONVP, CALL COPY PCM, CALL LOAD PCM, CALL MK PCM, CALL PCM FREQ, CALL PLAY PCM, CALL REC PCM, CALL SAVE PCM