From j_hearon at hotmail.com Fri Jul 1 10:52:50 2022 From: j_hearon at hotmail.com (James Hearon) Date: Fri, 1 Jul 2022 17:52:50 +0000 Subject: [CM] make-bandpass In-Reply-To: References: Message-ID: Yes. Understood. That's very helpful information. I see I can use mus-xcoeffs with make-bandpass. I think I wasn't indexing it properly too. If I might continue to ask, what are the numbers ouput from the generator, ex. (bandpass b)? I know the xcoeffs are the filter magnitudes but when nothing is passing thru the filter yet, as it would be if one were to call (outa i (b (* amp (oscil os)))), what do the output numbers of the generator represent before the filter is applied to a source? Are they random sample amplitudes, for ex.? (let* ((b (make-bandpass (hz->radians 500.0) (hz->radians 2000.0) 3)) (v (make-float-vector 3)) ) (do ((l 0 (+ l 1))) ((= l 3)) ;(float-vector-set! v l (bandpass b l)) ;what is output here? (float-vector-set! v l ((mus-xcoeffs b) l)) ;filter magnitudes (format #t "~%l: ~F v: ~0,6F" l (v l)) ) (do ((l 0 (+ l 1))) ((= l 3)) (format #t "~%j: ~F v: ~0,6F" l (v l)) ) ) ...also (sorry this long-winded) when I see a lambda func adding the two bandpass filters, ex. (flt3 (lambda (y) (+ (bandpass flt1 y) (bandpass flt2 y)))) I cannot get the mus-xcoeffs of flt3 then, because it's now a lambda function. So my purpose was to prove to myself that the lambda func was indeed the same as adding two vectors of mus-xcoeffs. (float-vector-add! v1 v2). In other words trying to see the numbers to verify the lambda function is indeed adding the xcoeffs, not the generator outputs. I hope that makes sense. But I'm still failing in my proof. Regards, Jim ________________________________ From: cmdist-bounces at ccrma.Stanford.EDU on behalf of cmdist-request at ccrma.Stanford.EDU Sent: Thursday, June 30, 2022 9:00 AM To: cmdist at ccrma.Stanford.EDU Subject: Cmdist Digest, Vol 169, Issue 9 Send Cmdist mailing list submissions to cmdist at ccrma.stanford.edu To subscribe or unsubscribe via the World Wide Web, visit https://cm-mail.stanford.edu/mailman/listinfo/cmdist or, via email, send a message with subject or body 'help' to cmdist-request at ccrma.stanford.edu You can reach the person managing the list at cmdist-owner at ccrma.stanford.edu When replying, please edit your Subject line so it is more specific than "Re: Contents of Cmdist digest..." Today's Topics: 1. Re: make-bandpass xcoeffs (bil at ccrma.Stanford.EDU) ---------------------------------------------------------------------- Message: 1 Date: Wed, 29 Jun 2022 12:04:42 -0700 From: bil at ccrma.Stanford.EDU To: James Hearon Cc: "cmdist at ccrma.Stanford.EDU" Subject: Re: [CM] make-bandpass xcoeffs Message-ID: <4bc1a174e5c876e81b11ac36a08865dd at ccrma.stanford.edu> Content-Type: text/plain; charset=US-ASCII; format=flowed make-bandpass is a wrapper around make-fir-filter, returning an fir-filter generator, so mus-xcoeffs does work with it; there's an example in snd-test.scm around line 7706. make-bandpass is not itself a generator; it returns one. If you look at the code in dsp.scm you'll see (define bandpass fir-filter) -- this says the bandpass generator is an fir-filter. In the first case, I think you're setting a vector to the output of the bandpass generator, and in the second it looks like you've copied the make-bandpass code to set the vector, so you're setting the vector to two different things. ------------------------------ _______________________________________________ Cmdist mailing list Cmdist at ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist End of Cmdist Digest, Vol 169, Issue 9 ************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Fri Jul 1 13:01:36 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Fri, 01 Jul 2022 13:01:36 -0700 Subject: [CM] make-bandpass In-Reply-To: References: Message-ID: <66d30f7b66f6d42bd5202ead3ac66c45@ccrma.stanford.edu> If the bandpass generator is getting no input, it returns 0.0. Otherwise it returns the output of the bandpass filter (normally audio samples). mus-xcoeffs is an array of filter coefficients -- these are convolved with the input to produce the output, so > ;(float-vector-set! v l (bandpass b l)) ;what is output here? The output of (bandpass b 0) then (bandpass b 1). > (float-vector-set! v l ((mus-xcoeffs b) l)) ;filter magnitudes The first and second filter coefficients. > (flt3 (lambda (y) (+ (bandpass flt1 y) (bandpass flt2 y)))) this adds the output of two bandpass generators. It is not the same as adding the two generator's filter coefficients. Julius Smith has written a very good introduction to filters, available for free online I think. From bil at ccrma.Stanford.EDU Sun Jul 3 02:58:16 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sun, 03 Jul 2022 02:58:16 -0700 Subject: [CM] Snd 22.5 Message-ID: Snd 22.5: s7: add vector-typer to return or set the type checking part of the vector element setter, and similarly hash-table-key-typer and hash-table-value-typer checked: sbcl 2.2.5|6 new ghostscript is unhappy with cmn eps files; version 9.55 is unhappy, 9.52 is happy. I think this is caused by negative origin bounding boxes which have worked fine for 30 years. Thanks!: Woody Douglass, Michael Mees, Elijah Stone From bil at ccrma.Stanford.EDU Sun Jul 3 07:05:32 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sun, 03 Jul 2022 07:05:32 -0700 Subject: [CM] Snd 22.5 In-Reply-To: References: Message-ID: <3b8151671568010f119896b085efac72@ccrma.stanford.edu> the gs problem is the (atend) indication used with %%BoundingBox -- surely a bug? From wdouglass at carnegierobotics.com Mon Jul 11 08:02:11 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Mon, 11 Jul 2022 15:02:11 +0000 Subject: [CM] GC Called recursively Message-ID: <36561b53841b6912f6eb355ab8396b6ac9fbe00b.camel@carnegierobotics.com> Hi all, I've got a problem where the GC seems to be calling itself recursively. Are there rules about what can and can't be done in a 'mark' function? i'm debugging this by turning "S7_DEBUGGING" on and adding a bunch of printfs to trace the gc process, is there a better strategy here? Thanks, Woody Douglass From bil at ccrma.Stanford.EDU Mon Jul 11 10:09:56 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Mon, 11 Jul 2022 10:09:56 -0700 Subject: [CM] GC Called recursively In-Reply-To: <36561b53841b6912f6eb355ab8396b6ac9fbe00b.camel@carnegierobotics.com> References: <36561b53841b6912f6eb355ab8396b6ac9fbe00b.camel@carnegierobotics.com> Message-ID: <20b935b313580f06ccff1b7b2feaa100@ccrma.stanford.edu> > From bil at ccrma.Stanford.EDU Mon Jul 11 10:14:53 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Mon, 11 Jul 2022 10:14:53 -0700 Subject: [CM] GC Called recursively In-Reply-To: <36561b53841b6912f6eb355ab8396b6ac9fbe00b.camel@carnegierobotics.com> References: <36561b53841b6912f6eb355ab8396b6ac9fbe00b.camel@carnegierobotics.com> Message-ID: <668b37c2cc872ad4e254205a1c3c0e8e@ccrma.stanford.edu> > Are there rules about what can and can't be done in a 'mark' function? Sorry about the empty message -- the cancel button is right next to the send button in raoundcube -- pessimal UI. On the original question -- don't allocate anything in s7 in the mark function -- that could trigger a recursive call, I think, though I've never tried it. I'm a great believer in print statements. If you need to drop into gsb without calling abort, there's a dummy function gdb_break -- handy for arbitrary break points. From wdouglass at carnegierobotics.com Mon Jul 11 10:18:17 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Mon, 11 Jul 2022 17:18:17 +0000 Subject: [CM] GC Called recursively In-Reply-To: <668b37c2cc872ad4e254205a1c3c0e8e@ccrma.stanford.edu> References: <36561b53841b6912f6eb355ab8396b6ac9fbe00b.camel@carnegierobotics.com> <668b37c2cc872ad4e254205a1c3c0e8e@ccrma.stanford.edu> Message-ID: <8f8f06edcb4ba5b6cebb91b33f1665d23d5be979.camel@carnegierobotics.com> Ahh, that makes total sense. i had a debug print staqtmenet that looked like this ``` s7_pointer let = s7_c_object_let(arg); s7_format(s, s7_list(s, 4, s7_current_error_port(s), s7_make_string(s, "BEFORE MARK ~A ~A~%"), arg, let)); ``` there's a bunch of allocations there -- red herring! ok, i'll stick to regular fprintf. Thanks, Woody On Mon, 2022-07-11 at 10:14 -0700, bil at ccrma.Stanford.EDU wrote: > > Are there rules about what can and can't be done in a 'mark' > > function? > > Sorry about the empty message -- the cancel button is right > next to the send button in raoundcube -- pessimal UI. > > On the original question -- don't allocate anything in s7 in > the mark function -- that could trigger a recursive call, > I think, though I've never tried it. > > I'm a great believer in print statements. If you need > to drop into gsb without calling abort, there's a dummy > function gdb_break -- handy for arbitrary break points. > From deeteeoh1138 at gmail.com Tue Jul 12 11:01:30 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 14:01:30 -0400 Subject: [CM] TRACE facility seems broken in 22.5 Message-ID: I get "unbound variable args" (define-macro (trace f) (let ((old-f (gensym))) `(define ,f (let ((,old-f ,f)) (apply lambda 'args `((format () "(~S ~{~S~^ ~}) -> " ',',f args) (let ((val (apply ,,old-f args))) (format () "~S~%" val) val))))))) -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Tue Jul 12 11:32:23 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 12 Jul 2022 11:32:23 -0700 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: It seems to work for me (except for a function with just a rest arg, but that never worked). What was the context? (I think this macro is found only in a couple test files -- the new trace is in debug.scm). From deeteeoh1138 at gmail.com Tue Jul 12 11:39:01 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 14:39:01 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: Ok I tried the new trace in debug.scm and traced several functions, which seems to succeed but then no trace is ever printed despite the functions running. The context was calling functions with a few arguments, formerly I could trace any function I wanted. On Tue, Jul 12, 2022 at 2:32 PM wrote: > It seems to work for me (except for a function with just a > rest arg, but that never worked). What was the context? > (I think this macro is found only in a couple test files -- > the new trace is in debug.scm). > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeteeoh1138 at gmail.com Tue Jul 12 11:41:38 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 14:41:38 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: Never mind, I'm silly and missed the output. Thank you :) On Tue, Jul 12, 2022 at 2:39 PM David O'Toole wrote: > Ok I tried the new trace in debug.scm and traced several functions, which > seems to succeed but then no trace is ever printed despite the functions > running. > The context was calling functions with a few arguments, formerly I could > trace any function I wanted. > > On Tue, Jul 12, 2022 at 2:32 PM wrote: > >> It seems to work for me (except for a function with just a >> rest arg, but that never worked). What was the context? >> (I think this macro is found only in a couple test files -- >> the new trace is in debug.scm). >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeteeoh1138 at gmail.com Tue Jul 12 11:55:56 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 14:55:56 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: Under what circumstances can the function "save-sound-as" produce this output with no error message? The run simply stops, there's no error message other than this: save-sound-as: /tmp/snd_34010_7648.snd () On Tue, Jul 12, 2022 at 2:41 PM David O'Toole wrote: > Never mind, I'm silly and missed the output. Thank you :) > > On Tue, Jul 12, 2022 at 2:39 PM David O'Toole > wrote: > >> Ok I tried the new trace in debug.scm and traced several functions, which >> seems to succeed but then no trace is ever printed despite the functions >> running. >> The context was calling functions with a few arguments, formerly I could >> trace any function I wanted. >> >> On Tue, Jul 12, 2022 at 2:32 PM wrote: >> >>> It seems to work for me (except for a function with just a >>> rest arg, but that never worked). What was the context? >>> (I think this macro is found only in a couple test files -- >>> the new trace is in debug.scm). >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Tue Jul 12 12:19:09 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 12 Jul 2022 12:19:09 -0700 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: > save-sound-as: /tmp/snd_34010_7648.snd () why these guessing games? Give me some context, and why you think there's a problem. Are you tracing this function? From deeteeoh1138 at gmail.com Tue Jul 12 13:00:43 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 16:00:43 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: Hi. The context is calling (save-sound-as "/tmp/snd_34010_7648.snd" some-sound). Normally this results in a file being written, however the file is not written in this case, and execution of the whole containing loop (which slices a longer sound into a bunch of fragments and writes each to a flac file) terminates back to the REPL printing only the message: save-sound-as: /tmp/snd_34010_7648.snd () I used the trace facility to discover which invocation of save-sound-as was causing the problem. I am also tracing save-sound-as, but instead of printing anything from the trace facility, i just get the message and the REPL. None of the writes succeed, it only tries the first write and then dies. Invocations of save-sound-as from the REPL seem to work ok and the trace output is shown. But inside the loop, the trace output is never shown, and execution terminates at the first attempt to call save-sound-as. On Tue, Jul 12, 2022 at 3:19 PM wrote: > > save-sound-as: /tmp/snd_34010_7648.snd () > > why these guessing games? Give me some context, > and why you think there's a problem. Are you > tracing this function? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Tue Jul 12 13:15:43 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 12 Jul 2022 13:15:43 -0700 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: Message-ID: <12fbc7a1a72f9d927e00fb20e98244c1@ccrma.stanford.edu> It looks like some-sound is () which will cause save-sound-as to raise an error. If the error isn't caught, it will cause the loop to stop and will return to the top level. I'm guessing the output is from trace as the function is entered, then you hit the error, and the current evaluation is stopped. () is an error because it does not identify the sound you want to save. From deeteeoh1138 at gmail.com Tue Jul 12 13:36:07 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 16:36:07 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: <12fbc7a1a72f9d927e00fb20e98244c1@ccrma.stanford.edu> References: <12fbc7a1a72f9d927e00fb20e98244c1@ccrma.stanford.edu> Message-ID: Oh, I must have messed up something. I'll investigate further. Thank you! On Tue, Jul 12, 2022 at 4:15 PM wrote: > It looks like some-sound is () which will cause save-sound-as > to raise an error. If the error isn't caught, it will > cause the loop to stop and will return to the top level. > I'm guessing the output is from trace as the function is > entered, then you hit the error, and the current evaluation > is stopped. () is an error because it does not identify > the sound you want to save. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeteeoh1138 at gmail.com Tue Jul 12 13:54:00 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 16:54:00 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: <12fbc7a1a72f9d927e00fb20e98244c1@ccrma.stanford.edu> Message-ID: Actually, the output I gave is not from the trace feature, as it appears whether or not the function is traced. So I don't know if it actually signifies that the sound passed was (). I put in (assert (sound? some-sound)) and it doesn't complain. I'll investigate more. On Tue, Jul 12, 2022 at 4:36 PM David O'Toole wrote: > Oh, I must have messed up something. I'll investigate further. Thank you! > > On Tue, Jul 12, 2022 at 4:15 PM wrote: > >> It looks like some-sound is () which will cause save-sound-as >> to raise an error. If the error isn't caught, it will >> cause the loop to stop and will return to the top level. >> I'm guessing the output is from trace as the function is >> entered, then you hit the error, and the current evaluation >> is stopped. () is an error because it does not identify >> the sound you want to save. >> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeteeoh1138 at gmail.com Tue Jul 12 13:58:36 2022 From: deeteeoh1138 at gmail.com (David O'Toole) Date: Tue, 12 Jul 2022 16:58:36 -0400 Subject: [CM] TRACE facility seems broken in 22.5 In-Reply-To: References: <12fbc7a1a72f9d927e00fb20e98244c1@ccrma.stanford.edu> Message-ID: For example if I deliberately pass: > >(save-sound-as "/home/dto/foo.snd" ()) I get: save-sound-as second argument, (), is nil but should be a sound object, an integer (sound index), or #f This is why I was asking what conditions could cause "save-sound-as" to simply print its name and fail On Tue, Jul 12, 2022 at 4:54 PM David O'Toole wrote: > Actually, the output I gave is not from the trace feature, as it appears > whether or not the function is traced. > So I don't know if it actually signifies that the sound passed was (). > I put in (assert (sound? some-sound)) and it doesn't complain. > I'll investigate more. > > > On Tue, Jul 12, 2022 at 4:36 PM David O'Toole > wrote: > >> Oh, I must have messed up something. I'll investigate further. Thank you! >> >> On Tue, Jul 12, 2022 at 4:15 PM wrote: >> >>> It looks like some-sound is () which will cause save-sound-as >>> to raise an error. If the error isn't caught, it will >>> cause the loop to stop and will return to the top level. >>> I'm guessing the output is from trace as the function is >>> entered, then you hit the error, and the current evaluation >>> is stopped. () is an error because it does not identify >>> the sound you want to save. >>> >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From elronnd at elronnd.net Wed Jul 27 20:06:20 2022 From: elronnd at elronnd.net (Elijah Stone) Date: Wed, 27 Jul 2022 20:06:20 -0700 (PDT) Subject: [CM] sandboxing Message-ID: <7075be6-dd94-82f8-73f3-3ae7d8646810@elronnd.net> I need to effect some rudimentary sandboxing. Environments seem like a suitable tool for this, as they cannot be forged. So I put all my untrusted code in one environment, all my trusted code and data in another, put a pointer to the untrusted environment in the trusted one, but never the other way around. And this works until I need them to talk to one another. What I want is to make a 'safe interface', whereby the untrusted code may make its desires known to the trusted code, and pass it to the former. But because everything is first-class and introspectible, the untrusted code can just peek inside the closures it's given and find things it shouldn't. The only scheme I can think of which will work generally is something like monadic i/o; the untrusted code returns a request, and a continuation, to the trusted code. While this does work, it is not so convenient. Have I missed anything? If not, may we have a mechanism for 'sealing' a procedure, to prevent prying eyes from peeking inside? -E From bil at ccrma.Stanford.EDU Thu Jul 28 06:00:32 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 28 Jul 2022 06:00:32 -0700 Subject: [CM] sandboxing In-Reply-To: <7075be6-dd94-82f8-73f3-3ae7d8646810@elronnd.net> References: <7075be6-dd94-82f8-73f3-3ae7d8646810@elronnd.net> Message-ID: <0d3a26f22460346cf3947d6ce3f7613a@ccrma.stanford.edu> Interesting question. My first thought is that you could undefine procedure-source, object->let, funclet, object->string with :readable, rootlet, outlet (in the untrusted environment, like sandbox in stuff.scm), but the list seems to keep getting longer, and blocking format with ~W seems to require wrapping format. You could wrap the trusted function in a c-object, then call it with (obj . args) which applies the arguments to the wrapped function. The c-object could hide everything from normal intrusions from scheme. Or I think I could add an opaque (or "private"?) flag so that these kinds of introspection would be blocked on functions. This would affect funclet, object->let, object->string, format, etc. But all of these are vulnerable to "probes" (like probe-eval in stuff.scm but maybe more sinister), so the wrapper would have to scan the args and refuse to call the function if it finds an openlet. Now I'm worrying that a closed let could wait until it is ingested by a function, then open itself, grab whatever it wants, then close itself so no one is the wiser. We'd have to block curlet, outlet, owlet, and rootlet I think. But lets are referenced all the time, and I don't want to slow down normal scheme code checking opaque bits on them. And I feel like I'm missing something. How secure does the trusted call need to be?