timevalue
Time Value Syntax
Time representation in timbre.js uses a numeric value that indicates the milliseconds basically. timbre.timevalue()
converts a string to milliseconds, like as time value syntax of Max/MSP.
- Frequency
- Frequency can be specified by a single number followed by
hz
, such as "466.1637hz".
- Frequency can be specified by a single number followed by
- Milliseconds
- Milliseconds can be specified by a single number followed by
ms
, such as "250ms".
- Milliseconds can be specified by a single number followed by
- Seconds
- Seconds can be specified by a single number followed by
sec
, such as "1.5sec".
- Seconds can be specified by a single number followed by
- Minutes
- Seconds can be specified by a single number followed by
min
, such as "10.5min".
- Seconds can be specified by a single number followed by
- Hours:minutes:seconds
- Hours:minutes:seconds are specified with numbers separated by colons, such as "00:03:25", which means zero hours, 3 minutes, and 25 seconds. An optional millisecond value can be added after a period, for example: "00:03:25.230". Hours/minutes/seconds can also specified by a list of three or four numbers followed by
hh:mm:ss
.
- Hours:minutes:seconds are specified with numbers separated by colons, such as "00:03:25", which means zero hours, 3 minutes, and 25 seconds. An optional millisecond value can be added after a period, for example: "00:03:25.230". Hours/minutes/seconds can also specified by a list of three or four numbers followed by
- Samples
- Samples can be specified by a single number followed by
samples
, such as "1000samples". An optional samplerate value can be added with 'hz' keyword, for example: "100samples/44100hz".
- Samples can be specified by a single number followed by
- Note Length
- Note length can be specified by a single number followed by preceding
L
, such as "L4", which means quarter note. An optional bpm value can be added with 'BPM' keyword, for example: "BPM180 L16". If the bpm is omitted timevalue() will use the value of thetimbre.bpm
.
- Note length can be specified by a single number followed by preceding
- Bars.beats.units
- Bars.beats.units can be separated by periods, such as "2.3.240", which is 2 measures (bars), 3 beats, and 240 ticks. An optional bpm value can be added with 'BPM' keyword, for example: "bpm60 2.3.240". If the bpm is omitted timevalue() will use the value of the
timbre.bpm
.
- Bars.beats.units can be separated by periods, such as "2.3.240", which is 2 measures (bars), 3 beats, and 240 ticks. An optional bpm value can be added with 'BPM' keyword, for example: "bpm60 2.3.240". If the bpm is omitted timevalue() will use the value of the
- Ticks
- Ticks represent 1/480th of a quarter note, such as "480ticks", An optional bpm value can be added with 'BPM' keyword, for example: "bpm180 240ticks". If the bpm is omitted timevalue() will use the value of the "timbre.bpm".
Tips
Some properties, such as the T("interval").interval
, can be got the time value syntax.