Sample and hold

Official support for: sonicbirth.sourceforge.net
Post Reply New Topic
RELATED
PRODUCTS

Post

I'm tying to design a sample and hold circuit in SB1. http://en.wikipedia.org/wiki/Sample_and_hold

For the life of me, I can't seem to find a way how to do it. Antoine, is it even possible?

Post

Well, this was a nice little puzzle.

Solution:
Image

https://www.dropbox.com/s/bboyq4kdudr2p ... ld.sbc.zip

It revolves around the bufferizer object. Mode 1 plays, mode 2 records. With a speed of 0, it will play the first sample. Unfortunately, when recording, it outputs silence, so the greater element is used to fix that. Also, there's a bug in the bufferizer object where it won't playback a one sample recording (due to an off by 1 error), so I used the delay element to turn the ktap single sample 1 output into a two samples output.

This is fairly ugly, but it works...

I don't think you could have made that without consulting the bufferizer source code.

Post

Hey, thanks for that! I thought that the bufferizer would be used...

So, then, a sample and hold element in SB2?

Post

It mostly works, but if you replace the "source" by, say, the linear noise element, you'll notice glitches in the result.

At the end of the day, I'm looking for a random generator that will output a new number when "tapped" rather than at a set frequency: that's why I wanted to connect a sample & hold circuit to one of the random generator (Linear Noise, White Noise, Pink Noise, Random, Random ramp).

Post

That's because of the trick I had to use to workaround the bug in bufferizer (duplicate the ktap).

Try this:
https://www.dropbox.com/s/phg9075iz3j1d ... ap.sbc.zip

Post

Yes, that's perfect. Should have asked for what I wanted in the first place!

Thanks again...

Post

Antoine, I was wondering, any reason to prefer the random ramp element to the random element in the circuit?

Post

While we're at it, why "999999" for the multiplication?

Would it work better with a higher value? What is the highest value that circuit can take?

TIA!

Post

Kewl wrote:While we're at it, why "999999" for the multiplication?

Would it work better with a higher value? What is the highest value that circuit can take?

TIA!
A more proper value would be the current sample rate, which would tell the module to change the value every time the ktap is pressed.

If you use samplerate/4, it will take 4 ktap to move from a random sample to the next, ramping in between.

Using 999999 was just a lazy shortcut to ensure a new value is generated everytime the ktap is pressed.

Post

OK.

And the choice between Random and Random Ramp? If I want instantaneous change, Random would be better?

I'm just wondering if there's a technical reason like "at that frequency, Random is more glitchy than Random Ramp" or something like that...

Post

Ha, I didn't even remember the Random element. Yep, that would avoid the ramping issue completely.

Post

Thanks.

One thing is for sure, I'll need both Random and Random ramp generators in SB2!

Post

makira wrote:A more proper value would be the current sample rate, which would tell the module to change the value every time the ktap is pressed.
In my test, at the current sample rate, it takes two taps to change the value: I checked it at 44.1, 48, 88.2 and 96 kHz.

Current sample rate + 1 is what worked to change the value for one tap.

Post Reply

Return to “SonicBirth”