From wdouglass at carnegierobotics.com Wed Mar 1 13:49:32 2023 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Wed, 1 Mar 2023 21:49:32 +0000 Subject: [CM] Possible bug in call-with-exit Message-ID: Bill et all, consider the following program ``` #include "s7.h" #include "stdio.h" s7_pointer inner_test(s7_scheme *s, s7_pointer args) { s7_error(s, s7_make_symbol(s, "test-error"), s7_list(s, 1, s7_make_string(s, "TEST ERROR"))); return s7_nil(s); } s7_pointer test_fn(s7_scheme *s, s7_pointer args) { fprintf(stderr, "before INNER call\n"); s7_call_with_catch(s, s7_t(s), s7_name_to_value(s, "inner-test"), s7_name_to_value(s, "inner-test-handler")); fprintf(stderr, "after INNER call\n"); return s7_nil(s); } s7_pointer inner_test_handler(s7_scheme *s, s7_pointer args) { fprintf(stderr, "INNER CATCH\n"); return s7_nil(s); } int main(int argc, char *argv) { s7_scheme *s = s7_init(); s7_define_function(s, "test-fn", test_fn, 1, 0, false, "call the inner test"); s7_define_function(s, "inner-test", inner_test, 0, 0, false, "throw"); s7_define_function(s, "inner-test-handler", inner_test_handler, 2, 0, false, "do nothing"); s7_eval_c_string(s, "(call-with-exit test-fn)"); s7_quit(s); } ``` When `inner_test` throws its error, i expect `inner_test_handler` to get called, and then control return after the s7_call_with_catch call. However, when called inside `call-with-exit` (as above), control returns after that call (at the bottom of the program) this was tested with s7 a667b1f36282a6401a634035b25b2ac82a635ebd I'm going to keep looking at this tonight, but if anyone else can see the issue I'd appreciate it! Thanks, Woody Douglass PS I'm compiling this program with the following ``` gcc -o catch-return-test catch-return-test.c s7.c -ldl -lm ``` From bil at ccrma.Stanford.EDU Wed Mar 1 15:42:58 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 01 Mar 2023 15:42:58 -0800 Subject: [CM] Possible bug in call-with-exit In-Reply-To: References: Message-ID: <417054d036b449ef06934b3d3e21848d@ccrma.stanford.edu> I think s7_call_with_catch needs to set a jump point for the sc->longjmp_ok case, but I haven't figured out yet how to capture the error handler result in all cases. Here's what I have now: (ca line 51216) else { declare_jump_info(); TRACK(sc); store_jump_info(sc); set_jump_info(sc, S7_CALL_SET_JUMP); /* ?? */ catch_cstack(p) = &new_goto_start; if (jump_loc == NO_JUMP) { push_stack(sc, OP_CATCH, error_handler, p); result = s7_call(sc, body, sc->nil); if (((opcode_t)sc->stack_end[-1]) == OP_CATCH) sc->stack_end -= 4; } else result = sc->nil; /* wrong: should be the error handler result I think */ restore_jump_info(sc); } ffitest.c has test cases that break this code. I'll poke at it tomorrow -- thanks for the bug report! From cian.oconnor at gmail.com Tue Mar 7 07:02:57 2023 From: cian.oconnor at gmail.com (Cian) Date: Tue, 7 Mar 2023 10:02:57 -0500 Subject: [CM] Broken Motif build on OSX Message-ID: Following the osx instructions in the readme.snd file I had to modify the suggested config script to the following (obviously I was building for the M1): ./configure -prefix=/opt/snd-s7 CFLAGS="-target arm64-apple-macos11 -I/opt/homebrew/Cellar/openmotif/2.3.8_2/include -I/opt/X11/include" LDFLAGS="-L/opt/homebrew/Cellar/openmotif/2.3.8_2/lib -L/opt/X11/lib" --with-s7 --with-motif --with-gsl I think this is because homebrew has changed where it installs certain files. However this failed, as when I built it complained about the following missing file: /opt/homebrew/Cellar/openmotif/2.3.8_2/include/Xm/Xm.h:63:10: fatal error: 'X11/extensions/Print.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. This file has been removed from the OSX Quartz distribution and currently this won't build on OSX. snd builds fine without a gui, but the gui build is currently broken. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Tue Mar 7 07:24:30 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 07 Mar 2023 07:24:30 -0800 Subject: [CM] Broken Motif build on OSX In-Reply-To: References: Message-ID: <078d596831cc733bb04df1970efca79b@ccrma.stanford.edu> I think some of the newer Motif packages (like post-2012) need both /usr/include/X11/extensions/Print.h and /usr/include/X11/bitmaps/gray -- in the latter case I sometimes have to create the bitmaps directory. I can send you copies of these files if needed. There was a time when everyone was saying Motif was going away, replaced by gtk, but now it's gtk that is disliked, and in the background, Motif just keeps plugging along without any visible support. So the README.Snd file is a mess. I'll add this note about Print.h and gray. Thanks for the bug report. From cian.oconnor at gmail.com Tue Mar 7 08:00:36 2023 From: cian.oconnor at gmail.com (Cian) Date: Tue, 7 Mar 2023 11:00:36 -0500 Subject: [CM] Broken Motif build on OSX In-Reply-To: <078d596831cc733bb04df1970efca79b@ccrma.stanford.edu> References: <078d596831cc733bb04df1970efca79b@ccrma.stanford.edu> Message-ID: Oh yes that would be greatly appreciated! Thanks! On Tue, Mar 7, 2023 at 10:24?AM wrote: > I think some of the newer Motif packages (like post-2012) > need both /usr/include/X11/extensions/Print.h and > /usr/include/X11/bitmaps/gray -- in the latter case I > sometimes have to create the bitmaps directory. > I can send you copies of these files if needed. > > There was a time when everyone was saying Motif was > going away, replaced by gtk, but now it's gtk that > is disliked, and in the background, Motif just > keeps plugging along without any visible support. > So the README.Snd file is a mess. I'll add this > note about Print.h and gray. > > Thanks for the bug report. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Mon Mar 13 10:41:05 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Mon, 13 Mar 2023 10:41:05 -0700 Subject: [CM] Snd 23.2 Message-ID: <1f7a0a00b3f8b9c64ab82f61c9c2ce9d@ccrma.stanford.edu> Snd 23.2 the usual minor bugfixes and whatnot. checked: sbcl 2.3.2 Thanks!: Woody Douglass From TestCase at asu.edu Thu Mar 23 11:15:24 2023 From: TestCase at asu.edu (Todd Ingalls) Date: Thu, 23 Mar 2023 18:15:24 +0000 Subject: [CM] Python bindings Message-ID: Hello Bill, Everyone Have found myself having to use python a lot lately and have not been too happy with choice of sound libs I started making bindings for sndlib https://github.com/testcase/pysndlib There is a lot more to do but just wanted to mention this in case anyone else is working on the same thing or may want to hack this or make recommendations, etc I used ctypesgen (https://github.com/ctypesgen/ctypesgen) to generate bindings from header files and then have been coding wrapper functions. I used ctypes for the ffi and also want it to work nicely with numpy. Really want to keep this as simple as possible. I also focused on trying to be as literal as possible with translation so that it would be easy to port existing examples. This may mean something aren?t pythonic. It is not exactly fast but was not expecting it to be using python/ Want to also be able to use this in juypter notebooks for teaching sound synthesis next year Many rough edges and things to be documented. Error handling in non-existent but feel like I at least have some working examples. There is an examples.py file with some simple things just ported from the the simple examples in the docs. Hope to address much of this in coming month or so. Of course all thanks to Bill for everything . This is really just simple translation of everything you have done. Would be happy to see this folded into main project or keep is separate for easier maintenance. Whatever is best To give a sense here is an example with jc-reverb and some simple instrument. def jc_reverb(lowpass=False, volume=1., amp_env = None): allpass1 = make_all_pass(-.7, .7, 1051) allpass2 = make_all_pass(-.7, .7, 337) allpass3 = make_all_pass(-.7, .7, 113) comb1 = make_comb(.742, 4799) comb2 = make_comb(.733, 4999) comb3 = make_comb(.715, 5399) comb4 = make_comb(.697, 5801) chans = Sound.output.mus_channels length = Sound.reverb.mus_length filts = [make_delay(seconds2samples(.013))] if chans == 1 else [make_delay(seconds2samples(.013)),make_delay(seconds2samples(.011)) ] combs = make_comb_bank([comb1, comb2, comb3, comb4]) allpasses = make_all_pass_bank([allpass1,allpass2,allpass3]) if lowpass or amp_env: flt = make_fir_filter(3, [.25, .5, .25]) if lowpass else None envA = make_env(amp_env, scaler=volume, duration = length / mus_srate()) if lowpass: for i in range(length): out_bank(filts, i, (env(envA) * fir_filter(flt, comb_bank(combs, all_pass(allpasses, ina(i, Sound.reverb)))))) else: for i in range(length): out_bank(filts, i, (env(envA) * comb_bank(combs, all_pass_bank(allpasses, ina(i, Sound.reverb))))) else: if chans == 1: gen = filts[0] for i in range(length): outa(i, delay(gen), volume * comb_bank(combs, all_pass_bank(allpasses, ina(i, Sound.reverb)))) else: gen1 = filts[0] gen2 = filts[1] for i in range(length): val = volume * comb_bank(combs, all_pass_bank(allpasses, ina(i, Sound.reverb))) outa(i, delay(gen1, val)) outb(i, delay(gen2, val)) def blip(beg, dur, freq): start = seconds2samples(beg) end = seconds2samples(dur) + start loc = make_locsig(degree=random.randrange(-90, 90), distance=1., reverb=.7) cmb = make_comb(0.4, seconds2samples(0.4)) osc = make_oscil(freq) ampf = make_env([0.0, 0.0, 1.0, 1.0, 2.0, 1.0, 3.0, 0.0], length=4410) for i in range(start, end): locsig(loc, i, 0.5 * (comb(cmb, env(ampf) * oscil(osc)))) with Sound("out1.aif", 2, reverb=jc_reverb, reverb_channels=2, play=True): blip(0, 2, 100) blip(1, 2, 400) blip(2, 2, 200) blip(3, 2, 300) blip(4, 2, 500) Todd Ingalls Associate Director School of Arts, Media and Engineering ame.asu.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Thu Mar 23 11:55:42 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 23 Mar 2023 11:55:42 -0700 Subject: [CM] Python bindings In-Reply-To: References: Message-ID: Wow! That's a lot of work! What would be the best way to include this in sndlib? I don't have a git site for that library -- just the libraries at the ccrma ftp site. I don't often change the sndlib files (except the s7 files). From taube at illinois.edu Thu Mar 23 12:15:32 2023 From: taube at illinois.edu (Taube, Rick) Date: Thu, 23 Mar 2023 19:15:32 +0000 Subject: [CM] Python bindings In-Reply-To: References: Message-ID: <7F470475-DBF1-468F-A6AF-6B45692A1243@illinois.edu> Oh my, this is wonderfull news, ive been hoping for this for a long time but have not had the free time to tackle it myself! I have a composition environment in python called musx ( https://pypi.org/project/musx/ and https://github.com/musx-admin/musx ) that I use to teach algorithimic composition techniques to our CS+Music students. Musx is basically common music, and I really want to be able to generate audio. I am teaching until may, at that point I will 'retire' and would have time to work on it if you still need help. --Rick On Mar 23, 2023, at 11:55 AM, bil at ccrma.Stanford.EDU wrote: Wow! That's a lot of work! What would be the best way to include this in sndlib? I don't have a git site for that library -- just the libraries at the ccrma ftp site. I don't often change the sndlib files (except the s7 files). _______________________________________________ Cmdist mailing list Cmdist at ccrma.stanford.edu https://urldefense.com/v3/__https://cm-mail.stanford.edu/mailman/listinfo/cmdist__;!!DZ3fjg!-mU8sfdmLlRuV3706Jj3ZUgqWWjk8fvKn2k2w_8GRiZuS5listUKnzojoR_AANLxRHnHLjpTNNOMunWD5A$ -------------- next part -------------- An HTML attachment was scrubbed... URL: From TestCase at asu.edu Thu Mar 23 12:39:17 2023 From: TestCase at asu.edu (Todd Ingalls) Date: Thu, 23 Mar 2023 19:39:17 +0000 Subject: [CM] Python bindings In-Reply-To: References: Message-ID: <3C1304E6-8939-4807-9C6E-237E2B60FA15@asu.edu> Hi Bill Once I get things into better shape I would want to get it into a format so can be installed with the package manager included with python so people could go that route. The source could also be included in sndlib. I guess it would just be coordinating when a new ?release? for the python bindings were ready. Seems like once things get stable it would just be bug fixes and such. Todd Ingalls Associate Director School of Arts, Media and Engineering ame.asu.edu On Mar 23, 2023, at 11:55 AM, bil at ccrma.Stanford.EDU wrote: Wow! That's a lot of work! What would be the best way to include this in sndlib? I don't have a git site for that library -- just the libraries at the ccrma ftp site. I don't often change the sndlib files (except the s7 files). -------------- next part -------------- An HTML attachment was scrubbed... URL: From TestCase at asu.edu Thu Mar 23 12:42:06 2023 From: TestCase at asu.edu (Todd Ingalls) Date: Thu, 23 Mar 2023 19:42:06 +0000 Subject: [CM] Python bindings In-Reply-To: <7F470475-DBF1-468F-A6AF-6B45692A1243@illinois.edu> References: <7F470475-DBF1-468F-A6AF-6B45692A1243@illinois.edu> Message-ID: <279B2995-1403-4917-9494-351915820DD6@asu.edu> Hi Rick I have been using musx on and off but only in the last 6 months really got more familiar with python. Would be very cool to be able to output a score for sndlib. Congratulations on the upcoming ?retirement? :) Todd Ingalls Associate Director School of Arts, Media and Engineering ame.asu.edu On Mar 23, 2023, at 12:15 PM, Taube, Rick > wrote: Oh my, this is wonderfull news, ive been hoping for this for a long time but have not had the free time to tackle it myself! I have a composition environment in python called musx ( https://pypi.org/project/musx/ and https://github.com/musx-admin/musx ) that I use to teach algorithimic composition techniques to our CS+Music students. Musx is basically common music, and I really want to be able to generate audio. I am teaching until may, at that point I will 'retire' and would have time to work on it if you still need help. --Rick On Mar 23, 2023, at 11:55 AM, bil at ccrma.Stanford.EDU wrote: Wow! That's a lot of work! What would be the best way to include this in sndlib? I don't have a git site for that library -- just the libraries at the ccrma ftp site. I don't often change the sndlib files (except the s7 files). _______________________________________________ Cmdist mailing list Cmdist at ccrma.stanford.edu https://urldefense.com/v3/__https://cm-mail.stanford.edu/mailman/listinfo/cmdist__;!!DZ3fjg!-mU8sfdmLlRuV3706Jj3ZUgqWWjk8fvKn2k2w_8GRiZuS5listUKnzojoR_AANLxRHnHLjpTNNOMunWD5A$ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Thu Mar 23 12:59:53 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 23 Mar 2023 12:59:53 -0700 Subject: [CM] Python bindings In-Reply-To: <3C1304E6-8939-4807-9C6E-237E2B60FA15@asu.edu> References: <3C1304E6-8939-4807-9C6E-237E2B60FA15@asu.edu> Message-ID: <31866b5d53c402213d8fd16db73e3175@ccrma.stanford.edu> Sounds good -- whenever you're ready, let me know what files to include in sndlib, or whatever you want.