Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound only goes from 0% to 85% #139

Open
brunoafg opened this issue Jan 18, 2025 · 0 comments
Open

Sound only goes from 0% to 85% #139

brunoafg opened this issue Jan 18, 2025 · 0 comments

Comments

@brunoafg
Copy link

This is not a problem from the code but from the hardware itself.

I have a workaround so other people can bypass the issue.

The volume dont reach 100% in computer or if inverted, goes from 100% to like 15%.

Somehow, the output on the console only reach 850. For what i understand, this can be caused by "noise", quality of wires/pot's or even if the arduino cant output exactly 5v (like 4.8v).

I've changed the updateSliderValues() with a map function, it scales the real output value to value that we want. This must be analized case by case and conditions can be needed if not all the outputs give the same real output (Ex. Out1 = 850, Out2 = 1000, Out3 = 500, etc).

void updateSliderValues() {
for (int i = 0; i < NUM_SLIDERS; i++) {
analogSliderValues[i] = analogRead(analogInputs[i]);
// Map the value to the range 0-1000 based on the observed max output
//map([arduino_input], [real_output_min_value], [real_output_max_value], [min_wanted_virtual_value], [max_wanted_virtual_value])
analogSliderValues[i] = map(analogSliderValues[i], 0, 850, 0, 1023);
}
}

Hope that this helps someone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant