SynthMaker

Resampler

Archive · 2005 24 old posts

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

stefan ·

here's a simple poly version

polyin in; polyin samplingFreq; polyout out; float cnt; float lastOut; cnt = cnt + samplingFreq;

out = (cnt >= 1.0) & in + (cnt < 1.0) & lastOut; lastOut = out; cnt = cnt - (cnt >= 1.0) & 1.0;

Now go make some tech house. 🙂

Shifrin ·

Cheers Stefan, another cool little custom code component 🙂

Shif.

Tom7777 ·

Nice thanks stefancrs

rl ·

stefancrs wrote: Now go make some tech house. 🙂

This looks like a cool downsampler.

For the lofi feeling you also need a bit-reducer 😉 :

polyin in; polyin steps;

// code: bit reducer // author: rl, 2005 // in: audio in // steps: bit-resolution [0, 1, 2, 4, .. 2^x .. , 65536] // e.g. feed by a multiplexer // 0: no reduction // out: audio out;

polyout out;

float redux; float x; x = steps/2;

redux = x*in;

out = (x > 0.51 ) & (rndint(redux)/x) + (x <= 0.51 ) & in;

stefan ·

And here's another bit reducer 🙂

monoin in; monoin reduce; monoout out; float mul; mul = (1.0 + (1.0 - reduce )* 32767.0); in = in * mul; out = rndint(in) / mul;

stefan ·

And sorry, I just had to do the fucked up one as well

monoin in; monoin reduce; monoout out; float mask; mask = -1.999999 * (reduce); out = in & mask;

basicly, -1.999999 converted to binary is equal to 10111111111111111111111111111111, which is the closes to all bits set to 1 you can get (because if you set that last one you get the float value "NaN" which means "not a number", an error value). So when using this mask, which ranges from all bits set to zero to almost all bits set to one, you can reduce the number of bits used in the float value you apply the mask to.

Heh.

Kitchen Sink ·

IMO, bit reducers sound horrible. I have lived through the era of Commodore 64, MSX, etc. when we had something like 4 bit digitized sound. Quantization noise is just awful. Please don't use those things in music... 🙂 Or at least use a low-pass filter after that to make it a bit more bearable.

stefan ·

The last one I posted does not quantize the values really. It basicly just fucks their floating point resolution up. In quite a weird manner. It sounds like a broken transistor amplifier when feeding polyphonic material through it. And ofcourse I have a lowpass filter after it.

And yeah, I came up with the code for it this morning and then afterwards I implemented it in my synth and I really like it's sound 🙂

Granted, there's a difference in using 4 bit audio and using bit reducers as a sound sculpting tool... 🙂

Tom7777 ·

Thanks everyone. I think bit reducer can sound very cool when used with certain things i really like retro type sounds so this is cool 🙂

lalo ·

stefancrs wrote: here's a simple poly version

polyin in; polyin samplingFreq; polyout out; float cnt; float lastOut; cnt = cnt + samplingFreq;

out = (cnt >= 1.0) & in + (cnt < 1.0) & lastOut; lastOut = out; cnt = cnt - (cnt >= 1.0) & 1.0;

Now go make some tech house. 🙂

very interesting...i'm trying to figure out the boolean mask thing..... cnt >= 1.0 returns 0 for every sse channel wich is <1.0 and 1 for every sse channel wich is >=1.0 ...am i right? what i really don't understand is the & ....what's up if the in is not 0 or 1 but in example 0.5?

unless the >= thing returns the actual value whne the condition is satisfied and nothing or 0 when the condition isn't satisfied ..?

a bit of mess in my mind 🙂

any explaination?

thanx guys

lalo

stefan ·

lalo wrote: stefancrs wrote: here's a simple poly version

polyin in; polyin samplingFreq; polyout out; float cnt; float lastOut; cnt = cnt + samplingFreq;

out = (cnt >= 1.0) & in + (cnt < 1.0) & lastOut; lastOut = out; cnt = cnt - (cnt >= 1.0) & 1.0;

Now go make some tech house. 🙂

very interesting...i'm trying to figure out the boolean mask thing..... cnt >= 1.0 returns 0 for every sse channel wich is <1.0 and 1 for every sse channel wich is >=1.0 ...am i right? what i really don't understand is the & ....what's up if the in is not 0 or 1 but in example 0.5?

unless the >= thing returns the actual value whne the condition is satisfied and nothing or 0 when the condition isn't satisfied ..?

a bit of mess in my mind 🙂

any explaination?

thanx guys

lalo

The comparison result is a bit mask. If the comparison was true, all bits for that channel is set to 1, otherwise set to 0. So what happens is this

mask = cnt >= 1.0; if cnt IS 1.0 or more, mask will be set to (binary) 1111111111111111 and so forth. Then what we do is for instance value = mask & 0.94; here we do a bit-wise and operation between the mask and 0.94. Which bits that are set in 0.94 totally depends on the actual value, but the bits in the mask are all one or all zero. Hence value will either be set to zero or to the bits in 0.94.

Am I making any sense?

lalo ·

thanx stefan!!

so do you mean that the AND operation is done between the 1111 1111 1111 1111 (if the condition is true) and the binary equivalent of 0.94 on a 16 bit basis...where 1 (float value) is equal to 1111 1111 1111 1111 ? so the AND operation will be done bit by bit so 1 AND 1 = 1 and 😉 all the rest is 0 ?

stefan ·

lalo wrote: thanx stefan!!

so do you mean that the AND operation is done between the 1111 1111 1111 1111 (if the condition is true) and the binary equivalent of 0.94 on a 16 bit basis...where 1 (float value) is equal to 1111 1111 1111 1111 ? so the AND operation will be done bit by bit so 1 AND 1 = 1 and 😉 all the rest is 0 ?

Yep, everything you said is correct except the stuff about 16 bit basis. It's 32bit floating point value basis, just bit-wise.

lalo ·

thanx...now i've all the understanding tools 😉

lalo

sonicfire ·

erm.....erm..... 😇

why do all these things use "monoin" for reduce, bitdepth for example? i thought you would use something like "float in" so that you can just attach a slider to it?! i hope someday i will understand that ... 🙁

infuzion ·

sonicfire wrote: why do all these things use "monoin" for reduce, bitdepth for example? i thought you would use something like "float in" so that you can just attach a slider to it?!

(Not to sound sarcastic) It's simple; you cannot 😀 The code & ASM components are meant to process audio data: You can trick them to process "green" data (put a Data:Float component before it if it isn't already Float). But understand that part of the schematic in the Code will always be eating CPU, opposed to just using Green componants which will run only when values change (or a Trigger signal is sent down the pipe). see [old link] for more info (I + the Overview just for you)

Tom7777 ·

why do all these things use "monoin" for reduce, bitdepth for example? i thought you would use something like "float in" so that you can just attach a slider to it?! i hope someday i will understand that ... 🙁

The code modules are currently for processing audio data only but of course you represent green data in the code by using floats -

float mask; mask = -1.999999

You can however use green data from outside the code module to control values by giving them a basic input and then connecting a slider ect to it.

streamin in; streamout out; streamin control; // connect to slider out = in*control;

The above is a simple volume control.

sonicfire ·

thanks!! and sorry for this dumb question, just getting into SM 😇

jobro ·

Thanks for the explanations! This will help me out a bit I think.

electrogear ·

Huh? Bit slow to respond there jobro :P

infuzion ·

electrogear wrote: Huh? Bit slow to respond there jobro :P

Never too late to say "Thank you" 😇

electrogear ·

infuzion wrote: electrogear wrote: Huh? Bit slow to respond there jobro :P

Never too late to say "Thank you" 😇

Haha, oh great, do you think my grandma would mind if I sent her a thankyou card for the birthday money she sent me last year? I think I'll just pretend I already sent one, she's going senile anyway.

Tom7777 ·

Dude the threads from 2005 😮

infuzion ·

Code/ASM is for only stream maths, thus Poly/Mono/Pack data. You can connect a float link directly into a Stream/Poly/Mono/Pack connector. (a kindof random question from an old thread?)

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.