From dev at mobileink.com Thu May 4 05:29:40 2023 From: dev at mobileink.com (Gregg Reynolds) Date: Thu, 4 May 2023 07:29:40 -0500 Subject: [CM] libs7: a bazel-enabled distrib of s7 Message-ID: Hi folks, I've been using a derived version of s7 for months to build some tools for dealing with OCaml builds. I decided to polish it up a little and make it available as an independent package . It's basically the same as s7, but with a Bazel build program and a little reorganization. Bazel has excellent test facilities and works with multiple languages, so if you need to integrate s7 with other languages (python, rust, go, etc.) you might find libs7 worth a look. The main difference is replacement of the cload mechanism by a derived version, clibgen, that only generates C files, which are compiled and linked at build-time. The build program supports three linking strategies: build and link archive files at build-time; build shared libs and link them at build-time; and build shared libs and link/load them at runtime using dload. Initialization is handled by a single function, libs7_load_clib (Scheme version: load-clib) that takes a single arg (the libname) and works with all three link strategies. For example there are three ways to run the repl: bazel run repl --//config/clibs/link=archive (the default, so you can do just 'bazel run repl') bazel run repl --//config/clibs/link=shared bazel run repl --//config/clibs/link=runtime In all three cases you can then do something like (load-clib 'gdbm). The Scheme APIs for clibs use colon-namespaces, e.g. (gdbm:version), (libc:isalpha 65), etc. I've added a new clib, cwalk , for manipulating path strings. For example (cwk:path-normalize "a/b/..c") => "a/c". All C library dependencies are built; there is no reliance on system-installed libs. So for example the gdbm bindings are in libgdbm_s7.c, which is generated from libgdbm_clibgen.scm; it depends on libgdbm, which will be downloaded and built when you build libgdbm_s7. The downside of this is that the initial build may take quite a while. If you depend on libarb, you'll have to wait while Bazel builds libgmp, libflint, libmpfr, and libarb. libgsl also takes a while to build. So the default config for the test and repl targets does not depend on those. The upside is that your builds will be mostly hermetic, and you'll never have to deal with lib versioning clashes or worry about non-standard installation locations of clib deps. I've also added a testsuite using the Unity framework. It works very well with s7. I don't have a lot of test cases, but there are enough to verify that the clib bindings are in working order. More details are available in the README at libs7 . Feedback welcome. Gregg -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Thu May 4 12:43:05 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 04 May 2023 12:43:05 -0700 Subject: [CM] libs7: a bazel-enabled distrib of s7 In-Reply-To: References: Message-ID: <717a26c23a9dac0945d5e568d2c5de5e@ccrma.stanford.edu> That's very impressive! I'll add a pointer to it to s7's README.md. Thanks! (The libarb support in s7 was really just for my amusement -- I wanted to play with the Bessel functions). From TestCase at asu.edu Thu May 18 20:18:51 2023 From: TestCase at asu.edu (Todd Ingalls) Date: Fri, 19 May 2023 03:18:51 +0000 Subject: [CM] Issue with formant-bank Message-ID: <6DE29C15-8DA1-4C83-B146-E7CF1DA72C1F@asu.edu> Hi Bill Just wanted to check in with a possible bug in formant-bank. With the python bindings I am working on I noticed the following issue but then I also found it when using snd. I think the best example is the move-formants example on sndclm.html. When I run this the formant filters don?t seem to move and just stick at the same frequencies they started at. I can see that using mus-frequency changes the frequency of each of the formant generators but it seems that does not impact the output of the formant-bank. Maybe something is wacky on my end but wanted to bring it to your attention... Todd Ingalls -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Fri May 19 06:30:47 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Fri, 19 May 2023 06:30:47 -0700 Subject: [CM] Issue with formant-bank In-Reply-To: <6DE29C15-8DA1-4C83-B146-E7CF1DA72C1F@asu.edu> References: <6DE29C15-8DA1-4C83-B146-E7CF1DA72C1F@asu.edu> Message-ID: Ouch! I optimized formant-bank at some point, and broke that instrument. I think this slower version works: (definstrument (move-formants start file amp radius move-env num-formants) (let* ((frms (make-vector num-formants)) (beg (seconds->samples start)) (dur (mus-sound-framples file)) (end (+ beg dur)) (rd (make-readin file)) (menv (make-env move-env :length dur))) (display dur) (newline) (let ((start-frq (env menv))) (do ((i 0 (+ i 1))) ((= i num-formants)) (set! (frms i) (make-formant (* (+ i 1) start-frq) radius)))) (do ((k beg (+ k 1))) ((= k end)) (let ((frq (env menv)) (sum 0.0) (inp (readin rd))) (do ((i 0 (+ i 1))) ((= i num-formants)) (set! sum (+ sum (formant (frms i) inp)))) (outa k (* amp sum)) (do ((i 0 (+ i 1)) (curfrq frq (+ curfrq frq))) ((= i num-formants)) (if (< (* 2 curfrq) *clm-srate*) (set! (mus-frequency (frms i)) curfrq))))))) (with-sound (:srate 22050) (move-formants 0 "oboe.snd" 2.0 0.99 '(0 1200 1.6 2400 2.0 1400) 4)) I need to figure out how to handle the original case -- the optimization moved all the filter innards into the some arrays in formant-bank, so setting the original formant fields had no effect on the formant-bank (oops... -- but it's faster!). Thanks very much for pointing this out! From TestCase at asu.edu Fri May 19 09:58:20 2023 From: TestCase at asu.edu (Todd Ingalls) Date: Fri, 19 May 2023 16:58:20 +0000 Subject: [CM] Issue with formant-bank In-Reply-To: References: <6DE29C15-8DA1-4C83-B146-E7CF1DA72C1F@asu.edu> Message-ID: <727FE8DA-1FC2-4F80-8048-8DF8770F0B51@asu.edu> No problem - just going through and implementing various examples to find all the bugs in my code. Todd Ingalls Associate Director School of Arts, Media and Engineering ame.asu.edu On May 19, 2023, at 6:30 AM, bil at ccrma.Stanford.EDU wrote: Ouch! I optimized formant-bank at some point, and broke that instrument. I think this slower version works: (definstrument (move-formants start file amp radius move-env num-formants) (let* ((frms (make-vector num-formants)) (beg (seconds->samples start)) (dur (mus-sound-framples file)) (end (+ beg dur)) (rd (make-readin file)) (menv (make-env move-env :length dur))) (display dur) (newline) (let ((start-frq (env menv))) (do ((i 0 (+ i 1))) ((= i num-formants)) (set! (frms i) (make-formant (* (+ i 1) start-frq) radius)))) (do ((k beg (+ k 1))) ((= k end)) (let ((frq (env menv)) (sum 0.0) (inp (readin rd))) (do ((i 0 (+ i 1))) ((= i num-formants)) (set! sum (+ sum (formant (frms i) inp)))) (outa k (* amp sum)) (do ((i 0 (+ i 1)) (curfrq frq (+ curfrq frq))) ((= i num-formants)) (if (< (* 2 curfrq) *clm-srate*) (set! (mus-frequency (frms i)) curfrq))))))) (with-sound (:srate 22050) (move-formants 0 "oboe.snd" 2.0 0.99 '(0 1200 1.6 2400 2.0 1400) 4)) I need to figure out how to handle the original case -- the optimization moved all the filter innards into the some arrays in formant-bank, so setting the original formant fields had no effect on the formant-bank (oops... -- but it's faster!). Thanks very much for pointing this out! -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Thu May 25 06:11:16 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 25 May 2023 06:11:16 -0700 Subject: [CM] Snd 23.4 Message-ID: <55b8807f1c201586f74bf84c1f2298e5@ccrma.stanford.edu> Snd 23.4 fixed a move-formants bug which also affected bullfrog and leopard-frog in animals.scm. checked: FC 38, Ubuntu 23.04, sbcl 2.3.4 Thanks!: johnm, Todd Ingalls