Friday, March 11, 2022

Steady Music Work, 24-Bit Wav Conversion

Two steady days of music work, too slow, achingly slow to finish things, yet, this project has now accrued about 17 minutes of music.

The Unremembered song is blues, a trawl sort of song, which isn't something I usually create. It's rare for me now to include drums throughout a track; they can easily kill emotion... and the shape and structure of the song itself it rather drone-like, which I don't like, but it is good to try different things. This song does lend itself to guitar and improvisation, but that makes it time consuming to create.

I played a few variations on the main theme last night and will include these, so with the main 'adagio' this makes for three short pieces dominated by live synth performances. All were recorded live in one take, but two were recorded as a MIDI sequence, which I prefer, to have a backup and the option of editing (in these cases, no editing took place). The other track is only a 24-bit wav recording, so today I added a feature in Prometheus to import 24-bit wav files.

For my 24-bit wav to float conversion I've used this code (with the three least significant bytes of long 'sample' as the input):

    double doublesample;
// Make the 24-bit value negative
    if (sample&0x800000)
        sample|=0xff800000;
// Convert
    if (sample>=0)
        doublesample=(double)(sample)/8388607.0;
    else
        doublesample=(double)(sample)/8388608.0;
    return(float)doublesample;

A 24-bit number can vary from -8388608 to +8388607, as my code indicates, but there is some disagreement whether audio software does or should use simply use 8388607 for reasons of symmetry. The MODX, and Sony Sound Forge, seem to export waves in the full range (so does touch on -8388608). That seems more logical to me, even if it means very slightly higher resolution for negative values than positive. Sacrificing that resolution merely for neatness seems silly. I used a double just in case it led to more accuracy with these big divisions, but it is probably not necessary.

The conversion coding took longer than expected.

I had a sleepless and anxious night with many strange dreams and fevers, and awoke feeling battered and exhausted. As such, less work was done today than I had hoped. I'll fight on with The Unremembered and try to make more tracks for this project; choosing the best, the most different. I've already pushed some boundaries. I must finish, finish. I hate these slow trawls, but my music is now becoming like a painting made with tiny brushes.