<commit_before>;; Brief example indicating a minimal use of the Csound API from CLisp.
;; This file must be run from the csound5 directory,
;; not the csound5/examples directory, like this:
;; "clisp examples/test.lisp"

(load "csound.lisp")
(setq cs (csound::csoundCreate nil))
(csound::csoundCompileCsd cs "trapped.csd")
(setq *keep-playing* t result 0)
(loop while (and *keep-playing* (eq result 0)) do
      (setq result (csound::csoundPerformKsmps cs)))
<commit_msg>Changed for CFFI version of LISP interface.<commit_after>;; Rudimentary demonstration of how to use the Csound API from LISP.
;; This file assumes that Common Music and CFFI have been installed
;; for your LISP. You will have to change pathnames appropriately,
;; and change the cffi:load-foreign-library call to suit your installation.
;; Author: <NAME>

(load "c:/utah/home/mkg/projects/cm/src/cm.lisp")
(use-system :cffi)
(cffi:load-foreign-library "c:/utah/home/mkg/projects/csound5/_csnd.dll")
(load "c:/utah/home/mkg/projects/csound5/interfaces/csound5.lisp")
(setq cs (csound5::csound-create nil))
(cffi:with-foreign-string (csd "c:/utah/home/mkg/projects/csound5/examples/trapped.csd")
			  (csound5::csound-compile-csd cs csd))
(setq *keep-playing* t result 0)
(loop while (and *keep-playing* (eq result 0)) do
      (setq result (csound5::csound-perform-ksmps-1 cs)))

{'fraction_non_alphanumeric': 0.134173461823573, 'fraction_numerical': 0.010378057820607857, 'mean_word_length': 4.9734513274336285, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1156570', 'n_tokens_mistral': 504, 'n_tokens_neox': 475, 'n_words': 141}