I’ve always been a little afraid to get my hands dirty with graphics in Xojo but it really is quite capable!
Because I know there will be some questions… I’m getting the audio data from BASS. For the visualizers I get the realtime levels during playback, it does the FFT calculations into a memoryblock and gives me back a bunch of amplitude values to paint as a spectrum.
For the editor, I map each pixel to a time span then read the arrays for the audio that I’ve precomputed at file open to get the min/max amplitude for that time slice. I do two DrawLines in two different colors to give it the two-tone look.
Atop the waveforms I draw rulers, scrollbars, the volume envelope / points, the playback indicator, the ruler playheads (some of these are drawn twice in order to create a shadow), the border, and then any of the system overlays that I’ve put in, like a custom MessageBox or a “grayed out” overlay.
I handle the MouseDown events and map any potential interactions with the virtual positions of all the elements that I’m keeping track of based on the zoom level and scroll position (which are both virtual).
I was pleasantly surprised at how fast it all runs. This is on an M5 Max though.
Dunno if this is going to be cross-platform at all but it’s worth testing on Windows and Linux to see the differences. It’s been a while since I’ve done something like this in Windows (and never in Linux) but there was a considerable difference in how they performed.
Why ? Slicing recordings to split tracks (eg a vinyl LP with say 6 tracks which was ripped to a single .MP3), or extract sound effects or ring tones.
Been there done that with (I think) it was Audacity back in the days of “Rip, Mix & Burn”. I ripped my entire vinyl LP collection - several hundred disks. And made some great ring-tones
On the topic of digitizing vinyl, if anyone near Rochester, NY is willing to help, I can trade development services I have some rare DJ promos, but I don’t have the tools and as a CD generation kid, I’m afraid to damage the discs. I asked the local record shop, but they didn’t know of any local services that digitize vinyl.
I’m in LA so not of any use to you locally but I’ve been a DJ for over 30 years so this is right up my alley. It’s really easier than it seems. You can pick up a USB turntable from Amazon, Audio-Technica makes a good one. It comes with a pretty decent cartridge and stylus (needle) that won’t damage your vinyl (other than the minute damage that occurs on every play). You basically play the record and record it into a computer, then chop up the recordings into the individual tracks. I’d recommend recording at 44.1 KHz Stereo, saving to WAV, FLAC or AAC if you must go lossy. MP3 is “fine” as long as you’re using 320 kbps encoding, unless you’re a massive audiophile in which case stick with FLAC. For software you can use Audacity (but be aware their ownership has changed recently and is not without controversy). Adobe Audition is a solid choice if you have the Adobe Suite. There are good indy options too: on Mac, WavePad… for Windows I like Goldwave.
If you decide to take this on feel free to DM me for help.
We use iZotope RX (currently version 12) and Ozone Advanced (also version 12) in our studio on a daily basis.
In my opinion based on 35+ years of studio and mastering experience, iZotope RX is one of the best tools available for audio restoration. If you only need it to transfer a few LPs or 12-inch records to digital, you can download the free 2-week trial which should be more than enough for your needs. With Ozone you can take things a step further by even remastering your recordings to today standards (read: making it sound loud ;-). Its intelligent processing tools make it possible to achieve excellent results even if you have little or no mastering experience.
Seems to run equally well on Windows, but I have a fairly powerful machine. One thing I’ve noticed, especially for the methods that modify audio in memory to write to disk, there’s a MASSIVE speed boost when compiling a regular app versus running in the IDE. I don’t think I’ve ever been more keenly aware of how much the IDE slows you down. You also get a measurable performance boost using aggressive compiler optimization.
I’m also developing audio software, but something completely different: it’s software to play audio based on your private mp3/FLAC/etc. collection. I would also like to add more functionality where this BASS software would really come in handy, like automatic volume adjustment based on loudness of a track and a VU meter.
I would really like to know more about your experience with the BASS software: is it easy to integrate into a Xojo application? My software is not commercial, so it seems free to use then.
BASS would be perfect for your use case. Once you set up the declares it’s fairly easy to use.
For something like automatic volume adjustment, there are a few ways to interpret that. It could mean normalization to preserve dynamic range, or dynamic volume adjustment via a few different algorithms. Of course you can implement your own algorithm manually, but BASS_FX comes with a few built in, like BASS_FX_BFX_DAMP or BASSLOUD. Using an external VST plugin is also a possibility.
As for a VU Meter, you periodically poll the amplitude of your playback stream via BASS_ChannelGetLevel. Then it’s up to you to draw the VU meter levels yourself in a canvas, as I’ve done in the video above.
Thanks very much for pointing me to BASS! This will be the farthest I’ve pushed Xojo
I never used external libraries before, so that will be a first for me. I have been using ffmpeg up until now from a shell and this way is SO much more elegant and BASS has SO much more to offer! Can’t believe I haven’t found it sooner. As a hobby programmer, getting to work with an external library and how to implement that in Xojo is quite a challenge, but learning to work with online API’s from Discogs and MusicBrainz was a challenge I conquered too, so this will be a new adventure and I have ChatGPT on my side (great help!)
I read the BASS specifications and I found stuff in there that I have been looking for since 2021 when I started working on my Cenobox music project. Automatic volume adjustments, reading MP3 tags, live channel levels, wow a whole world is opening up to me with stuff I could not realize with Xojo before.