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

Consider generator inputs to add potential for sample accurate start / stop #62

Open
nwolek opened this issue Nov 26, 2015 · 0 comments
Assignees
Labels

Comments

@nwolek
Copy link
Member

nwolek commented Nov 26, 2015

Idea for this was raised by @tap during the discussion on issue #35. Concept would be for generators (currently Phasor, UnitImpulse, WhiteNoise) to accept an input that controls the starting and stopping of their output.

I've been thinking about this some more since the idea was raised, and the concept is growing on me. One option would be for them to receive a SampleBundle with a mix of zeros and ones that allows you to turn the algorithm on and off. I am imagining a syntax like this for normal operations:

Jamoma::SampleBundle my_control(1, 64); 
my_control.sampleRate = 48000;
my_control.fill(1.0);

Jamoma::Phasor my_phasor;
my_phasor.phase = 0.1;
my_phasor.frequency = -2000.0;

auto out_samples = my_phasor(my_control);
// my_phasor inherits channel, frame and sampleRate from my_control
// results in out_samples filled with values from my_phasor 

my_control.fill(0.0);
auto out_samples = my_phasor(my_control);
// results in out_samples filled with value 0.0

Then since I have a keen interest in a sample accurate start/stop feature, I can imagine some form of control unit generator that alternates between 0.0 and 1.0 to turn the generator on and off within a single SampleBundle. Maybe this is a limitation that we impose: Only generators that have output constrained to zero/one can take no input? All others must have an input SampleBundle like above.

A variation: it could be a mix of zeros and non-zeros, with the non-zeros actually scaling the output like a gain control. This is probably more computationally intense though. I guess it is a question of whether we want to require gain be applied to the output, controlled via input, or both. I would lean toward inputs for start/stop only, therefore restricted to zero/one.

Now that we have several working generators, this is a good time to pause and consider the overall syntax and features we want to have going forward. There is a potential parallel issue in #25, which might be tackled together with this issue in a branch.

I hope all this makes sense. I am tagging this as a question since there is some discussion needed.

@nwolek nwolek changed the title Condsider generator inputs to add potential for sample accurate start / stop Consider generator inputs to add potential for sample accurate start / stop Nov 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants