• esp-adf音频框架


    ESP-ADF 在 ESP-IDF(乐鑫物联网开发框架,广泛运用于 ESP32 的 SDK)的基础上开发而成的一套音频开发框架。

    Audio Element

    audio_element对象是esp-adf开发套件的基本对象。每个解码器、编码器、滤波器、输入流、输出流均可以当成一个audio_element音频元素。
    元素的一般功能是获取输入的一些数据,对其进行处理,然后输出到下一个。每个元素都可以当作一个独立的任务运行,为了能够控制从输入到输出的整个生命周期的特定阶段,audio_element对象提供了回调函数,可以在每个阶段进行触发。回调函数的类型主要有7种:open(打开), seek(查找)、 process(处理)、 close(关闭)、 destroy(销毁)、 read(读取)、 write(写入);它们被定义在在audio_element_cfg_t。

    /**
     * @brief Audio Element configurations.
     *        Each Element at startup will be a self-running task.
     *        These tasks will execute the callback open -> [loop: read -> process -> write] -> close.
     *        These callback functions are provided by the user corresponding to this configuration.
     *
     */
    typedef struct {
        el_io_func          open;             /*!< Open callback function */
        ctrl_func           seek;             /*!< Seek callback function */
        process_func        process;          /*!< Process callback function */
        el_io_func          close;            /*!< Close callback function */
        el_io_func          destroy;          /*!< Destroy callback function */
        stream_func         read;             /*!< Read callback function */
        stream_func         write;            /*!< Write callback function */
        int                 buffer_len;       /*!< Buffer length use for an Element */
        int                 task_stack;       /*!< Element task stack */
        int                 task_prio;        /*!< Element task priority (based on freeRTOS priority) */
        int                 task_core;        /*!< Element task running in core (0 or 1) */
        int                 out_rb_size;      /*!< Output ringbuffer size */
        void                *data;            /*!< User context */
        const char          *tag;             /*!< Element tag */
        bool                stack_in_ext;     /*!< Try to allocate stack in external memory */
        int                 multi_in_rb_num;  /*!< The number of multiple input ringbuffer */
        int                 multi_out_rb_num; /*!< The number of multiple output ringbuffer */
    } audio_element_cfg_t;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    文件位置
    esp-adf\components\audio_pipeline\include\audio_element.h
    esp-adf\components\audio_pipeline\audio_element.c

    Audio Pipeline

    audio_pipeline是实现一系列audio_element音频元素对象的动态组合。开发者不需要对每个audio_element音频元素对象进行单独处理,只需处理一个audio_pipeline。每个audio_element音频元素对象都由一个ringbuffer连接。audio_pipeline还负责将消息从元素任务转发到应用程序。一个典型的处理流程如图所示。
    在这里插入图片描述将文件读取流、解码器、I2S流添加进audio_pipeline音频管道,解码器的输入是MP3文件数据流,I2S流将解码后的音频数据输出到片外,各应用程序之间通过事件接口通信。

    文件位置
    esp-adf\components\audio_pipeline\include\audio_pipeline.h
    esp-adf\components\audio_pipeline\audio_pipeline.c

    Audio Event Interface

    ADF提供事件接口API来建立audio_pipeline管道中audio_element音频元素之间的通信。事件接口API是围绕FreeRTOS队列构建的,通过“监听器”来监视传入的消息并通过回调函数通知它们。

    文件位置
    esp-adf\components\audio_pipeline\include\audio_event_iface.h
    esp-adf\components\audio_pipeline\audio_event_iface.c

  • 相关阅读:
    SaaS vs 低代码,谁在成为中国产业服务的楔子?
    对于分辨率很高的图片(1205*1205)使用什么样的深度学习模型对其进行回归预测更准确高效一点
    java(HashMap类和Hashtable类)
    【模型压缩】Distiller学习-初认识
    torch.stack() & torch.repeat() & torch.repeat_interleave() & torch转置 详解
    【资源分享】官网imagent下载太慢?完整train、test、val资源分享
    【安鸾靶场】cmseasy&内网渗透 (500分)
    Android  JetPack~ LiveData (一)   介绍与使用
    0基础学习VR全景平台篇 第95篇:VR实景智慧导航操作手册
    香橙派OrangePi AIpro,助力国产AIoT迈向新的台阶!
  • 原文地址:https://blog.csdn.net/liang_zhaocong/article/details/127401893