ChAI : ChucK for AI
(version: need ChucK-18.104.22.168 or higher
ChAI is also available in WebChucK)
ChAI (ChucK for AI) is a framework for music and artificial intelligence in the ChucK programming language. It contains a set of tools, algorithms, data, and examples for working with supervised learning, unsupervised learning, neural networks, interative music generation, and education. Whenever possible, ChAI is designed to operate in a real-time, interactive context. Combining audio analysis, machine learning/AI, and sound synthesis, ChAI aims to support artful toolbuilding for music composition, performance, design of instruments and expressive toys, making use of AI as a tool for human expression.
Tools and Examples
ChAI [beta] first appeared in chuck-22.214.171.124 (January 2023) with a first release in chuck-126.96.36.199 (May 2023). ChAI's development is ongoing. This means that some of the APIs may change moving forward. Presently, available tools and examples include: MLP, Wekinator, KNN, KNN2, SVM, HMM, PCA, Word2Vec—with more on the way. Additionally, additional audio features have been added to the unit analyzer framework, including MFCC, Chroma, Kurtosis, SFM. The API for these objects can be found in the ChAI Documentation or by calling their respective .help() method—e.g., MLP.help();—which will print the Object API to the console or terminal. Examples (also in beta!) can be found in examples/ai/. Additionally, these also be accessed in WebChucK IDE, under Examples->More Examples->ai.
Beginning in 2023, ChAI has been used in the graduate-level "critical making" course Music and AI (Music 356 / CS 470) at Stanford University. See some examples of the students' creatives works: homework gallery. The development of ChAI is deeply indebted to the intrepid students of "Music and AI"—and to their immense creativity, and their awareness to be critical about AI.
A Historical Note + Acknowledgements
Much of ChAI and its ways of thinking and doing can be foundationally attributed to the work of Dr. Rebecca Fiebrink, her landmark Ph.D. Thesis, Real-time Human Interaction With Supervised Learning Algorithms for Music Composition and Performance , the Wekinator framework , her teaching at the intersections of AI, HCI, and Music , as well as earlier collaborations between Rebecca and Ge [4,5] including SMIRK  (Small Musical Information Retrieval toolKit; 2008; early efforts in on-the-fly learning), MARSYAS and the foundational MIR work of Dr. George Tzanetakis [7,8] (along with the humanistic and musical motiovations behind it), and the unit analyzer framework  (2007; which affords real-time audio feature extraction). All of these have directly or indirectly contributed the creation of ChAI. Additionally, ChAI benefitted from the teaching and design philosophy of Dr. Perry R. Cook (Ph.D. advisor to Rebecca, George, and Ge at Princeton, and ChucK co-author), who argued for the importance of real-time human interaction, parametric sound synthesis, and the importance of play in the design of technology-mediated musical tools. Fiebrink, Rebecca. 2011. Real-time Human Interaction With Supervised Learning Algorithms for Music Composition and Performance Ph.D. Thesis. Princeton University.
 http://www.wekinator.org/ Wekinator | Software for real-time, interactive machine learning
 Fiebrink, Rebecca. "Machine Learning for Musicians and Artists." Kadenze online course.
 Fiebrink, R., G. Wang, P. R. Cook. 2008. "Foundations for On-the-fly Learning in the ChucK Programming Language." International Computer Music Conference.
 Fiebrink, R., G. Wang, P. R. Cook. 2008. "Support for Music Information Retrieval in the ChucK Programming Language." International Conference on Music Information Retrieval (ISMIR).
 http://smirk.cs.princeton.edu/ sMIRk | Small Music Information Retrieval toolKit
 Tzanetakis, G. and P. R. Cook. 2000 "MARSYAS: A Framework for Audio Analysis." Organised Sound. 4:(3)
 Tzanetakis, G. and P. R. Cook. 2002 "Musical Genre Classification of Audio Signals." IEEE Transaction on Speech and Audio Processing. 10(5).
 Wang, G., R. Fiebrink, P. R. Cook. 2007. "Combining Analysis and Synthesis in the ChucK Programming Language." International Computer Music Conference.
"ChAI ON-THE-FLY" — a collaborative ChAI working logo