User-Defined Opcode Database

findPowerOfTwo

Given a value in seconds, finds a power of two size equal to or greater than it in samples

Download UDO File

Description

Given a value in seconds, finds a power of two size equal to or greater than it.

Syntax

isamples findPowerOfTwo iseconds

Code

	opcode findPowerOfTwo, i, i

iseconds	xin

isamples	= iseconds * sr

ipowtwosamples = 2

loop:

ipowtwosamples = ipowtwosamples * 2

if ipowtwosamples < isamples igoto loop

	xout ipowtwosamples

	endop

Credits

Author: Steven Yi


Previous Home Next
pvshift   Statevar