Login / Register  0 items | $0.00 New @ KVR

Sample and hold

Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Tue Aug 06, 2013 4:27 pm Sample and hold

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?
makira
KVRist
 
158 posts since 24 Mar, 2005

Postby makira; Wed Aug 07, 2013 4:51 am

Well, this was a nice little puzzle.

Solution:
Image

https://www.dropbox.com/s/bboyq4kdudr2pou/sample_and_hold.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.
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Thu Aug 08, 2013 5:27 am

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

So, then, a sample and hold element in SB2?
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Sun Aug 11, 2013 9:25 am

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).
makira
KVRist
 
158 posts since 24 Mar, 2005

Postby makira; Sun Aug 11, 2013 9:45 am

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
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Mon Aug 12, 2013 5:50 am

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

Thanks again...
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Tue Aug 20, 2013 7:23 am


Antoine, I was wondering, any reason to prefer the random ramp element to the random element in the circuit?
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Tue Aug 20, 2013 9:14 am

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!
makira
KVRist
 
158 posts since 24 Mar, 2005

Postby makira; Fri Aug 23, 2013 5:28 am

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.
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Fri Aug 23, 2013 7:41 am

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...
makira
KVRist
 
158 posts since 24 Mar, 2005

Postby makira; Fri Aug 23, 2013 9:54 am

Ha, I didn't even remember the Random element. Yep, that would avoid the ramping issue completely.
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Fri Aug 23, 2013 10:00 am

Thanks.

One thing is for sure, I'll need both Random and Random ramp generators in SB2!
Kewl
KVRist
 
210 posts since 11 Apr, 2007, from Montreal, Canada

Postby Kewl; Sun Aug 25, 2013 8:07 am

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.

Moderators: dscro, makira

Return to SonicBirth