Users, What is the best way to do waveform generation--one sample at time of course--with math functions? First I tried chucking a variable straight to the dac, but it didn't take. Then I tried chucking a variable to the value of a Step, and chucking the Step to the dac. That did work, and below I have a simple lpf'ed sawtooth going. Is there, however, a more conventional and direct way of doing this? Step taint => LPF passer => dac; 400 => passer.freq; -0.2 => float v; while(true) { v + 0.004 => v; if (v > 0.2) { -0.2 => v; } v => taint.next; 1::samp => now; } Sample
On 05/08/2012, Sample Hampton
Users,
Hey Sample,
What is the best way to do waveform generation--one sample at time of course--with math functions? First I tried chucking a variable straight to the dac, but it didn't take. Then I tried chucking a variable to the value of a Step, and chucking the Step to the dac. That did work, and below I have a simple lpf'ed sawtooth going. Is there, however, a more conventional and direct way of doing this?
No, I think this is about it. You can also use Impulse, instead of Step, but for your usage it doesn't make much difference. I'd say this is already quite direct, your code is compact and clear, isn't this good enough? I suppose writing numbers straight to the dac would be even more compact, but that would als make things a bit more ambiguous. Yours, Kas.
Kas, Thanks. Being new to Chuck I wanted to make sure that there wasn't a more standard way of doing this. Sample On Sun Aug 5 08:23:02 2012, Kassen wrote:
On 05/08/2012, Sample Hampton
wrote: Users,
Hey Sample,
What is the best way to do waveform generation--one sample at time of course--with math functions? First I tried chucking a variable straight to the dac, but it didn't take. Then I tried chucking a variable to the value of a Step, and chucking the Step to the dac. That did work, and below I have a simple lpf'ed sawtooth going. Is there, however, a more conventional and direct way of doing this?
No, I think this is about it. You can also use Impulse, instead of Step, but for your usage it doesn't make much difference. I'd say this is already quite direct, your code is compact and clear, isn't this good enough? I suppose writing numbers straight to the dac would be even more compact, but that would als make things a bit more ambiguous.
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 5 August 2012 17:04, Sample Hampton
Kas,
Thanks. Being new to Chuck I wanted to make sure that there wasn't a more standard way of doing this.
Sorry for the late response, Currently this is indeed the standard way, a more efficient way for often useful structures is coming in the form of DIY plugins in C++ if that's your cup. I'd say that what you impressively came up with on your own is not only the standard way, but really quite nice. Especially when considering that we can use Step to go from code to UGens and .last() to go from UGens to code, I'd plead that this is a very nice and versatile structure; we can write DSP in the same way that we'd use to write a melody. Of course that is because the two are the same kind of thing (a series of values with a given timing), but elsewhere in "accessible" systems that similarity isn't as clearly exposed, I'd say. For me this was a bit of a break-though; I knew this to be true, but it was quite another thing to actually see it in a practical manner :¬). Yours, Kas.
participants (2)
-
Kassen
-
Sample Hampton