Skip to main content
Associate
July 23, 2024
Solved

How To Play Digitally Generated Sine Wave

  • July 23, 2024
  • 2 replies
  • 2911 views

I just finish a TouchGFX code to generate an adjustable sine wave. I am planning to make 3 of them to mix them and play chords but there is a problem: how can i play a function that generated in STM32 on the speakers of that STM32?

I would be so glad to any help from you all.

    Best answer by mƎALLEm

    Hello,


    @Nhyrane wrote:

    I work with STM32F746G-Disco board. It has stereo output (two jacks). I just want to direct my signal to stereo but I don't know how to do it.


    In that case, you need to use the audio codec on the board.

    SofLit_0-1721809126874.png

    And its BSP driver from the link: 

    https://github.com/STMicroelectronics/32f746gdiscovery-bsp/blob/64c20f758a907cd873e368502cf16e498934d0ec/stm32746g_discovery_audio.c

    And refer to the audio example:

    https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32746G-Discovery/Applications/Audio/Audio_playback_and_record

     

     

    2 replies

    Andrew Neil
    Super User
    July 23, 2024

    PWM ?

    DAC ?

     

    A speaker would likely also require an amplifier/driver of some sort ...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    TDK
    July 23, 2024

    Broadly speaking, you would send them to the speaker. Does your board have a speaker? What hardware are you working with?

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    NhyraneAuthor
    Associate
    July 24, 2024

    I work with STM32F746G-Disco board. It has stereo output (two jacks). I just want to direct my signal to stereo but I don't know how to do it.

    mƎALLEm
    mƎALLEmBest answer
    ST Technical Moderator
    July 24, 2024

    Hello,


    @Nhyrane wrote:

    I work with STM32F746G-Disco board. It has stereo output (two jacks). I just want to direct my signal to stereo but I don't know how to do it.


    In that case, you need to use the audio codec on the board.

    SofLit_0-1721809126874.png

    And its BSP driver from the link: 

    https://github.com/STMicroelectronics/32f746gdiscovery-bsp/blob/64c20f758a907cd873e368502cf16e498934d0ec/stm32746g_discovery_audio.c

    And refer to the audio example:

    https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects/STM32746G-Discovery/Applications/Audio/Audio_playback_and_record

     

     

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.