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

Added a simple wavefolder #159

Merged
merged 3 commits into from
Jan 12, 2023
Merged

Conversation

tomcombriat
Copy link
Collaborator

@tomcombriat tomcombriat commented Dec 4, 2022

Clean PR for the wavefolder, in response to #153 .

Will test it a bit more extensively and add an example soon.

@tomcombriat tomcombriat linked an issue Dec 4, 2022 that may be closed by this pull request
@tomcombriat
Copy link
Collaborator Author

Okay, at the cost of readability (have a look if you want ;) ), I gained a factor of 3 on the computation of the next() function.
Two optimizations:

  • % replaced by a bitwise and (I thought the compiler would have done it, but this version is slightly faster)
  • replace the hard division by a precomputation of the inverse. This will slow down the setLimits but accelerate (3x gain) the next() which (hopefully!) is computed more often. Had to use three more bytes for this. Also, this is a bit less precise for high numbers of large folds, because of the loss of precision in computing the inverse. This is minor though (error of 5 at most for a 10 times folded signal on a total range of 450…

Will do an example soon but open to comments in the meantime.
Best

@tomcombriat tomcombriat mentioned this pull request Dec 4, 2022
@tomcombriat tomcombriat marked this pull request as ready for review December 5, 2022 20:45
@tomcombriat
Copy link
Collaborator Author

Hello!
I think it starts to look good!
I have added an example, and tested on Arduino and Teensy.

For the last, there is a compilation problem as the compiler does not know with overload to choose between:

  • static inline MonoOutput fromNBit(uint8_t bits, int16_t l) and
  • static inline MonoOutput fromNBit(uint8_t bits, int32_t l)

A fix for that is coming soon.
Best,

@tomcombriat
Copy link
Collaborator Author

Hi!
I am merging this as it is quite small and not impacting the main core. Will solve #153

@tomcombriat tomcombriat merged commit f2708f5 into sensorium:master Jan 12, 2023
@tomcombriat tomcombriat deleted the wavefolder_clean branch January 12, 2023 11:18
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

Successfully merging this pull request may close these issues.

Wavefolder
1 participant