jamoma / jamoma2

A header-only C++ library for building dynamic and reflexive systems with an emphasis on audio and media.
MIT License
30 stars 6 forks source link

Implement additional fill() options for SampleBundle #68

Closed nwolek closed 8 years ago

nwolek commented 8 years ago

Found in code for Jamoma::Sample:

//TODO: Add some additional fill() options -- e.g. filling with a sine function, sinc function, etc.
//These can emulate options found here:
//https://github.com/jamoma/JamomaCore/blob/master/DSP/library/source/TTSampleMatrix.cpp#L254

Would seem to be a prerequisite to implementing a Wavetable object (issue #5).

Some of the recent discussion about interpolation may impact the way this is designed (issue #43). i.e. If we decide that interpolation should be outside the data container, does that mean the same thing for fill operations?

tap commented 8 years ago

Good question. Makes my head hurt a little. I'm thinking I may have stepped into an old trap/habit of mine where I let "perfect" be the enemy of "good". But this is incremental development: we can always do something and then change it if reality dictates...

So in both this case and the interpolation case, I would say that if there is motivation to pursue one direction or the other that we should just do it. Then we can evaluate something in concrete terms, and refactoring (if needed at all) will be easier with something legit from which to start.

tap commented 8 years ago

That said, I'm attracted to the idea that we could fill a std::vector or a CircularBuffer or a SampleVector or a SampleBundle or std::array each with e.g. a cosine wave using the same algorithm. YMMV

nwolek commented 8 years ago

I am actually investigating this very thing by leveraging std::generate. Whatever I do, I will keep in a branch for you to review and comment.

tap commented 8 years ago

Perfect!

nwolek commented 8 years ago

@tap - Please take a look at the work so far on branch issue/68. This is showing a lot of promise in my initial tests! A couple of questions I have for you:

tap commented 8 years ago

Working on the review right now. Being a little picky. Some of my questions might sound rhetorical but they are not. For example, the struct vs class question.

I completely agree that we should not use "fill" terminology but instead "generate" terminology so that we are in alignment with the STL standard.

tap commented 8 years ago

It ended-up being easier to express myself in code than in comments about code. Hopefully I haven't over-stepped!

nwolek commented 8 years ago

Nope. It looks like you pushed things forward in exactly the places I was stuck! Thanks!!!

Talk to you in the morning.

nwolek commented 8 years ago

List of algorithms we had in Jamoma1's SampleMatrix:

In this case, "Mod" really means unipolar. I know this term is used in Roads CMT, therefore I would suggest we adopt this term.

tap commented 8 years ago

Another reference here are the fill/apply methods for the buffer~ object. Specifically I'm thinking of the sinc function and also of only generating half of the wave.

Perhaps we should think of unipolar and generating half the wave as well as the frequency as attributes/parameters of the generators?

nwolek commented 8 years ago

This work is migrating to JamomaGenerator.h

nwolek commented 8 years ago

All shapes from SampleMatrix now implemented. Opening new issues for remaining shapes discussed with @tap.