
        PlayFilX 1.00 - Play 2 MP3/WAV Files
        ------------------------------------
              for VSOS 3.57 or higher
             2020-02-20  VLSI Solution



With the help of audiodex.dl3, PlayFilX can play two MP3 / WAV files
simultaneosly. Other audio formats are not supported.

For options, run:
S:>playfild -h
Usage: PlayFilD [-1|-2|-h] driv
-1      Start driver task 1
-2      Start driver task 2
driv    Use audio driver driv
-h      Show this help

S:>playfilx -h
Usage: PlayFilX [-1|-2|-c1|-c2|-h] [song]
-1|-2   Force Track 1|2
-c1|c2  Cancel Track 1|2
song    Song file name
-h      Show this help


To use, either compile the VSIDE Solution, or simply copy PlayDirD.dl3,
PlayFilX.dl3 and audiodex to your VS1005 Evaluation Board's SYS/ folder.



Setting up the system:

To start the system, create the following S:config.txt file:

[0]
# Set clock to a higher value so that even the more difficult codecs can play.
RUN SETCLOCK -l100 80
# Start SD card as device D
SDSD D
# Start UART in/out driver
UARTIN
# Start PlayFilD drivers
RUN driver +PlayFilD -1 auodac
RUN driver +PlayFilD -2 auooset
# Start the shell
S:SHELL.AP3

Alternatively, you can give the following commands from the command line.
Note, however, that if you have many drivers loaded, you may run out of
memory later:

S:>driver -auodac
S:>driver +playfild -1 auodac
S:>driver +playfild -2 auooset

Note that we start two PlayFil drivers: one for Track 1 that used auodac
as its audio driver, and one for Track 2 that uses auooset as its audio
driver. Both these drivers can output to the VS1005 analog outputs,
although the quality of auodac is technically better.



Playing two songs:

Now, you may start playback of an MP3 or WAV file for example as follows:
S:>cd d:mp3
D: SD/SD Card
D:>cd mp3
D:MP3/>playfilx 05_PopCorn.mp3
Track 1: 05_PopCorn.mp3
Play 05_PopCorn.mp3
Track 1 playing, Track 2 stopped

To start playback of another file simultaneously.
D:MP3/>playfilx 06_Let.mp3
Track 2: 06_Let.mp3
Play 06_Let.mp3
Track 1 playing, Track 2 playing



Adjusting volume:

Adjust volume of Track 1 e.g. as follows:
D:MP3/>auoutput -dauodac -l-20
D:MP3/>auoutput -dauodac -l-0

Adjust volume of Track 2 e.g. as follows:
D:MP3/>auoutput -dauooset -l-20
D:MP3/>auoutput -dauooset -l-0

(Note that you will need auooset.dl3 v1.06, dated 2020-02-20, or later to
be able to adjust volume.)



Cancelling Playback:

To cancel playback of Track 1:
D:MP3/>playfilx -c1
Decode returned 5, ok.
Track 1 stopped, Track 2 playing

To cancel playback of Track 1:
D:MP3/>playfilx -c2
Decode returned 5, ok.
Track 1 stopped, Track 2 stopped



Checking current channel status:

D:MP3/>playfilx
Track 1 stopped, Track 2 stopped



Audio quality considerations:

The main analog audio driver auodac.dl3 uses VS1005's best audio channel.
It is made to be as good as possible.
- Sample rate can be set with an accuracy of approximately 0.09 Hz.
- Proper low-pass filtering guarantees pure, high-fidelity sound at any
  sample rate up up to 96 kHz.

The secondary analog audio path driver auooset.dl3 uses another VS1005
internal audio channel, which has some limitations.
- Sample rate accuracy is limited. While e.g. 48000 Hz can be presented
  accurately, audio sampled at 44.1 kHz will be played back at 44.201 Hz,
  in other words with a 0.2% error. While undetectable by human ears, it
  may cause synchronization issues in some cases.
- There is no hardware low-pass filtering. This, for audio sampled at
  40 kHz or above, there will be some aliasing in the ultrasound domain.
  If the sample rate it below 40 kHz, some of the aliasing may appear
  in the audible band. It is not recommended to use this audio path for
  audio in the speech range of 16 kHz or below.

This double playback system is intended for the analog audio output only!
S/PDIF output driver auospda.dl3 will not play both tracks! I2S drivers
like auoi2sma.dl3 will play back both track, but depending on sample
rates used, quality may be severely limited!



License:
This code may be used freely in any product containing one or more ICs
by VLSI Solution.




Disclaimer:
No guarantee is given for the usability of this code.




Version History:
2020-02-20 HH v1.00 - First release.
