亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

ChucK初步(7)

2019-11-14 08:47:59
字體:
來源:轉載
供稿:網友

manipulating time

time and durationOperations (arithmetic)the keyWord ‘now’advancing timePRoperties

Manipulating Time

ChucK is a strongly-timed language, meaning that time is fundamentally(根本地) embedded(嵌入) in the language. ChucK allows the programmer to explicitly(明確的) reason about time from the code. This gives extremely flexible(靈活的) and precise(精確的) control over time and (therefore) sound synthesis(綜合).

In ChucK:

time and duration are native types in the languagekeyword now holds the current logical timetime is advanced (and can only be advanced) by explicitly(顯式地) manipulating(操縱) nowyou have flexible(靈活的) and precise(精確的) control

time and duration

Time and duration are native types in ChucK.

`time` represents an absolute(絕對的) point in time (from the beginning of ChucK time). 時間點`dur` represents a duration (with the same logical units as time). 時間段// a duration of one second1::second => dur foo;// a point in time (duration of foo from now)now + foo => time later;

Later in this section, we outline(概述) the various arithmetic operations(各種數學運算) to perform on time and duration.

Durations can be used to construct new durations, which then be used to inductively(歸納地) construct yet other durations. For example:

// .5 second is a quarter.5::second => dur quarter;// 4 quarters is whole4::quarter => dur whole;

By default, ChucK provides these preset(預先裝置的) duration values:

samp : duration(持續) of 1 sample(樣本 in ChucK timems : duration of 1 millisecond(毫秒)second : duration of 1 secondminute : 1 minutehour : 1 hourday : 1 dayweek : 1 week

Use these to represent any duration.

// the duration of half a sample.5::samp => dur foo;// 20 weeks20::week => dur waithere;// use in combination2::minute + 30::second => dur bar;// same value as above2.5::minute => dur bar;

operations on time and duration (arithmetic)

In ChucK, there are well-defined(定義明確的) arithmetic operations on values of type time and dur.


example 1 (time offset(偏移)):

// time + dur yields timenow + 10::second => time later;

example 2 (time subtraction):

// time - time yields durlater - now => dur D;

example 3 (addition):

// dur + dur yields dur10::second + 100::samp => dur foo;

example 4 (subtraction):

// dur - dur yields dur10::second - 100::samp => dur bar;

example 5 (division):

// dur / dur yields number10::second / 20::ms => float n;

example 6 (time mod):

// time mod dur yields dur now % 1::second => dur remainder;

example 7 (synchronize to period):

// synchronize to period of .5 second.5::second => dur T;T - (now % T) => now;

example 8 (comparison(比較) on time):

// compare time and timeif( t1 < t2 ) // do something...

example 9 (comparison on duration:

// compare dur and durif( 900::ms < 1::second ) <<< "yay!" >>>;

the keyword ‘now’

The keyword now is the key to reasoning about and controlling time in ChucK.思考控制時間的關鍵

Some properties(屬性) of now include:

now is a special variable(變量) of type time.now holds the current ChucK time (when read).modifying now has the side effects(副作用) of: advancing time (see below);suspending(暫停) the current process (called shred) until the desired time is reached - allowing other shreds and audio synthesis to compute; the value of now only changes when it is explicitly(明確地) modified(改動).

(also see next section on advancing time).

Example:

// compute value that represents "5 seconds from now"now + 5::second => time later;// while we are not at later yet...while( now < later ){ // print out value of now <<< now >>>; // advance time by 1 second 1::second => now;}

advancing time(推進時間)

Advancing time allows other shreds (processes進程) to run and allows audio to be computed in a controlled manner. There are three ways of advancing time in ChucK:

chucking (=>) a duration to now: this will advance time by that duration.chucking (=>) a time to now: this will advance time to that point. (note that the desired time must be later than the current time, or at least be equal to it.)chucking (=>) an Event to now: time will advance until the event is triggered(引發). (also see event)

advancing time by duration

// advance time by 1 second1::second => now;// advance time by 100 millisecond100::ms => now;// advance time by 1 samp (every sample)1::samp => now;// advance time by less than 1 samp.024::samp => now;

advancing time by absolute(絕對的) time

// figure out whennow + 4::hour => time later;// advance time to laterlater => now;

A time chucked to now will have ChucK wait until the appointed(約定的) time. ChucK never misses an appointment (unless it crashes)! Again, the time chucked to now must be greater than or equal to now, otherwise an exception(異常) is thrown.

advancing time by event

// wait on evente => now;

The advancement(推進) of time can occur(發生) at any point in the code.

// our patch: sine oscillator -> dacSinOsc s => dac;// infinite time loopwhile( true ){ // randomly choose frequency from 30 to 1000 Std.rand2f( 30, 1000 ) => s.freq; // advance time by 100 millisecond 100::ms => now;}

Furthermore(此外), there are no restrictions(限制) (other than underlying floating point precision除了基本的浮點精度) on how much time is advanced. So it is possible to advance time by a microsecond(微秒), a samp, 2 hours, or 10 years. The system will behave accordingly(相應地) and deterministically(確切地).

This mechanism(機制) allows time to be controlled at any desired rate, according to any programmable(可編程的) pattern. With respect to(關于) sound synthesis(合成), it is possible to control any unit generator at literally(字面地) any rate, even sub-sample rate.

The power of the timing mechanism is extended(延伸) by the ability to write parallel(并行) code, which is discussed in concurrency(并發性) and shreds.

properties

(see above)


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲成人教育av| 久热精品视频在线| 久久成人这里只有精品| 精品亚洲夜色av98在线观看| 亚洲天堂精品在线| 欧美第一黄网免费网站| 中文字幕亚洲一区二区三区| 日韩av在线一区| 亚洲欧美另类人妖| 欧美性猛交xxxx乱大交蜜桃| 在线观看欧美www| 国产日韩精品电影| 精品丝袜一区二区三区| 精品一区二区三区四区在线| 亚洲毛片一区二区| 一区二区三区 在线观看视| 秋霞av国产精品一区| 中文字幕久久亚洲| 另类天堂视频在线观看| 欧美黑人一级爽快片淫片高清| 亚洲国产精品一区二区三区| 亚洲精品久久久一区二区三区| 日韩电影免费在线观看中文字幕| 亚洲毛片在线观看.| 久久久亚洲国产| 欧美激情一区二区久久久| 日本久久久久久久久久久| 色老头一区二区三区在线观看| 亚洲欧美精品中文字幕在线| 亚洲深夜福利视频| 欧美限制级电影在线观看| 国产日韩在线视频| 一个人看的www欧美| 久久精品中文字幕电影| 国产精品高潮呻吟视频| 国产精品久久久久久久7电影| 97在线观看视频| 亚洲无限乱码一二三四麻| 在线观看欧美成人| 亚洲精品国产精品自产a区红杏吧| 日本19禁啪啪免费观看www| 国产精品日日做人人爱| 亚洲va久久久噜噜噜久久天堂| 亚洲女同性videos| 91香蕉嫩草神马影院在线观看| 国产成人亚洲综合91精品| 精品久久久av| 亚洲久久久久久久久久久| 亚洲电影免费观看高清完整版在线| 国产精品91免费在线| 日韩欧美中文免费| 亚洲国产精品久久久久秋霞蜜臀| 欧美在线影院在线视频| www.亚洲人.com| 精品久久久久久久中文字幕| 国产一区二区黑人欧美xxxx| 国产日韩欧美在线视频观看| 久久久精品一区二区| 91视频-88av| 中文字幕日韩在线观看| 欧美日韩一区二区免费视频| 日韩黄色高清视频| 久久久久国产精品免费网站| 日韩成人在线视频观看| 欧美成人中文字幕| 国产成人综合亚洲| 国产精品2018| 欧美黑人一级爽快片淫片高清| 成人精品aaaa网站| 66m—66摸成人免费视频| 欧美特级www| 欧美高清自拍一区| 日韩黄色高清视频| 性亚洲最疯狂xxxx高清| 美女久久久久久久久久久| 一区二区三欧美| 2019中文字幕在线免费观看| 成人高h视频在线| 精品久久久av| 国产精品久久久久久av福利软件| 亚洲国产中文字幕在线观看| 欧美精品免费看| 国产精品老女人精品视频| 亚洲精品久久久久久下一站| 茄子视频成人在线| 性亚洲最疯狂xxxx高清| 日本高清+成人网在线观看| yw.139尤物在线精品视频| 欧美最顶级的aⅴ艳星| 欧美激情性做爰免费视频| 国产91色在线免费| 欧美自拍视频在线| 国产成人精品免高潮在线观看| 国产欧美精品一区二区三区-老狼| 日本国产一区二区三区| 日韩av中文字幕在线| 91国偷自产一区二区三区的观看方式| 久久久久久18| 日韩有码在线播放| 欧美电影在线观看网站| 在线播放日韩专区| 奇米成人av国产一区二区三区| 国产精品日日做人人爱| 久久视频中文字幕| 日韩成人在线播放| 日韩av影视综合网| www.国产精品一二区| 91chinesevideo永久地址| 亚洲国产欧美一区二区丝袜黑人| 日韩中文字幕视频在线观看| 亚洲第一中文字幕在线观看| 97视频人免费观看| 欧美国产精品va在线观看| 91夜夜揉人人捏人人添红杏| 国产精品jizz在线观看麻豆| 国产精品va在线播放| 亚洲精品国产拍免费91在线| 中文字幕欧美精品在线| xxxx性欧美| 日本国产高清不卡| 亚洲激情自拍图| 久久影视电视剧免费网站清宫辞电视| 亚洲精品日产aⅴ| 国产日韩欧美中文在线播放| 欧美洲成人男女午夜视频| 永久免费毛片在线播放不卡| 欧美在线播放视频| 久久精品一区中文字幕| 神马久久桃色视频| 九九久久久久99精品| 中日韩午夜理伦电影免费| 日韩av综合网| 国产午夜精品全部视频在线播放| 亚洲欧美激情精品一区二区| 91在线中文字幕| 国产大片精品免费永久看nba| 欧美一性一乱一交一视频| 伊人亚洲福利一区二区三区| 欧美亚洲成人精品| 黑人精品xxx一区一二区| 成人福利在线观看| 亚洲欧美日本精品| 亚洲精品国产拍免费91在线| 97超级碰碰碰久久久| 国产精品电影在线观看| 国产高清视频一区三区| 久久人人看视频| 国产成人亚洲精品| 亚洲一区二区精品| 亚洲乱码一区av黑人高潮| 91久久中文字幕| 欧美另类极品videosbest最新版本| 中文字幕亚洲一区二区三区五十路| 欧美国产高跟鞋裸体秀xxxhd| 国产日韩欧美在线播放| 疯狂做受xxxx高潮欧美日本| 亚洲japanese制服美女| 庆余年2免费日韩剧观看大牛| 亚洲欧洲日本专区| 一本大道亚洲视频| 在线成人免费网站| 韩国视频理论视频久久| 中文字幕日韩综合av| 国产精品69av|