# 14. 播放MP3

在[OpenCatEsp32](https://github.com/PetoiCamp/OpenCatEsp32)/ModuleTests文件目录中有一个名为testMP3的示例程序，该程序主要功能是播放存储在SPIFFS文件系统中的.mp3文件。用户可以通过在串口监视器中输入0\~6数字（.mp3文件序号）来选择播放不同的.mp3文件。

在编译程序之前，请先[下载安装并配置软件环境](https://docs.petoi.com/v/chinese/kuai-su-shang-shou-zhi-nan#3.2.1-zhun-bei-esp32-kai-fa-huan-jing) （[Arduino IDE 1.8.\*](https://www.arduino.cc/en/software), 开发板 esp32 2.0\*, 库 [ESP8266Audio 1.9.7](https://www.arduino.cc/reference/en/libraries/esp8266audio/)， [分区配置 BiBoard V0](https://docs.petoi.com/v/chinese/li-cheng/13.arduino-ide-zeng-jia-ying-jian-fen-qu-pei-zhi-xuan-xiang) ）。

编译完成后，使用最新的SPIFFS文件上传插件，上传.mp3文件到BiBoard的SPIFFS文件系统分区中，具体方法请参考[文件系统SPIFFS章节](https://docs.petoi.com/v/chinese/li-cheng/12.-wen-jian-xi-tong-spiffs)

{% hint style="info" %}
注意：

* Arduino IDE 2.0 版本目前无法增加 large\_spiffs\_16MB （4.5MB APP with OTA/6.93MB SPIFFS）配置选项。
* Arduino IDE 1.8.\* 中[SPIFFS文件上传插件](https://github.com/me-no-dev/arduino-esp32fs-plugin/releases/tag/1.0)是用 Java 编写的。 而 Arduino IDE 2.0 是用不同的语言编写的（TypeScript + Golang），因此之前的上传插件不能在Arduino IDE 2.0 中使用。目前还没有支持Arduino IDE 2.0 SPIFFS文件上传插件。

因此建议您暂时安装使用 Arduino IDE 1.8.\* 版本软件上传BiBoard程序及.mp3文件。

当然，你也可以使用VS Code + PlatformIO 上传BiBoard程序及.mp3文件，详情请参考以下文档：

[Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)](https://randomnerdtutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/#2)

[ESP32 with VS Code and PlatformIO: Upload Files to Filesystem (SPIFFS)](https://randomnerdtutorials.com/esp32-vs-code-platformio-spiffs/)

在上传程序和.mp3文件之前，请将data文件夹移动到项目根目录下，代码文件存放在src目录下，并在项目根目录下platformio.ini文件中配置分区选项 board\_build.partitions，如下图所示：

![](/files/BVDcJ6d3uJkEp3gevpFg)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/chinese/biboard/li-cheng/14.-bo-fang-mp3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
