Saturday, May 13, 2023

A Music Jukebox with 4k Visualization

Update 7/7/23

I have a server PC that runs Jellyfin to send video to the Nvidia Shield TV Pro connected to my TV and runs the Logitech Media Server to send music to my Squeezeboxes and to the sound bar connected to the TV. I recently realized I could just run Squeezeplay, a software player that plays music streamed from the Squeezebox server, on the Jukebox PC directly, so I don't really need another music player on the Jukebox PC running MilkDrop 3, and I don't need to store any music files on that PC. Control is still a little wonky- I can select music and playlists using my phone or any computer on my network, but I still have to manually start Squeezeplay and MilkDrop with a keyboard/touchpad connected to the Jukebox PC.

Now back to the original post:

I recently got a wonderful LG C2 77" 4k OLED TV to replace my 15 year old, 52" Sony TV, and it got me thinking about a project that I've had in mind for a few years. I've always liked music visualizers that generate trippy graphics in sync with music, such as the MilkDrop visualizer in WinAmp (remember WinAmp?). There are other visualizers, but none that I have seen (and I think I've seen them all!) that compare to MilkDrop. Someone has updated both WinAmp and the MilkDrop visualizer packaged with it in a program called Wacup that you can DL here

I decided to try out Wacup on my 9 year old ThinkPad W530 laptop that I use as a desktop machine for CAD, etc. That computer has an Nvidia Quadro K1000M graphics card with 2 GB of dedicated RAM. First I tested it on the QHD (2k) display on my desk and results were pretty good. It was able to drive the monitor full screen at 2k resolution and 60 fps for many presets, though some bogged down or failed outright. Next I tested it on the TV at 4k resolution. I bought a mini DVI to HDMI cable via and hooked it up. The result was pretty good, but many of the presets slowed down or failed and the screen went blank, something I attributed to the relatively low power of the graphics board in the laptop.

A little later I found that someone had rewritten MilkDrop as a stand alone program (MilkDrop 3) that will sync trippy visuals to any audio in the computer, and added a lot of new capability to it in the process. I'm not a huge fan of the WinAmp UI, and wanted to try the added features in MilkDrop 3 so I installed it and used VLC for further tests.

When MilkDrop 3 ran on my ThinkPad, the Windows task manager showed that only one processor of the i7 CPU in the laptop was operating at 20% while the GPU was getting slammed (>80%) by many of the presets. So I knew that I needed to focus on the GPU and started a survey of low cost graphics cards to see what kind of PC I could build for as low cost as possible to get 4k at 60 fps.

This posed a problem. How do you know what sort of graphic card specs you need to display the visualizations at 4k and 60 fps? I was posting questions about graphics card capabilities in an online forum and someone suggested that running MilkDrop at 4k resolution was pointless because nothing stays on the screen long enough to see that level of detail. Spoiler alert: now that it is working, I'd say that was wrong. There is a lot of very fine detail in many of the presets that looks great either close to the screen or from far away. I guessed that a card with maybe 10x the performance of the Quadro should do the job, so I started looking for card model numbers that would do that in order to get some idea of what a card would cost.

Along the way I found some interesting videos on youtube showing how to connect a gaming type graphics card to a small form factor PC, like this one: 

The GTX 1650 card in the video was about $180 new, and its performance seems to be 10-12x that of the Quadro, so I thought it might be a good one to try. I started pricing everything out and quickly came up to about $450-500 to build a PC to do the job, but thought it would look pretty bad when it was done (like the one in the video above, though it will probably be hiding inside a cabinet under the TV). That seemed like a little too much to spend to end up with an unsightly mess.

I was about to shelve the idea and wait for technology to catch up (i.e. get cheaper) when I saw a deal on a refurb HP desktop PC from woot! that had an i7 6700 CPU, 16 GB of RAM, and most importantly, came with an Nvidia GTX1660 Super graphics card (6GB of DDR6 RAM) for $439.

The GTX1660 S card has about 20x the processing power of the Quadro K1000M, and 6GB (3x the Quadro) of much faster DDR6 RAM, so I assumed plenty of juice to run MilkDrop visualizations at 4k 60 fps without too many problems. I suspect the cheaper GTX1650 has sufficient horsepower to do the job, but didn't get a chance to test it. If anyone has any lower end graphics cards to share I'll be happy to test them and report the results.

Initial Tests

After setting up Windows 10 Pro (already installed on the computer), installing MilkDrop 3, copying some music files to the HDD, and installing the latest gaming driver for the graphics card, I connected it to the TV and tested it with VLC playing the music.

I am happy to report it works very well! Visuals are detailed, super smooth at 4k resolution and 60 fps, and respond well to the beat of the music with hundreds of presets tested. There are no slow downs or blackouts, and of course, everything looks great on the big OLED display. Audio gets sent to the TV via HDMI from the computer, and from the TV to the sound bar via the eARC HDMI connection. The visuals sync with the music very well in this arrangement.

Running full screen at 4k resolution and 60 fps, CPU use is minimum- I've seen it go as high as 15%, so you might be able to use a much lower spec CPU, and the GPU rarely gets above 40% utilization. This report is generated by GeForce Experience, installed along with the gaming driver for the graphics card.

MilkDrop reports the name of the preset and frame rate when you hit the F3 and F4 keys. At 4k full screen I've never seen the frame rate drop below 58 fps on any preset.

One thing that concerned me about the GTX1660 S graphics card was the big fan on the GPU heatsink. I was afraid it might be pretty noisy. So far, it has been super quiet, even after hours of continuous operation.

During initial tests I ran into a few problems- every few minutes, for no apparent reason, the audio would drop out for a fraction of a second, and after about 10 minutes or so the TV would go black and the audio would switch to the computer's internal speaker. 

Win 10 defaults to turning off the display after 10 minutes without mouse or keyboard input. That's an easy fix- go to settings>power and battery>display and set the screen to blank "never". That fixed the black screen and audio switching to the PC's internal speaker.

I switched to the Groove Music program that comes with Win 10, and found it worked without dropouts. There's probably some setting in VLC that can fix the dropout problem. I will probably try out a few other music players to find the one that has a UI that I like, and performs well without dropouts.

I shut off all the audible notifications in windows so none of those noises happen while I'm listening to music. I also bumped up the size of the text and mouse cursor on the screen so I could operate the computer from the couch.

Controlling it

I needed a convenient way to select music to play, construct playlists, and start and stop them from my couch without having to have a keyboard and mouse plugged into the computer. For now I'm using Groove Music player to play the music stored on and selected from a local HDD in the computer (it came with a 3TB drive), and using a miniature Bluetooth keyboard/trackpad that doesn't seem to work very reliably, so I'm going to look for something else to use.

Mini Bluetooth keyboard/trackpad that sort of works, but not very reliably.

I use a Logitech MX Keys Mini Bluetooth keyboard at my desk computer that is just about 100% reliable. I'll may just add a Bluetooth mouse and take it to the couch when I'm setting up the music and visuals, or since I need my laptop to control Arrakis, maybe I'll set up remote desktop with the music/visuals computer and use that for the ultimate remote control.

More Presets

MilkDrop 3 comes with 500 presets when you download it. 

500 not enough? You can download 9,795 more presets here.

10,295 not enough? You can download 48,000 presets here (includes the 9,795 above).

You can find instructions for creating your own presets here. At first look it doesn't seem easy- it may take some study and experimentation.

One thing I found is that a lot of the presets include some very bright, flashing lights and colors that can be a strain to look at for even a few seconds (and possibly cause epileptic seizures in susceptible people). I am going to start going through the thousands of presets and see if I can create a bundle of them that do not flash that way. Watch this post for a link to them as I get going on it.

I have also noticed that some of the presets don't seem to have any beat detection at all and just do their own thing. I'll try to separate those from all the others. MilkDrop will run without any audio input and still make some very nice patterns to watch.

Here's what some of the double-presets look like in MilkDrop 3:

Friday, May 12, 2023

Bicycle Disc Brake Pad Sanding Tool

Those of you with bikes that have disc brakes know that sooner or later, they are going to start squealing. In my experience, besides being annoying as hell, when they are squealing, they aren't stopping the bike very well, so you really need to stop them from squealing. 

One common maintenance step to relieve squealing is to sand the pads. This can be tricky to do without sanding the skin off your finger tips because the pads are small and thin. I decided to make a tool that would make it easier to sand the pads without hurting my fingers.

The tool is 3D printed, of course, and holds two pads for easy sanding without injury. I designed it to fit the Shimano type pads that fit my bike's brakes, but a similar design should work for any type pad. Just set a sheet of sandpaper on a smooth, flat surface, set the pads on the sand paper, position the tool over them, and have at it. The pads fit into 2.5 mm deep recesses and are held captive in the tool as long as you are applying downward pressure on the tool.

It was about a 10 minute design in Fusion360. First I modeled one of the pads, measuring everything to within 0.1 mm using a caliper. Then I created the tool:

The tool, printed in PETG, 1 mm line width, 0.5 mm layers, 25% triangular infill. It took about an hour to print at 30mm/sec.

The tool with a couple used, squealy brake pads ready to sand.

The tool and pads after sanding (and a rinse in 91% IPA), ready to go back on the bike and provide a couple more weeks (!) of squeal-free braking.

The CAD file (STEP) is here.