Audio Driver
The Audio driver in unicontrol operates as an independent routine,
serving as a controller for the DFPlayer Mini MP3 Player (MP3 Player).
Each instance of unicontrol can control a single MP3 Player module
connected to the ESP8266's pins D0
(GPIO16, serving as a software Tx) and D3
(GPIO0, serving as a software Rx):
The set-up is performed in the Peripheral menu by making the following selections:
- D0 -
OUT - DFPlayer mini (TX)
, and - D3 -
OUT - DFPlayer mini (RX)
As long as these selections are active (saved), the MP3 Player initializes automatically upon each boot or following a Micro SD card insertion.
This initialization consists of verifying the connection with the MP3 Player and scanning the content of the inserted Micro SD card.
The Audio driver can utilize up to 16 folders, each holding up to 100 audio files in the .mp3
format.
Edit menu
Clicking on either of the two Edit
buttons will navigate you to the Audio driver edit menu.
Icon | Folder status |
---|---|
Plays the first track of the folder immediately preceding the currently played folder. | |
Plays the track immediately preceding the currently played track. | |
Pauses the playback. | |
Resumes the playback. | |
Plays the track immediately following the currently played track. | |
Plays the first track of the folder immediately following the currently played folder. | |
Selects a random track from the enabled folders. |
The Audio driver set-up consists of four key parameters:
- Volume - The playback volume.
- Equalizer - Equalizer preset used for the playback.
- Shuffle - Change the track selection from sequential to random.
- Directories - Selection of folders enabled for automatic track selection (individual tracks in the unselected folders can still be played when explicitly requested).
Icon | Folder status |
---|---|
The folder is selected and contains valid audio tracks. | |
The folder is selected, but does not contain any valid audio track (will be ignored). | |
The folder is not selected, but contains valid audio tracks. | |
The folder is neither selected, nor contains any valid audio track. |
Processes
Although the Audio driver operates as an independent routine, the playback still needs to be started or stopped by the Processes (or manually). When accessing the audio tracks via a Process, the exact behavior of the Audio driver being controlled by a process is determined by the following process parameters:
Folder & Track:
Exact selection of the track to be played. These parameters are only available for the non-random playback modes.
Output:
The following output options are available for the Audio driver playback, each behaving differently when turning ON
a process with the respective Play
options selected
as the Primary output:
- Play from: Initiates a continuous playback of the tracks in the enabled Directories, played automatically one after another in the order determined by the Folder and Track names, starting from the provided Folder and Track number (if the respective track exists).
- Play single: Initiates a playback of a single track based on the provided Folder and Track number (if the respective track exists).
- Play random: Initiates a continuous playback of the tracks in the enabled Directories, played automatically one after another in a randomized order.
- Play random single: Initiates a playback of a single track randomly picked from the enabled Directories.
OFF
a process with any of the Play
options selected as the Primary output, the playback stops.