First Patch - Simple 8-Oscillator Drone (Field)

It’s very cool that I can get something going in the first couple of hours of using the Field. I modified the KeyboardTest to make a simple drone with 8 sine oscillators.

I know very little C++, so I am open to comments!

1 Like

Ok, you’ve asked for comments yourself, so you’re getting them and don’t expect mercy :wink:

  1. You’re not writing this in python, so you should probably aim for idiomatic C++ - “voice” should be a class and some of its data members should be private. Your code becomes harder to follow when you don’t make this distinction.

  2. You’ve defined scale as array of floats, but they are storing integers and would fit in a single byte (uint8_t). So you’re spending x4 more memory than necessary in this case.

  3. Also, this array should be defined as a “static const”, this would allow storing such data on flash instead of RAM.

1 Like

Thanks for the feedback!

Guilty as charged; I’m having so much fun with semicolons.

I made the changes to that scale array. Also, from researching your first comment learned that struct is like a flipped class, where everything is assumed to be public rather than private. I then made the things that were clearly meant to be private (variables ending with _) private which is hopefully what you were pointing to.

Other updates:
Had fun trying to figure out writing to the screen. Writing to the screen on every iteration is very expensive (you can hear it and it sounds pretty cool) so I am still trying to find the smart way to do it. Basically I want to update the screen only on the onset of a knob change or a key press. Right now, updating repeatedly while a key is down was a happy pause point.