concept int in category chuck

appears as: n int, int, int, ints
Programming for Musicians and Digital Artists: Creating music with ChucK

This is an excerpt from Manning's book Programming for Musicians and Digital Artists: Creating music with ChucK.

You can also initialize integers at the time they’re declared. For example, you can simultaneously declare an int named myPitch and set its value to 220, as shown in the following listing.

The next Standard library method will help you convert from floating-point numbers to integers. When you first realized you needed floating-point numbers to accurately express frequencies and gains, you might have typed in something that yielded an error because of trying to store a float into an int. The simplest example of that is

Table 2.1. ChucK Std library functions to convert string, float, and int data types

Method

Output

Description

Std.atoi(string value) int Converts ASCII (string) to integer
Std.atof(string value) float Converts ASCII (string) to float
Std.itoa(int value) string Converts integer to ASCII (string)
Std.ftoa(float value) string Converts float to ASCII (string)