| User-Defined Opcode Database |
|---|
Converts a floating point number in the format min.sec to seconds
Download UDO FileConverts a floating point number in the format min.sec to seconds
isec MS2S iminsec
iminsec - a float in the format min.sec. the first two digits of the fractional part are the full seconds, the following ones mean 1/10, 1/100, ... seconds. See the examples below.
isec - number of seconds equating iminsec
opcode MS2S, i, i ifloat xin imin = int(ifloat) isec = frac(ifloat) * 100 xout imin*60 + isec endop
<CsoundSynthesizer> <CsOptions> -n </CsOptions> <CsInstruments> opcode MS2S, i, i ;converts a float in the format min.sec to seconds ifloat xin imin = int(ifloat) isec = frac(ifloat) * 100 xout imin*60 + isec endop instr 1 isec MS2S p4 prints "%f\n", isec endin </CsInstruments> <CsScore> i 1 0 0 4.33 i 1 0 0 60 ;one hour i 1 0 0 0.20 ;twenty seconds i 1 0 0 0.2 ;also twenty seconds i 1 0 0 0.02 ;two seconds i 1 0 0 0.00001 ;one millisecond i 1 0 0 26.011499 ;26' 1.1499'' </CsScore> </CsoundSynthesizer>
joachim heintz 2011
| Previous | Home | Next |
| Moogladder | msrOsc |