Overview

ChucK is a strongly-typed, strongly-timed, concurrent(并发的) audio and multimedia(多媒体的) programming language. It is compiled(编译) into virtual(虚拟的) instructions, which is immediately run in the ChucK Virtual Machine. This guide documents the features(特色) of the Language, Compiler, and Virtual Machine for a ChucK programmer.

running ChucK

…this is a quick overview(综述), see VM options for a more complete guide to command line options.

To run ChucK with a program/patch called foo.ck simply run chuck and then the name of the file:

chuck foo.ck

To run ChucK with multiple patches concurrently(同时发生) (or the same one multiple times):

chuck foo.ck bar.ck bar.ck boo.ck

…the following probes(探查) the audio system and prints out all available audio devices and MIDI devices. You may then refer to them (by number usually) from the command line or from your program. (again, see VM Options for a complete list)

chuck --probe

ChucK can be run in a different terminal as a host/listener that patches may be sent to. The server should invoke(调用) the –loop flag to specify that the virtual machine should not halt(停止) automatically(自动地) (when the current programs exit).

chuck --loop

(See the guide to On-the-fly Programming for more information)

If a ChucK listener is running, we can (from a second terminal) send a program/patch to the listener by using the + command line option:

chuck + foo.ck

Similarly, you can use - and = to remove/replace a patch in the listener, and use ^ to find out the status. Again, see On-the-fly Programming for more information.

To run most of the code or examples in this language specification, you only need to use the basic chuck program.

comments(注释)

(Note: block comments cannot be nested(嵌入的))

// this is a comment
int foo; // another comment/* this is a block commentstill going...
*/

debug print(调试输出)

…we have provided a debug print syntax(语法):

// prints out value of expression
<<< expression >>>;

This will print the values and types of any expressions placed within them. This debug print construction may be placed around any non-declaration expression ( non l-value ) and will not affect the execution(执行) of the code. Expressions which represent an object will print the value of that object’s reference(引用) address:

// assign 5 to a newly declared variable
5 => int i;
// prints "5 : (int)"
<<<i>>>;// prints "hello! : (string)"
<<<"hello!">>>; //prints "hello! : (string)"// prints "3.5 : (float)"
<<<1.0 + 2.5 >>> => float x;

(ChucK中似乎是没有了print这一类)
(Chuck中有;,还是类似C的)

For more formatted(格式化) data output(输出), a comma-separated list of expressions will print only their respective(分别的) values (with one space between):

//接上段
// prints "the value of x is 3.5" (x from above)
<<<"the value of x is" , x >>>;// prints "4 + 5 is 9"
<<<"4 + 5 is", 4 + 5>>>;// prints "here are 3 random numbers ? ? ?"
<<<"here are 3 random numbers", Std.rand2(0,9), Std.rand2(0,9),Std.rand2(0,9) >>>;

输出:
C:\Users\abc1\Desktop>chuck “debug print.ck”
5 :(int)
“hello!” : (string)
3.500000 :(float)
the value of x is 3.500000
4 + 5 is 9
here are 3 random numbers 1 8 8

reserved words(关键字)

(primitive types原始类型)intfloattimedurvoidsame (unimplemented未实现的) (control structures)ifelsewhileuntilforrepeatbreakcontinuereturnswitch (unimplemented) (class keywords)classextendspublicstaticpurethissuper (unimplemented)interface (unimplemented)implements (unimplemented)protected (unimplemented)private (unimplemented) (other chuck keywords)functionfunsporkconstnew (special values)nowtruefalsemaybenullNULLmepi (special : default durations(默认持续时间))sampmssecondminutehourdayweek (special : global ugens(不理解))dacadcblackhole

ChucK初步(2)相关推荐

  1. TensorRT 7.2.1开发初步

    TensorRT 7.2.1开发初步 TensorRT 7.2.1开发人员指南演示了如何使用C ++和Python API来实现最常见的深度学习层.它显示了如何采用深度学习框架构建现有模型,并使用该模 ...

  2. SOC,System on-a-Chip技术初步

    SOC,System on-a-Chip技术初步 S O C(拼作S-O-C)是一种集成电路,它包含了电子系统在单个芯片上所需的所有电路和组件.它可以与传统的计算机系统形成对比,后者由许多不同的组件组 ...

  3. 《OpenCV3编程入门》学习笔记3 HighGUI图形用户界面初步

    第3章 HighGUI图形用户界面初步 3.1 图像的载入.显示和输出到文件 1.OpenCV命名空间2种访问方法 (1)代码开头加:usingnamespace cv; (2)每个类或函数前加:cv ...

  4. 初步判断内存泄漏方法

    有时候,内存泄漏不明显,或者怀疑系统有内存泄漏,我们可以通过下面介绍的方法初步确认系统是否存在内存泄漏. 首先在Java命令行中增加-verbose:gc参数, 然后重新启动java进程. 当系统运行 ...

  5. android蓝牙4.0(BLE)开发之ibeacon初步

    一个april beacon里携带的信息如下 ? 1 <code class=" hljs ">0201061AFF4C0002159069BDB88C11416BAC ...

  6. 游戏AI之初步介绍(0)

    目录 游戏AI是什么? 游戏AI和理论AI 智能的假象 (更新)游戏AI和机器学习 介绍一些游戏AI 4X游戏AI <求生之路>系列 角色扮演/沙盒游戏中的NPC 游戏AI 需要学些什么? ...

  7. 【转】ibatis的简介与初步搭建应用

    [转]ibatis的简介与初步搭建应用 一.ibatis的简介 ibatis是什么东西就不介绍了,自己去找谷老师. 这里讲下自己的使用体会.之前自己学过Hibernate,是看尚学堂的视频教学的,看完 ...

  8. 初步了解:使用JavaScript进行表达式(De Do Do Do,De Da Da Da)

    by Donavon West 由Donavon West 初步了解:使用JavaScript进行表达式(De Do Do Do,De Da Da Da) (A first look: do expr ...

  9. 存储过程和存储函数初步

    2019独角兽企业重金招聘Python工程师标准>>> 存储过程和函数初步 简单的来说,存储过程就是一条或者多条 SQL 语句的集合,可视为批处理文件,但是其作用不仅限于批处理. # ...

  10. 【spring框架】spring整合hibernate初步

    spring与hibernate做整合的时候,首先我们要获得sessionFactory. 我们一般只需要操作一个sessionFactory,也就是一个"单例",这一点很适合交给 ...

最新文章

  1. transformer bert seq2seq 深度学习 编码和解码的逻辑-重点
  2. 数据分析进阶 数据质量
  3. centos7+samba 安装与调试记录
  4. 刷算法题总结的一些结论公式
  5. datatables 更新选中行 的一行数据
  6. linux目录及重要文件(持续更新)
  7. 自由读写配置文件的艺术[java c++ node](二)
  8. 一图说清:做数据分析,到底要懂多少业务知识?
  9. JavaScript中圆括号()和方括号[]的一个特殊用法
  10. Dedecms文件夹目录解释完整版
  11. html改变游戏速度变慢,游戏不顺畅,卡顿的显卡设置方法
  12. 【BP预测】基于BP神经网络实现混凝土强度预测含Matlab源码
  13. 华硕bios更改固态硬盘启动_华硕主板BIOS设置固态硬盘启动顺序为第一启动硬盘教程...
  14. 【C/C++】多线程中的几种锁
  15. Pandas时间序列数据操作
  16. k8s-kubeadm安装(五 网络插件calico)
  17. 计算机中URL是指什么 ?
  18. 将sublime右下角永远改为HTML格式
  19. 服务器的网络不稳定是什么原因,家里网络不稳定是什么原因
  20. 现代家用计算机有哪些名称,世界上第一台现代电子计算机是什么?

热门文章

  1. 线下交易如何避免微信和支付宝交易风控
  2. yum源及常用安装包整理
  3. 集体建设用地审批程序:
  4. AI 让已故歌手重聚,再发4首原创新歌
  5. 模板templates的使用
  6. 更多免费资源解压密码_更多免费(几乎免费)法律图片资源
  7. java定时自动关机软件
  8. 爱上小西装外套的16个瞬间
  9. 史上最详细Lip-reading with Hierarchical Pyramidal Convolution and Self-Attention文章记录
  10. mysql slave是什么_是mysql表里