# PLAY WAV / FLAC / MP3

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
PLAY WAV file$ [, interrupt]
PLAY FLAC file$ [, interrupt]
PLAY MP3 file$ [, interrupt]

Description:
Play an audio file on the audio (DAC) output.
'file$' is the file to play (the appropriate extension will be appended if missing). The file is played in the background,
'interrupt' is optional and is the name of a subroutine that will be called when the file has finished playing.
For WAV files MMBasic will automatically compensate for the frequency, number of bits and number of channels of the WAV file.
For FLAC files the supported frequencies are:
44100Hz 16-bit(CD quality) and 24-bit
48000Hz 16-bit and 24-bit
88200Hz 16-bit and 24-bit
96000Hz 24-bit
Maximums for FLAC and WAV file playback are 96KHz 24-bit. Both will auto-configure to the file provided.
As an indication, 96KHz 24-bit FLAC uses just over 50% of the CPU's resources.
If ‘file$’ is a directory then the firmware will list all the files of the relevant type in that directory and start playing them one-by-one.
To play files in the current directory use an empty string (ie, "").
Each file listed will play in turn and the optional interrupt will fire when all files have been played.
The filenames are stored with full path so you can use CHDIR while tracks are playing without causing problems.
All files in the directory are listed if the command is executed at the command prompt but the listing is suppressed in a program

Last edited: 29 September, 2020