SynthMaker

Translate this crusher

Archive · 2010 2 old posts

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

CoreStyler ·

Can someone translate this code to synthmaker code?

function output = crusher( input, normfreq, bits ); step = 1/2^(bits); phasor = 0; last = 0;

for i = 1:length(input) phasor = phasor + normfreq; if (phasor >= 1.0) phasor = phasor - 1.0; last = step * floor( input(i)/step + 0.5 ); %quantize end output(i) = last; %sample and hold end end

MichaelBenjamin ·

CoreStyler wrote: Can someone translate this code to synthmaker code?

function output = crusher( input, normfreq, bits ); step = 1/2^(bits); phasor = 0; last = 0; for i = 1:length(input) phasor = phasor + normfreq; if (phasor >= 1.0) phasor = phasor - 1.0; last = step * floor( input(i)/step + 0.5 ); %quantize end output(i) = last; %sample and hold end end

heres a try, should work:

streamin in; streamin freq;//0.5 for half samplingrate 0.25 for 1/4 etc streamout out; float step=0.00390625;//precalculated for 8 bit - 1/2^8 float stepinv=256;//to avoid div float ramp,lastramp,floor; ramp=(ramp+freq)&(ramp<=1);//ramp to trigger s&h floor=step*(rndint(in*stepinv+0.5));// not so sure here if that is meant with floor, maybe its only the one ctvsdpqs that gives out the remainder, but the rndint here should do the quantizing just right out=out&(lastramp<ramp)+floor&(lastramp>=ramp);//s&h on each cycle lastramp=ramp;

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.