How do I set audio output bit depth, or why can't I?

I just saw the necro this thread thing. I didn’t even realize that was a thing…

One reason to resurrect a thread would to be solving an 8 year old unanswered/unsolved question, thats actionable today.

Now that I know necro-ing is a thing, I honestly can’t find one good reason to close a thread, you might as well delete it at that point. I sincerely don’t understand the reasonings behind that question…

Well anyway i’m gonna try to converting my project to double! WISH ME LUCK BABBY!!!
… (minutes later)
I guess it’s already a feature!

Just for clarification: Do you think 770dB headroom (32-bit float) is not good enough, and pro-audio needs to use 64-bit doubles or even 80-bit long doubles?

Yes it is enough, I love 32 bit, I just prefer mixing in 24 bit so my projects arent’ more than 10 gigs. -144db of headroom isnt to shabby either. I export my final wav to 32 bit floating point for mastering.

I guess thats my question, which is the best variable for development?
Here is my output of sizeof function…I assume outputs bits.

Screen Shot 2022-05-19 at 1.36.31 PM

I sincerely think doubles are better sounding than floats. I don’t know if long doubles are over kill. However, I assume they’re more trouble than they’re worth, at this point in time.

I found this… that is where I am now, converting the process block to doubles. There is a reason analogue summing sounds better than digital summing.

No, you have it wrong. sizeof() returns the number of BYTES needed for storage. You have to multiply all these values by 8.

So a float is 32-bits (not 4), a double is 64-bit (not 8), and a long-double is 128-bit (not 16).

Have you done a double-blind test to verify your assumptions?

And again: have you verified your assumptions with double-blind tests?

When I first started 7 years ago 2 years into my programming journey I made a delay line, then converted it into doubles. Somehow, weeks later it had gotten “cloudy” I found it was back to floats through a failed update. Then I moved it back to doubles and the cloudiness was gone. Ever since then, I believed in the way of the doubles.

Thanks for clearing that up. I knew something wasn’t right. I went to school for audio engineering not CS. To my understanding floats have 7-8 decimals of precision and doubles have 15-16 decimals of precision.

If I were to math mathematically prove this…
I know this might give different answers on different compilers. However the theory remains the same even if you replace the loop for a filter, distortions, sin harmonic, summing two buffers. It is 1000-100,000 samples away from an audible error in precision.

int i = 0;
double delta = 0.00000005; // one past a floats limit
float output = 0.0f;
double outputer = 0.0f;
while(i < 1024){
output += delta;
outputer += delta;
i++
}
“output = 0.00001”
“outputer = 0.000001”

Roughly One second at 96Hz

“output = 0.001”
“outputer = 0.0001”

… That is 10% quieter or louder of an error.

To sum up… pun intended. I think it is not an error of variable position, its an error of calculation.

I don’t think we will find a conclusion hw much headroom is appropriate, what a reasonable samplerate is, if audio files sound better when they are stored on an SSD than on a HDD, if you use the wrong diameter on your speaker cable and if using counterclockwise wound coils sound softer.

Let’s focus on the API and how we can achieve what we need for our projects.

What counts for me is that JUCE uses the best available bit rate the sound driver offers. Is there a need to select manually then?

The bug report was that the OP wanted to select manually a specific bit rate.

The terminology goes a bit wild here.
I could do now a search on what dynamics the different numerical formats yield, but there are better sources.

For numerical errors and other artefacts I recommend to watch Monty Montgommery’s Show and Tell, the stair steps and the dithering are both worth watching:

1 Like

Sorry, but that is simply not a valid experiment. Please learn what a double-blind test is and then do one.

This is so esoteric, that it goes straight into the conspiracy-theory territory.

Do you really believe that the hundreds of DSP programmers on this forum alone are all ignorant and happily use 32-bit float for their audio because they don’t know better? You’re the only one with the secret knowledge? Or do you think we’re all secretly using 128-bit doubles but tell you something else to gain some advantage?

In the end, you can believe whatever you want, but in my opinion, you are wasting your time and resources (CPU, RAM, etc.)

2 Likes

That was a great video!

Thanks for helping me understand 32bit floating point used in wav files are the exact same thing as float variables in c++, there is zero difference they both use IEEE-754. No data loss at all. I honestly didn’t know that…

32 bit daws and plugins were better… no clue why they ever went to 64 bit. Seems like a waste of cpu and ram.(32 bit float)

You are right, all calculations beyond 8 decimal places are a waste, zero audible errors can ever occur because 770dB of headroom in a physical playback environment will deal with the amplified compounded recursive rounding errors done in a digital environment. Because math obeys the laws of decibels quick, change the calculators. Let them know…

0.000000005 + 0.000000005 = 0.00000002;

or 0.0f

if (0.5 >= 0.44444445f) true, false, who cares.

I guess I’ll go play my gamebox with my friends on gamebox live because decibel which is a unit that measures air pressure translates perfectly to an environment with zero air. Then I’ll go do a million calculations with only 8 decimal places on an 8 digit number and know in my heart there were zero audible errors.

good thing sample rate is a double we wouldn’t want any rounding errors in our audio calculations.
Screen Shot 2022-05-19 at 6.04.00 PM

Screen Shot 2022-05-19 at 6.38.49 PM

float x = -0.00000004f;
float y = 1.0f;
float output = (abs(x)/x)*y;

what does output equal? it’s probably not audible right?

So you think these tiny rounding errors matter, but then seriously argue that analog summing sounds better?

Have you ever heard how ALL analog components (each resistor, transistor, tube, capacitor, etc., and even the wires connecting them) have a random, completely unpredictable resistance on top of the inductive resistance that depends on the current, distance to other magnetic fields, etc.?

The analog world is incredibly noisy. That’s one of the reasons we’re using digital effects. To avoid all this noise.

1 Like

We’re all ignorant fools who don’t know the first thing about how audio works. You’ve cracked the code. You are the only person on this planet that can do it right. We’re not worthy. Please teach us. Please. I beg of you.

:rofl: :joy:

bro you understand it better than I do…

I’m trying to figure out if doubles really are a waste of time. I’m not convinced nor do I even know how to test it.

Where is the improved accuracy and clarity threshold? no doubles, some doubles, all doubles? Its interesting because i’m in the all double camp and you’re in the no double camp. Which makes for good conversation.

Analogue sounds better because of the physical properties of electricity and it’s response to sharp transients that digital doesn’t hide. Good point on the noise though. It is what it is sort of thing.

You taught me a lot, I’m just curious if we should use 64 bit in calculations since processors seem to be able to handle it. Also sample rate has way more to do with quality than bit depth.

I’ll admit that i’m wrong if I am. Honestly, all audio can fit into 8 digits is a pretty profound revelation in any audio programmers journey.

I’ll test it… it may not be today… or tomorrow… 6 months…12 months… but when I do i’ll come back to this thread with my findings.

Yet another reason not to lock threads :joy:

1 Like

You could start by reading good free resources (if not already done) about DSP theory.

Sorry if I come across as rude, or so, but I guess I am not the only one puzzled by the following:

@TypeWriter: your badge indicates that you have a Pro Juce license, which is often an indication that the license holder is working on products that are doing well commercially.

Yet, from discussions like above, I simply cannot believe that you are already coding at a commercial production level.

I am really curious about the origins of your Pro badge… :slight_smile:

No worries, I studied audio engineering for years putting in my 10,000 hours into mixing and mastering. Learning how to successfully record, mix and master a professional song. Then moved to audio programming around 7 years ago.

I’m aware I definitely came and come across ignorant. I’ll be the first to admit, I’m not the most orthodox. I also haven’t converted my project to doubles as I said previously. I posted that earlier, after learning long doubles were a thing. No idea they were 128 bit or floats were 32 bit. All I knew is floats had 8 decimal points and doubles had 16ish. I just hoped it was the same as wav files, but never confirmed.

I would say I am professional because I can focus on one project every day for years at a time that is tailored for producers work flow and what sounds best rather than being a modern computer science architecture coding feat. The moog voyager originally was shipped with a broken filter and is purposely still built that way because of how it sounds.

I’ve also read Will Pirkles book around 12 times, and worked through the projects, in RackAfX 3 times when I first started. I’ve failed at this more times than I can count, but I don’t give up. I used to not know how to debug and I would manually take my code out and put my code back in for hours or days…years at a time. This is why my first plugins were very clunky and had to fight getting into the crouching fetal position many times. I never did though.

Honestly, I think I’m usually pretty misunderstood when I talk or ask questions. My ACT reading score was half of my ACT math score if that tells you anything lol.

I assume this gap in my communication ability with code is derived from how I learned coding, which was homeless or couch surfing living out of my backpack for years, luckily I had will pirkles book. Sometimes walking 4 miles in winter for an internet connection.

For around 3 years I made around 3 or 4 plugins that I eventually took down because of how hackey they were. I remember feeling like anything was possible, when a stranger bought my very first plugin Escape Artist. A delay measured in time not milliseconds, using biquad’s tuned to the Flecture Munson curve.

I then spent 3 years on a plugin called X utilizing the haas effect mixed with a dynamic imager, and verb. It had a space theme. From my understanding most pros mix in LCR/mid/side, or at least, the ones I could get to talk to me. Unfortunately, I quickly realized most people don’t see too much value in dynamic imaging. No matter how cool I thought it was.

This was all while I was working construction, printing t shirts and sleeping in friends garages or in my car, or whatever apartment I could afford for a short lease. I eventually started reaching out to youtubers to sell my plugin X. After the 3 years it took to finish because of how utterly ignorant I was to DSP, C++, and Juce. I was eventually able to make 200 dollars from having 10 youtubers give me a review, and doing ads.

While reaching out to 160 youtubers with personal videos on my phone that didn’t have internet, one youtuber Kyle Beats asked me to make him a plugin. I told him no, because I wanted to go solo, but he wouldn’t give up. I eventually said ok and we started on a plugin called the sauce. One and a half years later it was released and we found that the name was trademarked and then remade all the graphic elements to be called drip. A plugin to maximize work flow. Luckily a lot of the lessons and code from X carried over!

The time we started a project together I was featured as one of ADSR’s plugin and I started to get some traction I finally got a phone, and was able to rent an old house in the middle of nowhere, I found through word of mouth, this was supplemented with my other job auditing gas station inventory 12 hours a day one week a month, printing t shirts, and drywall. The place didn’t have internet, however I would call the phone company move my internet to a lower Gig plan then back to higher gig plan when I needed more data for my phone hotspot. I could not afford a mac. However, I was able to make a virtual machine on a computer I had built 10 years prior when I was 19. Using my community college student loan money for a custom built computer instead of car.

It took me 7 years to get a degree because I was working fulltime. I started programming my senior year. I worked at Volition on Saints Row as a sound designer my junior year and put the sound of my beard in as the grass sound. From the time of graduating college to living in the middle of nowhere on my 5 year journey, I had lost 60 pounds from walking, being broke, etc… I wasn’t doing well, all my free time was into learning dsp, c++, and working on my plugin ideas.

I had been living out of my car for the last two years paying 240 dollars to get it towed place to place, then I used my money from X to get it fixed then… it broke down. Luckily my boss for the auditing job could pick me up until I bought a 300 dollar car from some guy who gave me ride randomly. I still remember the cuts in my hand from turning the key nearly 100 times before every engine start. I lived 5/7 miles from the nearest town and 40 minute walk to get to town. I was living in the middle of no where alone, working construction, auditing, and dedicating all my time learning dsp, c++, and juce. However, I was at my physical, mental, and spiritual end.

When we launched Drip there were 400 users with errors all asking me to fix their mac bugs compiled in the virtual machine that had just crashed again, that took me weeks to build with minimal internet and disc images. The customer service was linked to my phone so it never stopped buzzing launch night. At this point I lost all my optimism I had boldely held for the last 5 years. Even the nights wearing all my clothes in the back of my broken down car during freezing temperatures, I never lost hope. However, this time I finally decided to sit down, break down, cry and give up… My eyes still water talking about it. Both my bank accounts were negative 200, i lost both my credit cards and my rent was late. I was officially pushed too far, there was no way, this was the nail in coffin I couldn’t fix these errors without a mac nor could I try and spend days making another virtual machine in a mac, download Xcode with 10 seconds of delay in mouse movement in hopes it would work. I gave in, got into the crouching fetal position started to cry and admitted I was utterly defeated. The odds were too high, and no amount effort would overcome them. That is when Kyle called me and said I made enough money to buy a mac. Which I wasn’t used too, nor thought about thats who I was helping fix their errors. People who purchased and wanted to use the plugin…

It kind of felt like giving up/ collapsing as you cross the finish line. Since then around 2 or 3 years ago I’ve spent every day working on a synthesizer. I hope to release soon. I’ve gained 80 pounds, which people say I look healthy now. Thats my story, thanks for asking, I hope it encourages someone.

I would encourage anyone reading this who is the nerdy not well spoken type like me to find someone who is good at the business side and work 50% with them. Kyle is one of my best friends, a talented producer and I highly value his input towards development.

To sum up, if I come across stupid in this thread, it’s probably because I am. It took me years to learn profiling apps, debuging, circular buffers, FFT, band-limiting, oversampling, convolution, bi-quads, magnitude, logarithms, exponentials, complex numbers, pointers, references, memory management, and now binary of variables. I love plugins and it was a dream come true when I compiled my first vst. However, to answer your question the only reason I’m a pro, is I’m too stupid to give up.

7 Likes

I recently saw one of those!

I only knew this one
https://www.musicdsp.org/en/latest/

I’ll read all of those! Thanks!

Thanks for sharing your journey. Going from that initial spark of interest to chasing a commercial success is difficult, getting crushed emotionally on the way at least once is a sign you’re pushing yourself hard. I expect a lot of us have had similar moments in the hole of despair, congrats for dragging yourself out and seeing it through rather than quitting.

About the doubles. If you’re in doubt about whether some internal part of your code benefits from doubles or not then make two versions, one with doubles and one with floats. On a range of material run your plugins side by side, invert the polarity of one, and if you hear any residual content you’ll know if it made a difference or not. If they null out fully, or if it’s way way down, floats are sufficient for you. This could be argued about without sight of your algorithm for weeks, so just try it out and prove it one way or another for yourself.

1 Like

i think what makes you most professional is how you’re not getting angry at people accusing you of spreading conspirancy theories when you’re really just healthily curious. i would have been so mad at this point. you all should definitely relax some more. it doesn’t matter if wanting to control the bitdepth is reasonable. everyone can decide that for themselves individually.

7 Likes