- My Forums
- Tiger Rant
- LSU Recruiting
- SEC Rant
- Saints Talk
- Pelicans Talk
- More Sports Board
- Fantasy Sports
- Golf Board
- Soccer Board
- O-T Lounge
- Tech Board
- Home/Garden Board
- Outdoor Board
- Health/Fitness Board
- Movie/TV Board
- Book Board
- Music Board
- Political Talk
- Money Talk
- Fark Board
- Gaming Board
- Travel Board
- Food/Drink Board
- Ticket Exchange
- TD Help Board
Customize My Forums- View All Forums
- Show Left Links
- Topic Sort Options
- Trending Topics
- Recent Topics
- Active Topics
Started By
Message
Posted on 7/9/20 at 2:42 pm to AlxTgr
My status screen came in. Look how cute this fricker is.



Posted on 7/9/20 at 3:07 pm to Korkstand
I had that Pioneer soundbar and really loved it for 3 years. It started acting up right before the flood, and then finally blew the whole power supply in 2017.
I went with an Emotiva DAC and powered studio monitor solution to replace it.
I went with an Emotiva DAC and powered studio monitor solution to replace it.
Posted on 7/9/20 at 9:13 pm to Korkstand
Kork, I have a Yamaha yas-207 and I can say with 100% certainty that mine doesn’t shut off after 10 minutes of no sound. In fact, I wake up the next morning sometimes to find it to still on because my wife didn’t let the firestick remote go through the multiple device shut offs.
Now, “sleep” may be different than a full shut off, but I know I’ve left things paused more than 10 minutes and can come back and play it without repowering the sound bar.
Now, “sleep” may be different than a full shut off, but I know I’ve left things paused more than 10 minutes and can come back and play it without repowering the sound bar.
Posted on 7/9/20 at 9:40 pm to cberni1
I appreciate the help and suggestion, but I'm way too deep into this project now.
Here is the little display powered up and showing a demo volume level. It is not a full color display, but it is 128x64 pixels, and the top two rows (16 pixels tall) are yellow while the rest (the bottom 6 rows or 48 pixels tall) is blue. This works out absolutely perfectly for this use case as a volume indicator. So while I am adjusting the volume it might show the bar plus number as shown, and when I am finished adjusting the number will go away and the bar will remain. In place of the volume number I might show the input source, volume in small font, the unit's ip address, etc or nothing.


Here is the little display powered up and showing a demo volume level. It is not a full color display, but it is 128x64 pixels, and the top two rows (16 pixels tall) are yellow while the rest (the bottom 6 rows or 48 pixels tall) is blue. This works out absolutely perfectly for this use case as a volume indicator. So while I am adjusting the volume it might show the bar plus number as shown, and when I am finished adjusting the number will go away and the bar will remain. In place of the volume number I might show the input source, volume in small font, the unit's ip address, etc or nothing.

Posted on 7/10/20 at 6:12 pm to Korkstand
So at this point I have a functioning sound system for my TV. It takes audio input from the TV aux, then pipes it out to two old satellite speakers than I had via the HiFiBerry Amp2. These speakers are just for testing, and will be replaced shortly. That little display now shows the volume level, and I wired up an IR receiver which takes commands from my Roku remote. I still have quite a few finishing touches to put on it, but so far I am happy.
A few notes about the process:
It was a little tricky getting the display to work with the Amp2 since they both use the I2C pins on the Pi. Just a little configuration issue, not a huge problem.
It took me a while to get the IR receiver to work, mostly because I was reading old documentation. I struggled getting the LIRC package to receive the commands, and the reason turned out to be the newer Pi OS versions have IR support built into the kernel, so LIRC is not only not necessary but it causes problems. I removed it, fixed a few settings, and the Pi started receiving commands from the remote.
How you handle the commands from the remote is up to you, but there is a handy utility called triggerhappy that makes it simple. The OS sees inputs from the IR remote as any other input (like mouse movements, keyboard presses, etc), so you just edit a config file to map the events (in my case KEY_VOLUMEUP, KEY_VOLUMEDOWN, and KEY_MUTE) to arbitrary commands. All I had to do was write little one-liner shell scripts which execute the volume control commands, and map the events to the appropriate scripts.
I wrote a Python script to update the display. There are several Python packages that make drawing on the screen pretty easy. All this script does is constantly loop while checking the volume level and updating the screen if necessary.
I still need to daemonize the display script and the audio output script so that they will run at startup, but that's not a big deal. I also need to make some adjustments to the Python script, because apparently volume % is pretty meaningless. Who knew?
I think I just need to adjust the increment and decrement steps logarithmically, or maybe manually set the full scale of steps until it "feels/sounds good" at a given volume %. And of course I still need to design and print a case.
All in all I'm pretty happy with it. The total package is palm-sized (minus the speakers), it is controllable with the Roku remote for a seamless experience, and the damned thing will never turn off unless I tell it to. I also know every part in it, a lot of the software, and I can upgrade it if I ever feel the need.
My next step will be to research the various audio streaming options in order to expand the system with more Pi's and speakers. And again if anyone is interested, I can post a more detailed how-to here. I might even make a YouTube video.
A few notes about the process:
It was a little tricky getting the display to work with the Amp2 since they both use the I2C pins on the Pi. Just a little configuration issue, not a huge problem.
It took me a while to get the IR receiver to work, mostly because I was reading old documentation. I struggled getting the LIRC package to receive the commands, and the reason turned out to be the newer Pi OS versions have IR support built into the kernel, so LIRC is not only not necessary but it causes problems. I removed it, fixed a few settings, and the Pi started receiving commands from the remote.
How you handle the commands from the remote is up to you, but there is a handy utility called triggerhappy that makes it simple. The OS sees inputs from the IR remote as any other input (like mouse movements, keyboard presses, etc), so you just edit a config file to map the events (in my case KEY_VOLUMEUP, KEY_VOLUMEDOWN, and KEY_MUTE) to arbitrary commands. All I had to do was write little one-liner shell scripts which execute the volume control commands, and map the events to the appropriate scripts.
I wrote a Python script to update the display. There are several Python packages that make drawing on the screen pretty easy. All this script does is constantly loop while checking the volume level and updating the screen if necessary.
I still need to daemonize the display script and the audio output script so that they will run at startup, but that's not a big deal. I also need to make some adjustments to the Python script, because apparently volume % is pretty meaningless. Who knew?

All in all I'm pretty happy with it. The total package is palm-sized (minus the speakers), it is controllable with the Roku remote for a seamless experience, and the damned thing will never turn off unless I tell it to. I also know every part in it, a lot of the software, and I can upgrade it if I ever feel the need.
My next step will be to research the various audio streaming options in order to expand the system with more Pi's and speakers. And again if anyone is interested, I can post a more detailed how-to here. I might even make a YouTube video.
Posted on 7/10/20 at 9:18 pm to Korkstand
Seems like an awful lot of work for something you can buy on Amazon.
My hat is off to you...

My hat is off to you...

Posted on 7/10/20 at 9:28 pm to SSpaniel
quote:It was a lot of work (with more to come), but it's something I enjoy doing and I have learned a lot in the process.
Seems like an awful lot of work for something you can buy on Amazon.
quote:
My hat is off to you...

Posted on 7/15/20 at 4:40 am to Korkstand
Another update for those keeping up:
I have been experimenting with different methods of piping audio around, and my god are there a lot of ways. For those who don't know, at the linux command line you can separate multiple commands with the pipe character | , and the output of one command "pipes" into the next command as input.
I started with the basic audio commands arecord and aplay, piping like arecord | aplay, and it worked! Had to play around with some options to minimize latency, but it seemed like a winner... until a few hours later when it stopped working. Turns out the arecord command has a 32bit counter somewhere in the code which limits how long it will run.
On to ffmpeg, which is an incredible multimedia tool with a mind-boggling number of options. I used the same method of piping ffmpeg (with tons of options) to ffplay, and it worked just like arecord|aplay except without the time limitation. And it worked perfectly... until the next day, when I turned on the TV and the audio was about half a second out of sync with the video. Turns out there was a memory leak somewhere, and it just kept gobbling up memory until the poor little Pi ran out of it.
I didn't bother trying to solve the memory leak issue, because the ultimate goal is to stream the audio over the network, anyway. I looked into JACK, which is an ultra low-latency pro quality audio system, but it seemed complicated. I found a promising little tool simply called trx, but it was developed by just one guy and had little documentation or support.
Then I ran across something I had used before but hadn't thought to use yet, called gstreamer. It's mostly for video streaming, but since it does audio too I gave it a shot. After a few hours of reading the docs and working out how it all fits together, I finally have something that is *almost* perfect! Through a series of plugins it is able to listen to the audio input and then stream it over the network. Any other device on the network can use gstreamer again to listen to the stream and do whatever it wants with the audio. In my case, the Pi is running both commands so it listens to its own stream, and it works just like the other piped commands from before.
I can run the listen command on my laptop and listen there at the same time, too. So that means I can hook up a second Pi (and a third, and a fourth..) to some more speakers (or a sub) and expand this system just like a Sonos system!
It's *almost* perfect. Both the Pi and my laptop are connected via wifi, so there is a slight but consistent and annoying stutter in the audio. I can mostly eliminate it by adding a jitter buffer, but that would create a slight echo effect since they will be out of sync. Without the buffer the audio is perfectly in sync across devices.
So I have a few options. I can hardwire the Pi's and I believe it would work perfectly, but I was really hoping to keep this wireless. I have not tried any sort of QoS stuff or any sort of tuning to reduce latency, so I believe I can improve things in that regard. If that fails, I can set one Pi to AP mode and the rest can connect directly to it, but that would take them off my network so I would have to hardwire the AP mode one or add a USB wifi adapter so that it has two interfaces. That wouldn't be terrible, and I might end up doing that.
Anyway, once I get that stutter sorted out, I will move on to drawing up and printing a case. After that, I'll be able to just image the SD card and put these things together in no time, so if anyone wants one to put together a budget Sonos-like system or just to frick around with, let me know.

I have been experimenting with different methods of piping audio around, and my god are there a lot of ways. For those who don't know, at the linux command line you can separate multiple commands with the pipe character | , and the output of one command "pipes" into the next command as input.
I started with the basic audio commands arecord and aplay, piping like arecord | aplay, and it worked! Had to play around with some options to minimize latency, but it seemed like a winner... until a few hours later when it stopped working. Turns out the arecord command has a 32bit counter somewhere in the code which limits how long it will run.
On to ffmpeg, which is an incredible multimedia tool with a mind-boggling number of options. I used the same method of piping ffmpeg (with tons of options) to ffplay, and it worked just like arecord|aplay except without the time limitation. And it worked perfectly... until the next day, when I turned on the TV and the audio was about half a second out of sync with the video. Turns out there was a memory leak somewhere, and it just kept gobbling up memory until the poor little Pi ran out of it.
I didn't bother trying to solve the memory leak issue, because the ultimate goal is to stream the audio over the network, anyway. I looked into JACK, which is an ultra low-latency pro quality audio system, but it seemed complicated. I found a promising little tool simply called trx, but it was developed by just one guy and had little documentation or support.
Then I ran across something I had used before but hadn't thought to use yet, called gstreamer. It's mostly for video streaming, but since it does audio too I gave it a shot. After a few hours of reading the docs and working out how it all fits together, I finally have something that is *almost* perfect! Through a series of plugins it is able to listen to the audio input and then stream it over the network. Any other device on the network can use gstreamer again to listen to the stream and do whatever it wants with the audio. In my case, the Pi is running both commands so it listens to its own stream, and it works just like the other piped commands from before.
I can run the listen command on my laptop and listen there at the same time, too. So that means I can hook up a second Pi (and a third, and a fourth..) to some more speakers (or a sub) and expand this system just like a Sonos system!
It's *almost* perfect. Both the Pi and my laptop are connected via wifi, so there is a slight but consistent and annoying stutter in the audio. I can mostly eliminate it by adding a jitter buffer, but that would create a slight echo effect since they will be out of sync. Without the buffer the audio is perfectly in sync across devices.
So I have a few options. I can hardwire the Pi's and I believe it would work perfectly, but I was really hoping to keep this wireless. I have not tried any sort of QoS stuff or any sort of tuning to reduce latency, so I believe I can improve things in that regard. If that fails, I can set one Pi to AP mode and the rest can connect directly to it, but that would take them off my network so I would have to hardwire the AP mode one or add a USB wifi adapter so that it has two interfaces. That wouldn't be terrible, and I might end up doing that.
Anyway, once I get that stutter sorted out, I will move on to drawing up and printing a case. After that, I'll be able to just image the SD card and put these things together in no time, so if anyone wants one to put together a budget Sonos-like system or just to frick around with, let me know.

Posted on 7/15/20 at 7:07 am to Korkstand
Since you mess with Pi's you have probably heard of Balena Etcher for flashing images. They have something called Balena Sound which may do something similar to what you are working on. Have you looked at that already?
Posted on 7/15/20 at 8:31 am to HubbaBubba
quote:
Maybe stop buying cheap soundbars? I have for one room an LG Atmos soundbar with sub and wireless rear speakers with up firing Atmos speakers. Exceedingly pleased.
LG SN11RG
From your link:
quote:
But boil it all down, and you’re paying nearly $2,000 for audio. Categorized as a soundbar, it’s objectively great sound. But open the floor to other options, and frankly, there are better ways to spend this kind of money
Holy shite. That's a lot for a sound bar.
Posted on 7/15/20 at 11:00 am to humblepie
quote:Yes, I used Etcher to create the SD card for it and I saw that ad during the "burn" process. I was like wtf are they watching me?
Since you mess with Pi's you have probably heard of Balena Etcher for flashing images. They have something called Balena Sound which may do something similar to what you are working on. Have you looked at that already?

I didn't use it for a couple reasons. The first is it is designed to take input from bluetooth, airplay, or spotify connect. I'm taking input from my TV (or any device with audio out). The second is it is designed to output to the Pi's line out, which means I need an amp anyway. The third is it requires a balenaCloud account for some reason (it's free, but still). However, I wish I had looked into it a bit more at first, because I might be able to use the same bit that they used for the multi-room audio - Snapcast. I might be able to replace gstreamer with that, so thanks for reminding me about it.

Edit: Looking into snapcast a bit more, it looks like it is designed for just playing music. It is great for syncing audio between systems, but it won't work for syncing audio with video. It adds about 500ms lag in order to do the audio sync, and anything more than about 40ms is bad for audio/video sync. This is the source of my current issue with slightly stuttering audio... gstreamer is streaming almost in realtime via RTP/UDP, which is designed for this type of application, but it is subject to packet loss due to having no error correction (there just isn't time for it). It is so close, though, and I'm confident I can get it sorted out.
This post was edited on 7/15/20 at 11:28 am
Posted on 7/15/20 at 12:22 pm to HubbaBubba
quote:I did. Now I'm buying cheap DIY audio gear.
Maybe stop buying cheap soundbars?

quote:Sheesh, for that price I'd be really pissed if it blew a cap.
I have for one room an LG Atmos soundbar with sub and wireless rear speakers with up firing Atmos speakers. Exceedingly pleased.
LG SN11RG

I really love the flexibility of what I've got going on here. For example, I can configure the audio to stream in a way that I can listen via a web browser, which means I can mute the speakers and listen on my phone with earbuds (a lifesaver with young kids in the house). I can set volume limits if I want to, either on a schedule or manually (another lifesaver with young kids

If you can't tell, I'm kind of excited about it. :lol:
Posted on 7/20/20 at 3:18 pm to Korkstand
Yet another update:
I have not been tinkering with it much, other than to simply hardwire the laptop to the switch and test again. This cut ping times down from 3-4ms average to 1.5-3ms. This eliminated the stuttering almost entirely (I didn't notice any stuttering at all actually), so I am certain that connecting a second Pi via wifi direct to the main one (with main Pi wifi in AP mode) will reduce latency further, and it will work perfectly.
Also, there are several places to tune various latencies in the pipeline of gstreamer plugins, so I was able to make the remote speakers (laptop) actually slightly ahead of the main ones, while both were still well within the ~40ms that audio can lag video before it is noticeable. This means that regardless of how many remote speakers I add, or where my viewing position is, I can tune them to all be perfectly in sync. It is also easy to adjust the volume of each node independently, synced together, or any combination of volume ratios to tune things. There are also gstreamer plugins for software crossover filtering to further tune sound quality.
I realize this is a whole lot of trouble for a simple home theater setup, but it's mostly about the learning process now. It's kind of incredible what can be accomplished with cheap hardware and open source software. For example, this type of setup can be easily adapted to a live concert, and the audio tech/engineering can all be accomplished via a tablet app or what have you, to give a visual UI for tuning everything. Multiple audio streams are easily mixed via gstreamer plugins, or via hardware like the Octo sound card, or whatever combination makes sense.
I'm probably the only one who still gives a damn so far, but I'm having fun so frick it.
I have not been tinkering with it much, other than to simply hardwire the laptop to the switch and test again. This cut ping times down from 3-4ms average to 1.5-3ms. This eliminated the stuttering almost entirely (I didn't notice any stuttering at all actually), so I am certain that connecting a second Pi via wifi direct to the main one (with main Pi wifi in AP mode) will reduce latency further, and it will work perfectly.
Also, there are several places to tune various latencies in the pipeline of gstreamer plugins, so I was able to make the remote speakers (laptop) actually slightly ahead of the main ones, while both were still well within the ~40ms that audio can lag video before it is noticeable. This means that regardless of how many remote speakers I add, or where my viewing position is, I can tune them to all be perfectly in sync. It is also easy to adjust the volume of each node independently, synced together, or any combination of volume ratios to tune things. There are also gstreamer plugins for software crossover filtering to further tune sound quality.
I realize this is a whole lot of trouble for a simple home theater setup, but it's mostly about the learning process now. It's kind of incredible what can be accomplished with cheap hardware and open source software. For example, this type of setup can be easily adapted to a live concert, and the audio tech/engineering can all be accomplished via a tablet app or what have you, to give a visual UI for tuning everything. Multiple audio streams are easily mixed via gstreamer plugins, or via hardware like the Octo sound card, or whatever combination makes sense.
I'm probably the only one who still gives a damn so far, but I'm having fun so frick it.

Posted on 7/20/20 at 3:50 pm to Korkstand
quote:
I'm probably the only one who still gives a damn so far, but I'm having fun so frick it.
Keep the updates coming. I just recently started to learn about the electronics of audio while delving into audio-reactive LEDs, and I am interested in building something similar to what you have done/are doing here.
Posted on 7/20/20 at 4:53 pm to guedeaux
I considered doing that using something like this, but I decided that I like the LEDs to match the video rather than audio. I am using another Pi on a different TV to power the DIY Ambilight system like so. It works with any HDMI video source using a splitter so the Pi can "watch" the same video going to the TV and light the LEDs appropriately. But it would be cool to have them react to audio when I'm just playing music.
I still have a lot to learn about the specifics of audio. Like with this cheap USB mic input I'm using, I'm only getting mono from the TV. I will have to get a different USB sound card with RCA audio inputs to get stereo, but that's not a big deal. And I believe to get more channels I will have to go to HDMI audio or optical. I don't think HDMI audio input to the Pi is possible yet, but I can get an optical input card. The issue there is if I go that route, I won't be able to stack the Amp2 HAT that I'm using, and instead I will have to choose a standalone amp card (which might be better and more flexible anyway).
I also don't quite understand some things about pre-amp vs line inputs and outputs, and whether I'm losing audio quality by adjusting volume in software vs hardware, and a few other things. Turns out audio is pretty damned complicated.
I still have a lot to learn about the specifics of audio. Like with this cheap USB mic input I'm using, I'm only getting mono from the TV. I will have to get a different USB sound card with RCA audio inputs to get stereo, but that's not a big deal. And I believe to get more channels I will have to go to HDMI audio or optical. I don't think HDMI audio input to the Pi is possible yet, but I can get an optical input card. The issue there is if I go that route, I won't be able to stack the Amp2 HAT that I'm using, and instead I will have to choose a standalone amp card (which might be better and more flexible anyway).
I also don't quite understand some things about pre-amp vs line inputs and outputs, and whether I'm losing audio quality by adjusting volume in software vs hardware, and a few other things. Turns out audio is pretty damned complicated.

Posted on 7/21/20 at 9:46 am to Korkstand
quote:
I considered doing that using something like this, but I decided that I like the LEDs to match the video rather than audio. I am using another Pi on a different TV to power the DIY Ambilight system like so. It works with any HDMI video source using a splitter so the Pi can "watch" the same video going to the TV and light the LEDs appropriately. But it would be cool to have them react to audio when I'm just playing mu
You can do both. I have hyperion on a pi in my media cabinet sending data to an ESP32 running WLED which controls the LEDs behind the TV. I built a board for the ESP32 to have audio input (a microphone and line-in with a switch to toggle between the inputs). So, I can choose whether to use ambilight or audio-reactive. FYI, WLED is much better than the audio-reactive link you posted, and the ESP32 allows for much better reactivity utilizing FFT instead of just volume, if you decided to jump in that pool.
quote:
I also don't quite understand some things about pre-amp vs line inputs and outputs, and whether I'm losing audio quality by adjusting volume in software vs hardware, and a few other things. Turns out audio is pretty damned complicated.
It is definitely daunting. I am only working with lo-fi audio so far, and I doubt I will be custom-building amps haha
This post was edited on 7/21/20 at 9:47 am
Posted on 7/21/20 at 10:25 am to guedeaux
quote:You've got a better setup than I do, for sure. Back when I did the ambilight, I read about using a Pi + ESP, but since I don't have a media closet for this TV to put the Pi in, I didn't see the need for the ESP since the Pi would be mounted to the TV and could handle the LEDs itself. If I do it again I'll probably go that route, though. (Also I searched for WLED and the link was purple, so evidently I looked into that in the past
You can do both. I have hyperion on a pi in my media cabinet sending data to an ESP32 running WLED which controls the LEDs behind the TV. I built a board for the ESP32 to have audio input (a microphone and line-in with a switch to toggle between the inputs). So, I can choose whether to use ambilight or audio-reactive. FYI, WLED is much better than the audio-reactive link you posted, and the ESP32 allows for much better reactivity utilizing FFT instead of just volume, if you decided to jump in that pool.

quote:I will almost definitely be building an amp in the near future. I did a little bit of searching yesterday, and it looks too easy and too cheap to DIY. Check it.
It is definitely daunting. I am only working with lo-fi audio so far, and I doubt I will be custom-building amps haha
Posted on 7/21/20 at 10:58 am to Korkstand
quote:
I will almost definitely be building an amp in the near future. I did a little bit of searching yesterday, and it looks too easy and too cheap to DIY. Check it.
Damn you!!! LOL
Back to top
