synth icon indicating copy to clipboard operation
synth copied to clipboard

API design ideas.

Open mitchmindtree opened this issue 10 years ago • 4 comments

It looks like the Tonic library has some great API design ideas for constructing controllers, generators and processors.

mitchmindtree avatar Mar 29 '15 06:03 mitchmindtree

I like the idea that you can use operators to combine them.

bvssvni avatar Mar 29 '15 16:03 bvssvni

Another idea might be allowing arbitrary types from pitch_calc to be used for note_on and note_off messages.

filmor avatar Sep 02 '15 07:09 filmor

@filmor thanks for the suggestion! I originally considered this also, but thought it might be safer/simpler to keep the design simple for now as each of the pitch_calc makes it easy to convert to hz anyway. i.e.

let c_1 = LetterOctave(Letter::C, 1);
synth.note_on(c_1.hz(), 1.0);

I'm open to the idea of adding a ToHz trait though and implementing it for each of the pitch_calc types, and then having the note_on and note_off methods take T: ToHz instead :)

mitchmindtree avatar Sep 02 '15 08:09 mitchmindtree

That was my idea, yes. If you want I can prepare a PR for this. If used synth in a simple midi player example, that's where it came up (see https://github.com/filmor/midi-rs/blob/master/examples/play.rs).

filmor avatar Sep 02 '15 08:09 filmor