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

Question (what is the maximum value that this library gives) ? #59

Open
SudoDios opened this issue Feb 6, 2023 · 4 comments
Open

Question (what is the maximum value that this library gives) ? #59

SudoDios opened this issue Feb 6, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@SudoDios
Copy link

SudoDios commented Feb 6, 2023

Hi.
Can you give a number between (float) 0 and 1?
I need to know the max value return.

@lincollincol
Copy link
Owner

Hello! Yes, Amplituda library can provide you value in [0;1], but such feature should be implemented first.
Currently, library multiplies every sample by 100, because it's more comfortable to return int rather than float numbers.

I don't have enough time to work on it, so you can try to modify the code by yourself. If my help is needed, feel free to ask me here 🙂

@lincollincol lincollincol added enhancement New feature or request question Further information is requested labels Feb 6, 2023
@SudoDios
Copy link
Author

SudoDios commented Feb 6, 2023

Ok, so I work 👍

@lincollincol
Copy link
Owner

@SudoDios Hello! You can also modify Amplituda output, but it will take extra time. Here is a discussion about how to scale a number between a range.
So, you can use function below to scale data between a range.

internal fun Iterable<Float>.normalize(min: Float, max: Float): List<Float> {
    return map { (max-min) * ((it - min()) / (max() - min())) + min }
}
// . . .
amplitudes.normalize(0, 100)
// or
amplitudes.normalize(10, 200)

By the way, If you need to scale only in range [0; 1], you can use this example

internal fun Iterable<Float>.normalize(): List<Float> {
    return map { (it - min()) / (max() - min()) }
}
// . . .
amplitudes.normalize()

I'll try to add this feature in Amplituda later, to optimize processing time. For now, we can use this workaround

@SudoDios
Copy link
Author

I am really sorry
I had a problem and the work was delayed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants