Forums > MaxMSP

How do i get binary gates from a signal?

August 25, 2011 | 2:55 pm

and vice versa?

My google sense tells me this will be impossible to find. Search terms: max msp, dac, adc, raw bits, signal etc. Hard. Thus my question:

Is there an external to convert a signal into the bits it’s made of? A virtual "digital adc", if you will, with one inlet and 24 outlets. Or preferably a selectable amount of outlets to avoid terrible patchcord messes. And of course an inverted version, a "digital dac".

Any ideas? I’d love patching one up, I just have no idea about how dacs or adcs work…


August 25, 2011 | 5:06 pm

you should be able to do that with the MSP bitwise operators, no?


August 29, 2011 | 2:32 pm

Not that I know of. They do bitwise stuff that is cool but I want to manipulate the individual bits as 0-1 signals.

Anyone?


August 31, 2011 | 10:59 am

Roman is right, the bitwise operators are designed to do exactly that.


September 1, 2011 | 8:00 pm

Sorry, I didn’t have Max available when I first replied. I’m assuming you want to deal with integer values in your signal? If so, here’s how to handle an 8-bit number…

– Pasted Max Patch, click to expand. –

September 4, 2011 | 8:13 pm

Ah. Very grateful. I guess reversing it should be just as easy? No time to try now. I’ll probably figure it out. Thanks!


September 5, 2011 | 8:46 am

You’re welcome :)

Although it is do-able, I think reversing this process will throw up a number of ugly problems unless you know exactly what you’re doing. The above technique relies on [bitand~]‘s ability to convert a floating-point number into an integer internally.

The binary representation of an integer is very different to that of a float. See W!k!p3d!a for more details.

You’d probably be better off just using the 8 exponent bits (and forgoing the costly "convert to integer representation" process that I had [bitand~] performing earlier). If you’re struggling with the concept, I’ll knock up a patch when I next have Max handy.

If you manually pack bits into a floating point number, it’s possible to create some unusual ‘numbers’ (NaN, -infinity, +infinity). Max/MSP objects don’t play nicely with such values.


September 5, 2011 | 8:49 am

I’m curious… What are you using this for?

I do a lot of signal-rate stuff that uses a fair bit of logic, but I’ve never had the need to do what you’re attempting. Either there’s an easier way to do what you want, or you’re doing something seriously tech and exciting!!!


September 15, 2011 | 2:08 pm

…Ok, i have no idea how to convert the bits into "analog" again. My bad.

Basically i just want to do crazy stuff with them. Not tech so much as stupid I guess. Things like:
Take, say 12 bits and do CA style rule manipulations,
delay individual bits by different amount of samples per bit,
do bit0 XOR bit1 OR bit2 AND bit3 XOR bit4,
shuffle them about randomly,
invert them randomly,
invert them based on logic,
shift right or left based on total number of 1s,
interleave/shuffle bits from two sounds
delay them for a set amount of samples based on CA rules…

I don’t know. I hope that when i get them all out things should start falling into place.

If it’s easier to do this some other way I’d of course do it that way but I have no idea what that would be.

Nan, inf and -inf should be ok with a bitshift~, no? Most things will probably sound crap-ish but that’s kind of the point.

So if you’d like to throw together a patch I’d be very grateful. If I get something cool out of it I could always post it here.


September 15, 2011 | 3:40 pm

OK, I had a quick look and it’s not totally straightforward. Let me puzzle something out and I’ll get back to you – maybe not straight away.

Independent per-bit delay sounds intriguing…

I suspect all this twiddling will probably result in very same-y crust, but who knows? Time to play…


September 15, 2011 | 3:42 pm

But back to your main problem, recombining…

It ought to be a case of simply [bitor~]ing all the signals back together. You’ll need a whole bunch of [bitor~]s though.


September 15, 2011 | 3:51 pm

Yes, most modes will probably sound same-same. But you never know. The delay part is most intriguing, yes!

Anything like this? I’m just guessing basically.

– Pasted Max Patch, click to expand. –

September 15, 2011 | 5:28 pm

Oh, and bitwise surround panning! Four sources, four speakers, and all the bits swapped around consecutively. Could be fun.


September 15, 2011 | 7:27 pm

it will probably sound like crap, but you can always tell the audience: "but it is bitwise
surround panning! dont you understand the concept!?!"

maybe it is almost as cool as the converting the ASCII of the american constitution
into audio and then pan it hard to the right.


September 16, 2011 | 12:22 am

Exactly!!


October 16, 2011 | 12:05 am

Any progress? I haven’t thought much about it, got no idea how to do it.

(I have bought a G2 engine though, so I can do some stuff in 8 bits there as soon as it gets here.)

Btw actually I think the bitwise surround stuff could be nice with simple sounds for drony stuff! Maybe just not drumkits and choir music.



FP
November 27, 2012 | 8:24 pm

any news ? I’m interesting too. :-)


Viewing 17 posts - 1 through 17 (of 17 total)