SynthMaker

A Sample and Hold for audio signals

Archive · 2005 8 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

lalo ·

Hi guys,

how could you do that?

i'v seen only SaH for green stuff around and not for stream stuff...

thanx

lalo

lalo ·

i'm doing one using noise signal and mono to float then sample and hold the float signal...it will only work for mono... for poly we should get voice management to deal with the 4 sse channels

sambean ·

Here's a quick stream S & H..

streamin signal; streamin freq; streamout SH;

float counter;

SH = SH - (counter>=1.0)&(SH - signal);

counter = counter - (counter >= 1.0)&1.0;

counter = counter + freq;

tested it, seems to work..

pretty straightforward: freq should be between 0 and 1.

It works using a counter, every time it exceeds 1, the input signal is sampled..

With a freq of 1, the SH signal will be the same as the input..

It's pretty crude but does the job, hope it helps..

oddson ·

Hey Sam

Your Sample and Hold code works fine, but if you feed the non-random noise from standard overdriven sine generator you get the same sample and hold pattern on each note.

I tried to use the rand() function that I've seen used in Jorge's Karplus but in only works in arrays and a var[1] array doesn't work either.

Any ideas? (example OSM)

p.s. - does the rand() function only effect stage 0 in code?

sambean ·

Hey Oddson

I imagine you're getting the same patter as each time you press a note the code is getting generated exactly the same..

A quick fix solution (as we don't have a proper random number generator) that I can think of just now is to use the green components to generate some sort of clock (timer and counter perhaps) running all the time to generate a float that you add to the phase of the sine osc, each time the noise is generated then it should be different..

Rand() only works for stage 0 at the moment as far as I can tell, there's a thread somewhere about generating pseudo random numbers in the code, but again, if you do this in poly code, the random pattern will be the same each time..

The example I put on this thread should not really be called a sample and hold, more a sample rate reducer..

A proper sample and hold would be:

streamin signal; streamin trig; streamout SH;

// If we get a trigger sample the signal;

SH = SH - (trig>=1.0)&(SH - signal);

This can be preceded by a trig generator:

streamin in; streamout trig; float in1;

// If previous sample is less than 0 and // new sample is greater or equal to 0 // then send a trigger;

trig = (in1 < 0.0)&(in >= 0.0)&1; in1 = in;

With this you could use an osc as a trigger for the S&H..

Nice example btw, pure 70s SiFi..

Sam

oddson ·

Cool, thanks. 😀 What I did was take your pseudo-random (green) generator mod and hook it's trigger to the ticker then added it's output to the overdriven sine generator and got what I wanted [updated eg file above]. I was going to add a 'nevermind' message to my post last night but thought I'd leave it and find out what you (and others maybe) thought about the issue.

(My solution is a little heavy on CPU methinks)

Greatful for your help as always! 🙂 🙂 😀 😀

ROMplERbuDE ·

Hy to all. Late post but here is another quick simple S&H, if only sends a trigger when == 1.

// Code S&H streamin in; streamin H; streamout out; float y0; y0 = (H != 1) &(out * 1) + (H == 1) & in; out = y0;

& a

// Simple Quant. counter streamin quan; // Integer + min 2; streamout out; float cnt; cnt=cnt + 1; cnt = cnt- (cnt>=quan) &quan; out = cnt;

AngularMomentum ·

Thanks for that S&H, now I can finally go on with my emu of the ARP Odyssey! 😀

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.