Jump to content


Photo
- - - - -

formula - logic gates ?

formula

  • Please log in to reply
5 replies to this topic

#1 flying_blotter

flying_blotter

    New Member

  • Normal Members
  • Pip
  • 3 posts

Posted 01 July 2016 - 17:49

I am trying to implement logic gates, like : y = A and B, y = A or B etc.

 

It does not work, can we have logic gates please (this would obviously work only with square waves) ?

 

I know that I could encode this using volume instead, and have decoders,  but having straight logic operators would be amazing. 

 

 

 

Can we have logic gates please? 


Edited by flying_blotter, 01 July 2016 - 17:49.


#2 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1255 posts
  • Gender:Male
  • Location:Oops
  • Interests:Flying

Posted 01 July 2016 - 19:44

I do not understand what you are trying to achieve. You mean a volume gate - the formula device is just a meta device, and you are supposed to code your logic & link it to a gainer or gate device to modify sound volume (and gate the volume)? Or are you just after programming techniques to use "gate logics" in your custom formula code?

 

The formula tool lacks any library other than math, also the bit operations that rns lua tools can use, but has "the full basic lua" inside otherwise. There are always ways to translate logical operations to floating point and/or boolean/conditional operations. If you give a concrete (please not too complex) example of what you wish one or a few formula devices in interaction should do - I might demonstate such techniques to you.



#3 flying_blotter

flying_blotter

    New Member

  • Normal Members
  • Pip
  • 3 posts

Posted 01 July 2016 - 20:32

Sorry for not being clear - I proposed that let say your A is clock (from lfo spitting out a square wave) and B is your clock, both with different period, you want your output to be high if and only if if both of them are high .  

 

It seems that such thing is not possible now

 

Mind you I do not know Lua language and I am complete noob when it comes to DSP, but I do know VHDL - but that is a bit different,  the manual is rather not helpful when describing this meta device and it seems that basic AND, NOT, OR

 

operators are not available.

 

What I have said that you could have A at 25% of max possible gain and B at 25% of gain, and just assume that 50% of gain is equal to a logic 1 - same effect but rather not robust. 

 

So I would be grateful to know how one would realize an AND gate and a NOT gate using the formula meta device ? So :

 

1)A and B gives 1 on the output only when both A and B are high

 

2) NOT would be inverting whatever is being fed let say on input A 

 

So the output signal Y would be then used to switch stuff on or off in the project. 

 

Any help will be much appreciated - still time to read ona Lua I guess.

 

edit: ok I am being silly: 1st would be done A*B and  2nd (-1)*A 

 

This topic can be deleted, thanks anyway :]


Edited by flying_blotter, 01 July 2016 - 20:45.


#4 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1255 posts
  • Gender:Male
  • Location:Oops
  • Interests:Flying

Posted 01 July 2016 - 22:14

Hi!

 

Good you found your first solutions yourself!

 

Yes, lua has no bitops (which include gate/binary operations), only values (floating point) or bools (which can do logics as well, and maybe even be converted, but...hehe). As I said, the renoise tool interface has bitops, but formula device not, well, one can code simple gates oneself with float or bools.

 

I've coded some building blocks for you in the float way, as I think it fits the input/output format best. You can just put them into the user field to use the functions in there or in the formula field.

 

Spoiler

 

all the functions should be self explaining, and with exception of the first they need each input value be _exactly_ either 1.0 or 0.0 to work correctly. this is why the first function "gdisc()" is there, you can make a value between 0.0 and 1.0 be exactly either of them, depending on it being above or below the second parameter, if you give only one parameter this threshold is considered to be 0.5. It is useful for doing these logics with input from stuff like the signal follower. sorry for the "g" in front of these functions, but "and", "not" and "or" are reserved names I think.

 

The results will be either 0.0 or 1.0, too (if not abused...), so you can happily multiply other values with them to make them jump between whatever they are and zero.

 

For example you could do a "formula" with this like "gnot( gxor( gdisc(A), gdisc( B) ) )" which will be "NOT ( A XOR B )", and you can leave out the "gdisc" commands if you use LFOs in point mode with only exactly 0.0 or 1.0 value points.

 

Have fun, I only tested this vaguely...

 

EDIT: I replaced the messy XOR function with something more straightforward


Edited by OopsIFly, 02 July 2016 - 14:12.

  • flying_blotter likes this


#5 oneunkind

oneunkind

    Big GrandDaddy Member

  • Normal Members
  • PipPipPipPipPipPipPipPip
  • 459 posts
  • Gender:Male
  • Interests:the next space age

Posted 02 July 2016 - 06:28

You say 'this would obviously work only with square waves', which makes me think you are talking about getting digital output from analog logic.  What is the difference between analog logic and min/max function in the formula device? I am only asking, not suggesting a solution.


sounds but not music


#6 flying_blotter

flying_blotter

    New Member

  • Normal Members
  • Pip
  • 3 posts

Posted 13 July 2016 - 12:48

Sorry I was away.

 

Thanks a lot for your input  OopsFly, much appreciated !

 

 

@oneunkind : I am wrong, my bad, it could work with any wave.

 

Conceptually you could do logic with min/max or with any other function - depends how you encode/decode your information - this is arbitrary. The question is how much you have to fiddle with it to get the result you want.

 

So with Min/Max you get the minimum or maximum output - these are comparators and one output is being chosen accordingly for the output.

 

What I was after is to send a high signal when 2 or 3 inputs are high at the same time, and leave the output 0 in any other case.

 

So with eg. Max, you would just get the copy of the max signal, ignoring what has happened to the other two - a false logic 1 - but again you could be creative and encode it in some way. 







Also tagged with one or more of these keywords: formula