# "Play MP3 if" coding issue

**URL:** <https://forum.arduino.cc/t/play-mp3-if-coding-issue/1164115>\
**Category:** Programming\
**Created:** [August 31, 2023, 8:12pm UTC](https://forum.arduino.cc/t/play-mp3-if-coding-issue/1164115 "2023-08-31T20:12:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dr\_jenkins](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dr\_jenkins](https://forum.arduino.cc/u/dr_jenkins)\
**Post date:** [August 31, 2023, 8:12pm UTC](https://forum.arduino.cc/t/play-mp3-if-coding-issue/1164115/1 "2023-08-31T20:12:55Z")

</div>

I have been coding some basic programs to help a friend build props for an escape room. What I am building now is a countdown that needs to incluse a voice sound that is trigerred at given points in time (for instance, reads 001.mp3 if minutes = 5). I bought an mp3 module (YX5300) but all i have been finding are very long codes to build an MP3 player with complex functions all of which are also associated with pressing buttons rather than playing sound automatically when a condition is met. Is there a simpler way to just include the library of the MP3 player and have very basic commands such as "play file"?

---

<div class="post-metadata">

**Author:** ![Paul\_KD7HB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_kd7hb/32/1127958_2.png) [@Paul\_KD7HB](https://forum.arduino.cc/u/Paul_KD7HB)\
**Post date:** [August 31, 2023, 8:29pm UTC](https://forum.arduino.cc/t/play-mp3-if-coding-issue/1164115/2 "2023-08-31T20:29:49Z")

</div>

> [@dr\_jenkins](#):
>
> pressing buttons rather than playing sound automatically when a condition is met.

Replace the button testing code with your condition test and you are ready to test.

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [August 31, 2023, 9:31pm UTC](https://forum.arduino.cc/t/play-mp3-if-coding-issue/1164115/3 "2023-08-31T21:31:06Z")

</div>

wouldn't this library work for you?

> **[GitHub - salvadorrueda/SerialMP3Player: Arduino Library for Serial MP3 Player ...](https://github.com/salvadorrueda/SerialMP3Player/tree/master)**
>
> master

or that one?

> **[GitHub - MajicDesigns/MD\_YX5300: Library for Serial MP3 Player based on...](https://github.com/MajicDesigns/MD_YX5300)**
>
> Library for Serial MP3 Player based on YX5300 IC (Catalex Module) - GitHub - MajicDesigns/MD\_YX5300: Library for Serial MP3 Player based on YX5300 IC (Catalex Module)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [February 27, 2024, 9:31pm UTC](https://forum.arduino.cc/t/play-mp3-if-coding-issue/1164115/4 "2024-02-27T21:31:14Z")

</div>

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