[β οΈ JOURNEY] Building MP3 AI Manager for Music Hoarders (Day 17)
Day 17
Hours worked/Total: 4.5/30
Day Recap
Faced several challenges while working on audio playback and waveform visualization. Learned how to handle blocking UI issues with multithreading and made some progress with basic waveform generation, though the results are far from ideal.
What I Did
- Loading MP3 into memory:
- Tried to preload the MP3 file into memory to avoid HDD warm-up delays but discovered that NAudio only supports playback directly from a file path. Decided to pause this effort for now.
- UI blocking issue:
- Encountered a problem where synchronous functions were freezing the UI.
- Learned about Task.Run in C# for executing functions on a separate thread, similar to goroutines in Golang - Great to know this for future performance optimizations!
- Adding a waveform:
- Discovered that NAudio doesn’t support built-in waveform generation.
- Integrated a third-party plugin for waveform visualization with some caveats.
- Waveform generation takes a few seconds.
- The resulting image is static, with no ability to skip through the track using the cursor.
- The colors and design are ugly af.
- Extracting MP3 metadata:
- Started exploring how to retrieve metadata.
- Found that default options in NAudio are limited to the file path and name. Extracting other details like meta tags requires additional libraries or custom solutions.
Remarks
This was a mixed day. Waveform rendering feels like a letdown compared to those you see in professional DJ softwares. Multithreading is a game-changer, and learning to offload blocking operations to a separate thread will be handy.
Next Goals
Make waveform better looking.