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

Add wavetable oscillator #176

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

brbrr
Copy link

@brbrr brbrr commented Aug 31, 2022

Adds a bandlimited wavetable oscillator. The implementation is quite opinionated, and it would require some amount of refactoring to make it general enough to be used in multiple use cases.

It behaves similarly to Oscillator class, with the caveat that one needs to run Tables::Generate(); before processing the oscillator.

std::vector<WaveBuffer *> buffers;
};

struct Tables
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As suggested by @antisvin in the forum, it might be a good idea to provide a templated FFT implementation instead of one hardcoded below.

@stephenhensley
Copy link
Collaborator

ouu, very cool! Thanks for the contribution @brbrr

I should have some time to give this a look next week!

GuilhermeMoreno and others added 12 commits September 30, 2023 20:31
Contributed-by: Guilherme Moreno <guilhermewr9@gmail.com>
Signed-off-by: Guilherme Moreno <guilhermewr9@gmail.com>
Contributed-by: Guilherme Moreno <guilhermewr9@gmail.com>
Signed-off-by: Guilherme Moreno <guilhermewr9@gmail.com>
Contributed-by: Guilherme Moreno <guilhermewr9@gmail.com>
Signed-off-by: Guilherme Moreno <guilhermewr9@gmail.com>
Converts the struct to a template class, allowing to provide the FFT implementation as a template parameter.

Signed-off-by: Guilherme Moreno <guilhermewr9@gmail.com>
Added to .cpp to the makefile, added the .h to daisysp.h,
fixed an include.

Also moved the waveform enum to pass by the type rather than uint8_t. This is a change I want to make across the library to how we handle enums.
Converts Tables struct into a template class
Comment on lines +40 to +44
case Waveform::WAVE_SIN: SetWaveTable(&Tables::Sine); break;
case Waveform::WAVE_TRI: SetWaveTable(&Tables::Tri); break;
case Waveform::WAVE_SAW: SetWaveTable(&Tables::Saw); break;
case Waveform::WAVE_SQUARE: SetWaveTable(&Tables::Square); break;
default: SetWaveTable(&Tables::Sine);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These now throw the error(s)
'template<class T, void (* fft_func)(int, T*, T*)> class daisysp::Tables' used without template arguments and so on.

@beserge
Copy link
Contributor

beserge commented Dec 12, 2023

Sorry about working on top of you a bit, I think my repo was a bit out of sync and I re-fixed issues that had already been addressed. I'm going to squash and merge anyways, so it shouldn't be an issue.

If we can get it building again with the template change, that would be great!

@SimonKunz
Copy link

Hi all! Any chance this will get merged? Having a wavetable OSC would be so awesome!

@Sam2R
Copy link

Sam2R commented Jan 17, 2025

Hi All!
Is the wave-table osc has been merged to the library? it's an important step to leverage performance!

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.

6 participants