Add support for playing back Opus files #5

Open Jookia opened this issue on 19 Mar 2023 - 0 comments

@Jookia Jookia commented on 19 Mar 2023

This is kind of a complicated goal but includes building Opusfile, Ogg, Opus in to Mbed, reading Opus files from the storage, and playing them.

Mbed doesn't provide an audio interface driver so we will have to probably reference https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32F769I-Discovery/Examples/SAI/SAI_AudioPlay and https://github.com/STMicroelectronics/STM32CubeF7/blob/master/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_audio.c

The theory looks simple:

  • Initialize the SAI clock
  • Initialize the SAI peripheral
  • Initialize the SAI pins
  • Initialize the audio codec (what clock/regulator does this use?)
  • Initialize DMA with an audio buffer
  • Feed the buffer as needed

Mbed provides the HAL for the SAI, but we will need to lift the audio layer from the BSP and audio codec driver.

This has been kind of done here: https://os.mbed.com/teams/ST/code/BSP_DISCO_F769NI/ We should try these examples: https://os.mbed.com/teams/ST/code/DISCO-F769NI_AUDIO_demo/

These two fixes to the BSP code are also good hints for us if we decide to copy the BSP code ourselves:

https://os.mbed.com/teams/ST/code/BSP_DISCO_F769NI//rev/60b59d223214/

https://os.mbed.com/teams/ST/code/BSP_DISCO_F769NI//rev/39d2c2c79afa/

I vaguely recall that I have some code laying around for playing a sine wave from the board's audio so I might dredge that up.

Labels

Priority
default
Milestone
No milestone
Assignee
No one assigned
1 participant
@Jookia