RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Alsa audio to GPIO LED equaliser

    Scheduled Pinned Locked Moved General Discussion and Gaming
    gpioledpcbxmastree
    3 Posts 2 Posters 1.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • herb_fargusH
      herb_fargus administrators
      last edited by

      I got a 3d Xmas tree pcb with a bunch of programmable LEDs from the pihut that are controlled over GPIO.

      I thought it would be cool to have a python script that reads the audio stream of my gameplay and lights up the tree in time with the music.

      I've read a little bit into it and I'm thinking I'll have to use an alsa loopback driver and ideally want to use hardware accelerated fft that makes use of the gpu to improve fast Fourier transformation speed.

      I've seen lots of examples that use windowed environments, bloated packages, etc. In trying to do it direct/low level as possible where I can just run it from the terminal.

      Audio >>> python>>>FFT>>GPIO

      I'm still in the brainstorming phase but if anyone has ideas/suggestions I'm open to them

      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

      1 Reply Last reply Reply Quote 0
      • Z
        Zigurana
        last edited by

        I think if you do not need great temporal and spectral resolution, then the performance of the fft is not going to be your bottleneck.
        I mean, we are talking about maybe an update every 200ms, and how many leds, 25?

        But it is a cool idea! Please keep us updated!

        If tetris has thought me anything, it's that errors pile up and that accomplishments dissappear.

        1 Reply Last reply Reply Quote 0
        • herb_fargusH
          herb_fargus administrators
          last edited by

          I think the first step would be to test if I can capture audio natively before I pass it through to GPIO.

          I've narrowed it down to wanting to use the alsa sound driver. I want to be able to hear the sound from my speakers while it's being captured which is looking like I'll need to use a loopback device. Eg snd-aloop

          I'll update this post when I have more details but I've gotten so far as sorting dependencies and just need the proper configs for /etc/.asound.conf

          If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

          Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

          1 Reply Last reply Reply Quote 1
          • First post
            Last post

          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.