How to use soundmodules of the DY series like DY-SC17F or DY-HV20T

Hey everyone,

For my current project, I’m using a DY-HV20T series sound module for playing audio WAV files. I use an SD card to store various audio files for playback. I’m also using the "dyplayer-main" library provided by SnijderC: GitHub - SnijderC/dyplayer: Abstracton for DY-XXXX mp3 player modules over UART..

There are different kinds of manuals, such as this one:

In my project, I use the library’s UART commands for playback. So far, "normal" playback of different sound files works as expected.

I have the following problem: I want to play sound file A, and after it finishes, I want to loop sound file B indefinitely until another "new" file, like sound file C, is requested for playback.

I created a function for this :slightly_smiling_face::

void checkAndUpdateTrack(DY::Player& playerSoftware, char sf_current[], char newAudio[]) { // put input and check for volume controlFrau 
    // Compare the two strings
    if (strcmp(sf_current, newAudio) == 0) {
        // If they are the same
    } else {
        // If they are different
        
        // Copy newAudio content into sf_current
        strcpy(sf_current, newAudio);
        
        // Call the method on the player software object
        playerSoftware.playSpecifiedDevicePath(DY::Device::Sd, newAudio);
    }
}

this function uses the defined player for playback and checks if the new input is different form the previous one, if not it plays back the current one and if so it playbacks the new one.

for my problem i could define how long the duration of song a is and start a timer and the after the timer has reached the songduration i can tell the player to loop song b but with this i always have to start a timer.

is there a more elegant way?
i could also create a new soundfile via e.g. audacity that only plays file a once and then i manually loop file b.

what do the following functions do in the library "dyplayer-main" in file "dyplayer.h"

  • interludeSpecified
  • interludeSpecifiedDevicePath
  • combinationPlay

I am from germany and my english is not that good :smiley: so maybe i just don't get what the interlude or combination play means.

There seems to be a "Busy pin" which is an output and this pin will be High during playing Music.

So you could use that pin as an indicator that the song is finished

Just make sure you don't check it right after (like a few nano seconds later) asking to play a song because the Serial command is asynchronous and will still be in transit.

thank i’ll try this approach :slight_smile:

I have used the BUSY 3.3V output on the DY-HV-20t and appears it only goes active (HIGH) when PAUSE is initiated. It does not appear to go active between music files.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.