From iainduncanlists at gmail.com Sat Apr 2 12:17:51 2022 From: iainduncanlists at gmail.com (Iain Duncan) Date: Sat, 2 Apr 2022 12:17:51 -0700 Subject: [CM] most efficient way to map over a vector? Message-ID: Hi all, I'm mapping some transforms over vectors in a part of the code that I need to have run as efficiently as possible. I'm hoping someone can tell me what the fastest running approach to this is. I would like to leave the data as vector as it is used in a framebuffer at the C level. thanks! iain -------------- next part -------------- An HTML attachment was scrubbed... URL: From elronnd at elronnd.net Sat Apr 2 17:46:06 2022 From: elronnd at elronnd.net (Elijah Stone) Date: Sat, 2 Apr 2022 17:46:06 -0700 (PDT) Subject: [CM] most efficient way to map over a vector? In-Reply-To: References: Message-ID: <72dac79c-3787-2b6e-374a-885278abd4b2@elronnd.net> Probably: (do ((i 0 (+ 1 i)) (l (length v))) (>= i l) (float-vector-set! v i (f (float-vector-ref v i)))) Obviously substituting int-vector-* or byte-vector-* if appropriate. That said, if performance is really important, I might just write the code in c. On Sat, 2 Apr 2022, Iain Duncan wrote: > Hi all, I'm mapping some transforms over vectors in a part of the code that I need to have run as efficiently as possible. I'm hoping someone can tell me what the fastest running approach to this is. I would like to leave the data as vector as it is used in a framebuffer at the C level. > thanks! > iain > > From elronnd at elronnd.net Sat Apr 2 17:47:39 2022 From: elronnd at elronnd.net (Elijah Stone) Date: Sat, 2 Apr 2022 17:47:39 -0700 (PDT) Subject: [CM] most efficient way to map over a vector? In-Reply-To: <72dac79c-3787-2b6e-374a-885278abd4b2@elronnd.net> References: <72dac79c-3787-2b6e-374a-885278abd4b2@elronnd.net> Message-ID: <81824f8c-6ed-edc3-67ac-f1d1549b3e6e@elronnd.net> Sorry, should be (do ((i 0 (+ 1 i)) (l (length v))) ((>= i l)) (float-vector-set! v i (f (float-vector-ref v i)))) On Sat, 2 Apr 2022, Elijah Stone wrote: > Probably: > > (do ((i 0 (+ 1 i)) > (l (length v))) > (>= i l) > (float-vector-set! v i (f (float-vector-ref v i)))) > > Obviously substituting int-vector-* or byte-vector-* if appropriate. > > That said, if performance is really important, I might just write the code in > c. > > On Sat, 2 Apr 2022, Iain Duncan wrote: > >> Hi all, I'm mapping some transforms over vectors in a part of the code that >> I need to have run as efficiently as possible. I'm hoping someone can tell >> me what the fastest running approach to this is. I would like to leave the >> data as vector as it is used in a framebuffer at the C level. >> thanks! >> iain >> >> > _______________________________________________ > Cmdist mailing list > Cmdist at ccrma.stanford.edu > https://cm-mail.stanford.edu/mailman/listinfo/cmdist > From iainduncanlists at gmail.com Sun Apr 3 10:06:13 2022 From: iainduncanlists at gmail.com (Iain Duncan) Date: Sun, 3 Apr 2022 10:06:13 -0700 Subject: [CM] most efficient way to map over a vector? In-Reply-To: <81824f8c-6ed-edc3-67ac-f1d1549b3e6e@elronnd.net> References: <72dac79c-3787-2b6e-374a-885278abd4b2@elronnd.net> <81824f8c-6ed-edc3-67ac-f1d1549b3e6e@elronnd.net> Message-ID: Thanks Elihah, that's basically what I'm doing. Is there a speed advantage to using float-vector-set! over plain old set! ? On Sat, Apr 2, 2022 at 5:47 PM Elijah Stone wrote: > Sorry, should be > > (do ((i 0 (+ 1 i)) > (l (length v))) > ((>= i l)) > (float-vector-set! v i (f (float-vector-ref v i)))) > > On Sat, 2 Apr 2022, Elijah Stone wrote: > > > Probably: > > > > (do ((i 0 (+ 1 i)) > > (l (length v))) > > (>= i l) > > (float-vector-set! v i (f (float-vector-ref v i)))) > > > > Obviously substituting int-vector-* or byte-vector-* if appropriate. > > > > That said, if performance is really important, I might just write the > code in > > c. > > > > On Sat, 2 Apr 2022, Iain Duncan wrote: > > > >> Hi all, I'm mapping some transforms over vectors in a part of the code > that > >> I need to have run as efficiently as possible. I'm hoping someone can > tell > >> me what the fastest running approach to this is. I would like to leave > the > >> data as vector as it is used in a framebuffer at the C level. > >> thanks! > >> iain > >> > >> > > _______________________________________________ > > Cmdist mailing list > > Cmdist at ccrma.stanford.edu > > https://cm-mail.stanford.edu/mailman/listinfo/cmdist > > > _______________________________________________ > Cmdist mailing list > Cmdist at ccrma.stanford.edu > https://cm-mail.stanford.edu/mailman/listinfo/cmdist > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Sun Apr 3 10:09:03 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sun, 03 Apr 2022 10:09:03 -0700 Subject: [CM] =?utf-8?q?most_efficient_way_to_map_over_a_vector=3F?= In-Reply-To: References: <72dac79c-3787-2b6e-374a-885278abd4b2@elronnd.net> <81824f8c-6ed-edc3-67ac-f1d1549b3e6e@elronnd.net> Message-ID: <964e10f9d41ee83e4a2d3d2f69b4d876@ccrma.stanford.edu> > Is there a speed advantage to using float-vector-set! > over plain old set! ? Set! as in (set! (v It depends on the context. I think in the loop Elijah posted, there's not much difference. From bil at ccrma.Stanford.EDU Tue Apr 12 12:36:10 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 12 Apr 2022 12:36:10 -0700 Subject: [CM] =?utf-8?q?loading_libc=5Fs7=2Eso?= Message-ID: <3f3fdf59cf0d6d004350af9b59b36bc9@ccrma.stanford.edu> There has been a response to this issue (noticed in July): https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1409#note_1336015 (I hope I got that right -- issue 1409 at pipewire). From tito.01beta at gmail.com Wed Apr 13 02:21:40 2022 From: tito.01beta at gmail.com (Tito Latini) Date: Wed, 13 Apr 2022 11:21:40 +0200 Subject: [CM] loading libc_s7.so In-Reply-To: <3f3fdf59cf0d6d004350af9b59b36bc9@ccrma.stanford.edu> References: <3f3fdf59cf0d6d004350af9b59b36bc9@ccrma.stanford.edu> Message-ID: Yes, it fails after commit c049689884d733cae58bd3096391cb9e92a2d146 Author: Peter Hutterer Date: Mon Jun 7 15:46:38 2021 +1000 logger: set linebuffering for the log Set this once during setup so we don't have to remember to call fflush() after each logging operation. I think `setlinebuf(stderr)' is useless in https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/plugins/support/logger.c#L378 if a logfile is not required. A possible fix is - setlinebuf(this->file); + if (this->file != stderr) + setlinebuf(this->file); On Tue, Apr 12, 2022 at 12:36:10PM -0700, bil at ccrma.Stanford.EDU wrote: > There has been a response to this issue (noticed in July): > > https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1409#note_1336015 > > (I hope I got that right -- issue 1409 at pipewire). > > _______________________________________________ > Cmdist mailing list > Cmdist at ccrma.stanford.edu > https://cm-mail.stanford.edu/mailman/listinfo/cmdist From neil.baylis at gmail.com Fri Apr 15 08:44:44 2022 From: neil.baylis at gmail.com (Neil Baylis) Date: Fri, 15 Apr 2022 08:44:44 -0700 Subject: [CM] No cursor in Grace edit window Message-ID: I just built Grace from source. It built with no errors, and claims to be version 3.11.0. It starts up okay, but when I open any file to edit, there's no cursor in the edit window. It does respect the position of the mouse, and I can save the changes. This is MacOS 10.15.7 -------------- next part -------------- An HTML attachment was scrubbed... URL: From j_hearon at hotmail.com Tue Apr 19 11:02:57 2022 From: j_hearon at hotmail.com (James Hearon) Date: Tue, 19 Apr 2022 18:02:57 +0000 Subject: [CM] portamento Message-ID: Hi, I'm trying to come up with an approach to portamento note phrasing. Best I've been able to do is work with gliss. I'm wondering if this is on the right track for how this is usually handled? Regards, Jim (definstrument (myport start-time duration frequency start-freq end-freq (amp-env '(0 0 1 1 2 1 3 0)) sampling-rate) (let* ((beg (floor (* start-time sampling-rate))) (end (+ beg (floor (* duration sampling-rate)))) (sine-wave (make-oscil :frequency frequency)) (ampf (make-env amp-env :duration duration :scaler 1.0)) (frqf (make-env '(0 0 1 1) :scaler (hz->radians (- end-freq start-freq)) :duration duration :base 0.67)) ) (do ((i beg (+ i 1))) ((= i end)) (outa i (* (env ampf) (oscil sine-wave (env frqf) ))) (outb i (* (env ampf) (oscil sine-wave (env frqf) ))) ))) (with-sound (:srate 48000 :channels 2 :header-type mus-riff :play #t) (myport 0 1 300 300 400 '(0 1 1 .3) 48000) (myport 2 1.5 400 400 300 '(0 .3 1 .3) 48000) ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Tue Apr 19 11:33:08 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 19 Apr 2022 11:33:08 -0700 Subject: [CM] portamento In-Reply-To: References: Message-ID: <6d4807c522ab6c39450fd9c424e81583@ccrma.stanford.edu> I think in the context of sound synthesis, portamento is a glissando between two notes. It would be interesting to get a vocal or violin recording of someone using portamento, and try to imitate it -- I think you'll also need an amplitude envelope. Seashore wrote about it, saying something like "it starts below the first note and overshoots its target", if I remember right. You might also need to change the timbre en route. From j_hearon at hotmail.com Wed Apr 20 10:09:45 2022 From: j_hearon at hotmail.com (James Hearon) Date: Wed, 20 Apr 2022 17:09:45 +0000 Subject: [CM] Cmdist Digest, Vol 167, Issue 4 In-Reply-To: References: Message-ID: re: portamento Thanks. I had experimented with amp envs, and overshoots and undershoots for durs but hadn't considered timbre or spectral changes. I'll think about that. Regards, Jim ________________________________ From: cmdist-bounces at ccrma.Stanford.EDU on behalf of cmdist-request at ccrma.Stanford.EDU Sent: Tuesday, April 19, 2022 9:00 AM To: cmdist at ccrma.Stanford.EDU Subject: Cmdist Digest, Vol 167, Issue 4 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. portamento (James Hearon) 2. Re: portamento (bil at ccrma.Stanford.EDU) ---------------------------------------------------------------------- Message: 1 Date: Tue, 19 Apr 2022 18:02:57 +0000 From: James Hearon To: "cmdist at ccrma.Stanford.EDU" Subject: [CM] portamento Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hi, I'm trying to come up with an approach to portamento note phrasing. Best I've been able to do is work with gliss. I'm wondering if this is on the right track for how this is usually handled? Regards, Jim (definstrument (myport start-time duration frequency start-freq end-freq (amp-env '(0 0 1 1 2 1 3 0)) sampling-rate) (let* ((beg (floor (* start-time sampling-rate))) (end (+ beg (floor (* duration sampling-rate)))) (sine-wave (make-oscil :frequency frequency)) (ampf (make-env amp-env :duration duration :scaler 1.0)) (frqf (make-env '(0 0 1 1) :scaler (hz->radians (- end-freq start-freq)) :duration duration :base 0.67)) ) (do ((i beg (+ i 1))) ((= i end)) (outa i (* (env ampf) (oscil sine-wave (env frqf) ))) (outb i (* (env ampf) (oscil sine-wave (env frqf) ))) ))) (with-sound (:srate 48000 :channels 2 :header-type mus-riff :play #t) (myport 0 1 300 300 400 '(0 1 1 .3) 48000) (myport 2 1.5 400 400 300 '(0 .3 1 .3) 48000) ) -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 2 Date: Tue, 19 Apr 2022 11:33:08 -0700 From: bil at ccrma.Stanford.EDU To: James Hearon Cc: "cmdist at ccrma.Stanford.EDU" Subject: Re: [CM] portamento Message-ID: <6d4807c522ab6c39450fd9c424e81583 at ccrma.stanford.edu> Content-Type: text/plain; charset=US-ASCII; format=flowed I think in the context of sound synthesis, portamento is a glissando between two notes. It would be interesting to get a vocal or violin recording of someone using portamento, and try to imitate it -- I think you'll also need an amplitude envelope. Seashore wrote about it, saying something like "it starts below the first note and overshoots its target", if I remember right. You might also need to change the timbre en route. ------------------------------ _______________________________________________ Cmdist mailing list Cmdist at ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist End of Cmdist Digest, Vol 167, Issue 4 ************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From wdouglass at carnegierobotics.com Thu Apr 21 08:39:27 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Thu, 21 Apr 2022 15:39:27 +0000 Subject: [CM] Possible bug in s7_values Message-ID: Bill et all, I think i may have found a bug in s7_values. consider the following program ``` #include "s7.h" int main(int argc, char *argv) { s7_scheme *s = s7_init(); s7_pointer l = s7_list(s, 3, s7_make_integer(s, 1), s7_make_integer(s, 2), s7_make_integer(s, 3)); s7_pointer v = s7_values(s, l); s7_pointer e = s7_eval_c_string(s, "(values 1 2 3)"); s7_display(s, l, s7_current_error_port(s)); s7_newline(s, s7_current_error_port(s)); s7_display(s, v, s7_current_error_port(s)); s7_newline(s, s7_current_error_port(s)); s7_display(s, e, s7_current_error_port(s)); s7_newline(s, s7_current_error_port(s)); s7_quit(s); } ``` this program, when run, prints the following ``` (1 2 3) (values 1 2 3) (1 2 3) ``` I would expect the second and third lines of the output to match, which i think is a bug. Also, this all begs the question -- what is the proper way to handle functions that return multiple values in C? the documentation is sparse on the topic, unless i missed something Thanks as always, Woody Douglass From wdouglass at carnegierobotics.com Thu Apr 21 09:03:08 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Thu, 21 Apr 2022 16:03:08 +0000 Subject: [CM] Possible bug in s7_values In-Reply-To: References: Message-ID: <7d6da4c43f6bd0f03578b965c6835c215edaf649.camel@carnegierobotics.com> I ended up working around my issue like this: ``` s7_pointer e = s7_eval(s, s7_list(s, 2, s7_make_symbol(s, "list-values"), s7_cons(s, proc, itr)), s7_nil(s)); ``` And then treating e as a list of zero or more values. this seems to work, but i'm not sure if it's idiomatically correct. Thanks, Woody Douglass On Thu, 2022-04-21 at 11:39 -0400, Woodrow Douglass wrote: > Bill et all, > > I think i may have found a bug in s7_values. consider the following > program > > ``` > #include "s7.h" > > int main(int argc, char *argv) { > s7_scheme *s = s7_init(); > s7_pointer l = s7_list(s, 3, s7_make_integer(s, 1), > s7_make_integer(s, 2), s7_make_integer(s, 3)); > s7_pointer v = s7_values(s, l); > s7_pointer e = s7_eval_c_string(s, "(values 1 2 3)"); > s7_display(s, l, s7_current_error_port(s)); > s7_newline(s, s7_current_error_port(s)); > s7_display(s, v, s7_current_error_port(s)); > s7_newline(s, s7_current_error_port(s)); > s7_display(s, e, s7_current_error_port(s)); > s7_newline(s, s7_current_error_port(s)); > s7_quit(s); > } > ``` > > this program, when run, prints the following > > ``` > (1 2 3) > (values 1 2 3) > (1 2 3) > ``` > > I would expect the second and third lines of the output to match, > which > i think is a bug. > > Also, this all begs the question -- what is the proper way to handle > functions that return multiple values in C? the documentation is > sparse > on the topic, unless i missed something > > Thanks as always, > Woody Douglass > From bil at ccrma.Stanford.EDU Thu Apr 21 11:02:20 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 21 Apr 2022 11:02:20 -0700 Subject: [CM] =?utf-8?q?Possible_bug_in_s7=5Fvalues?= In-Reply-To: <7d6da4c43f6bd0f03578b965c6835c215edaf649.camel@carnegierobotics.com> References: <7d6da4c43f6bd0f03578b965c6835c215edaf649.camel@carnegierobotics.com> Message-ID: <1be1864019970483fc7722ccb7c8fc23@ccrma.stanford.edu> The printer includes "values" when it is asked to print a list of values that was not spliced into a caller's argument list. It is just trying to be helpful. In the second ("v") case, it gets the values list unhandled by anything, so it includes "values" as a sort of warning. s7_values gives a way to return multiple values from a function defined in C to a Scheme function (see example below). It is often equivalent to (apply func (list...)). You can capture the values in a list if you want. list-values is a special version of list that splices out (values) (i.e. values without any arguments). This is expected in quasiquote, but in s7 other functions (e.g. map) also use it. static s7_pointer vals(s7_scheme *s, s7_pointer args) { return(s7_values(s, args)); } int main(int argc, char **argv) { s7_scheme *s = s7_init(); s7_define_function(s, "vals", vals, 0, 0, true, NULL); s7_pointer e = s7_eval_c_string(s, "(+ (vals 1 2 3))"); s7_display(s, e, s7_current_output_port(s)); s7_newline(s, s7_current_output_port(s)); } What are you actually trying to do? From wdouglass at carnegierobotics.com Thu Apr 21 11:57:31 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Thu, 21 Apr 2022 18:57:31 +0000 Subject: [CM] Possible bug in s7_values In-Reply-To: <1be1864019970483fc7722ccb7c8fc23@ccrma.stanford.edu> References: <7d6da4c43f6bd0f03578b965c6835c215edaf649.camel@carnegierobotics.com> <1be1864019970483fc7722ccb7c8fc23@ccrma.stanford.edu> Message-ID: <00969eb6e6a93c1ac20265c95804f64d442fe4bf.camel@carnegierobotics.com> The program that i'm maintianing with s7 scheme incorporates libev as an event loop. I wrote a cooperative version of `map` that allows the loop to cycle in between calls to the procedure passed in, which keeps other events (like user input) from being starved by long calculations -- my "cooperative map" wasn't handling functions that return multiple values properly until i wrapped the result up in `list-values`, like i sent in my last email. It would be nice if there was an interface to see if a procedure returned more then one value when called from C. Thanks, Woody Douglass On Thu, 2022-04-21 at 11:02 -0700, bil at ccrma.Stanford.EDU wrote: > The printer includes "values" when it is asked to print a list > of values that was not spliced into a caller's argument list. > It is just trying to be helpful. In the second ("v") case, > it gets the values list unhandled by anything, so it includes > "values" as a sort of warning. > > s7_values gives a way to return multiple values from a function > defined in C to a Scheme function (see example below). It is > often equivalent to (apply func (list...)). You can capture > the values in a list if you want. > > list-values is a special version of list that splices out > (values) (i.e. values without any arguments). This is expected > in quasiquote, but in s7 other functions (e.g. map) also use it. > > > static s7_pointer vals(s7_scheme *s, s7_pointer args) > { > return(s7_values(s, args)); > } > > int main(int argc, char **argv) > { > s7_scheme *s = s7_init(); > s7_define_function(s, "vals", vals, 0, 0, true, NULL); > s7_pointer e = s7_eval_c_string(s, "(+ (vals 1 2 3))"); > s7_display(s, e, s7_current_output_port(s)); > s7_newline(s, s7_current_output_port(s)); > } > > > What are you actually trying to do? > From bil at ccrma.Stanford.EDU Thu Apr 21 12:30:09 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 21 Apr 2022 12:30:09 -0700 Subject: [CM] =?utf-8?q?Possible_bug_in_s7=5Fvalues?= In-Reply-To: <00969eb6e6a93c1ac20265c95804f64d442fe4bf.camel@carnegierobotics.com> References: <7d6da4c43f6bd0f03578b965c6835c215edaf649.camel@carnegierobotics.com> <1be1864019970483fc7722ccb7c8fc23@ccrma.stanford.edu> <00969eb6e6a93c1ac20265c95804f64d442fe4bf.camel@carnegierobotics.com> Message-ID: > It would be nice if there was an interface to see if a procedure > returned more then one value when called from C. It would be easy to add s7_is_multiple_value, equivalent to s7's internal is_multiple_value macro -- is that what you need? From bil at ccrma.Stanford.EDU Sat Apr 23 03:01:43 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sat, 23 Apr 2022 03:01:43 -0700 Subject: [CM] Snd 22.3 Message-ID: <002bfaa0b549fe5106c057eeb5bfac8f@ccrma.stanford.edu> Snd 22.3: s7_eval_with_location s7_apply_n* removed (now in xen.c|h) s7_is_multiple_value checked: notcurses 3.0.8 Thanks!: Daniel Hensel, Woody Douglass, johnm