您尚未登录。

楼主 #1 2017-10-12 10:15:22

陆闻天
会员
注册时间: 2017-10-12
已发帖子: 34
积分: 34

请问ESP32解码mp3有什么合适方案?

最近公司想做一款类似儿童早教机的产品,
请大家不吝推荐

离线

#2 2017-10-12 10:23:53

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 请问ESP32解码mp3有什么合适方案?

软解或者加超贵的vs1053





在线

楼主 #3 2017-10-12 10:37:26

陆闻天
会员
注册时间: 2017-10-12
已发帖子: 34
积分: 34

Re: 请问ESP32解码mp3有什么合适方案?

晕哥 说:

软解或者加超贵的vs1053

那有mp3解码库推荐吗?

离线

#4 2017-10-12 10:39:52

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 请问ESP32解码mp3有什么合适方案?

https://www.helixcommunity.org/projects/datatype/mp3dec

fixed-point

试一试这个:

Memory Usage
ROM = 13446 Bytes (const globals)
RAM = 23816 Bytes (heap)
Total Data Memory = 37262 Bytes
Code Size = 21000 Bytes (approximately - depends on compiler)





在线

楼主 #5 2017-10-12 10:50:50

陆闻天
会员
注册时间: 2017-10-12
已发帖子: 34
积分: 34

Re: 请问ESP32解码mp3有什么合适方案?

可以先在Windows下用电脑编译试一试, 毕竟MSVC调试更方便。

离线

#6 2017-10-12 17:17:56

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 请问ESP32解码mp3有什么合适方案?

陆闻天 说:

可以先在Windows下用电脑编译试一试, 毕竟MSVC调试更方便。

搞定mp3解码, 抄的, 编译环境MSVC2015, 有需要的拿去用吧.

#define READBUF_SIZE 4000
char readBuf[READBUF_SIZE];
short output[READBUF_SIZE*10];

int main()
{
    HMP3Decoder hMP3Decoder;
    MP3FrameInfo mp3FrameInfo;
    hMP3Decoder = MP3InitDecoder();
    if (hMP3Decoder == 0)
    {
        // This means the memory allocation failed. This typically happens if there is not
        // enough heap memory. Recompile the code with additional heap memory.
        while (1);
    }

    char* input = &readBuf[0];

    FILE* mp3File = fopen("d:\\tkzc.mp3", "rb");


    /* Reset counters */
    int bytesLeft = 0;
    int outOfData = 0;
    char* readPtr = readBuf;

    int br = fread(readBuf, 1, READBUF_SIZE, mp3File);
    bytesLeft += br;

    if ((br <= 0)) return -1;

    while (1)
    {
        /* find start of next MP3 frame - assume EOF if no sync found */
        int offset = MP3FindSyncWord(readPtr, bytesLeft);
        if (offset < 0)
        {
            outOfData = 1;
            break;
        }
        else
        {
            readPtr += offset;                         //data start point
            bytesLeft -= offset;                 //in buffer
            int errs = MP3Decode(hMP3Decoder, &readPtr, &bytesLeft, output, 0);

            if (bytesLeft < READBUF_SIZE)
            {
                memmove(readBuf, readPtr, bytesLeft);
                int br = fread(readBuf + bytesLeft, 1, READBUF_SIZE - bytesLeft, mp3File);
                if ((br <= 0)) break;

                if (br < READBUF_SIZE - bytesLeft)
                    memset(readBuf + bytesLeft + br, 0, READBUF_SIZE - bytesLeft - br);
                bytesLeft = READBUF_SIZE;
                readPtr = readBuf;
            }

            MP3GetLastFrameInfo(hMP3Decoder, &mp3FrameInfo);
        }
    }
    fclose(mp3File);

}





在线

#7 2017-10-13 21:02:50

沉鱼
管理员
注册时间: 2017-09-06
已发帖子: 161
积分: 161

Re: 请问ESP32解码mp3有什么合适方案?

好帖好帖,软解码mp3有着落了

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn