From j_hearon at hotmail.com Thu Dec 7 10:12:56 2023 From: j_hearon at hotmail.com (James Hearon) Date: Thu, 7 Dec 2023 18:12:56 +0000 Subject: [CM] make-sampler vs. open Message-ID: Hi, I was trying to use make-sampler, but having a problem opening (read-sample) a non-bandlimited square wav effectively. Snd's Open menu function works fine, but the make-sampler approach gives a max'd out flat line which seems like it might be an aliasing problem? I tried low-pass filtering with make-sample without much success. Instead I was tweaking this code below from spectrum as an fft filter for file based bandlimiting. Reason being most of what I was doing is outside the editor, or file-based manipulation before the sound gets opened in the editor. The result is better than before but I'm still not seeing anything resembling a square wav yet with make-sampler and read-sample. I also tried some peak limiting on amplitudes, but still no joy. I'm wondering what might be the difference with Snd's file Open and why it works so well vs. the lower level approach of make-sampler, and read-sample, or what might be a better way to approach those pesky non-bandlimited snds? (let* ((len (mus-sound-framples "oboe.snd")) (fsize (expt 2 (ceiling (log len 2)))) (rdata (make-float-vector fsize)) (idata (make-float-vector fsize))) (file->array "oboe.snd" 0 0 len rdata) (mus-fft rdata idata fsize 1) (let ((fsize2 (/ fsize 2)) (cutoff (round (/ fsize 10)))) (do ((i cutoff (+ i 1)) (j (- fsize 1) (- j 1))) ((= i fsize2)) (set! (rdata i) 0.0) (set! (idata i) 0.0) (set! (rdata j) 0.0) (set! (idata j) 0.0))) (mus-fft rdata idata fsize -1) (array->file "test.snd" (float-vector-scale! rdata (/ 1.0 fsize)) len (srate "oboe.snd") 1) (let ((previous-case (find-sound "test.snd"))) (if (sound? previous-case) (close-sound previous-case))) (open-sound "test.snd")) Regards, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Thu Dec 7 13:01:27 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 07 Dec 2023 13:01:27 -0800 Subject: [CM] make-sampler vs. open In-Reply-To: References: Message-ID: <306bddf90a522aeb620ceccb4311a015@ccrma.stanford.edu> I'd need to see you sampler code to see what the problem is, but this sequence works: ;; write a square-wave to test.snd (with-sound (:output "test.snd" :to-snd #f) (let ((g (make-square-wave 440.0))) (do ((i 0 (+ i 1))) ((= i 44100)) (outa i (square-wave g))))) ;; read it using a sampler (let* ((snd (open-sound "test.snd")) (sampler (make-sampler 0 snd 0))) (with-sound (:output "test1.snd") (do ((i 0 (+ i 1))) ((= i 44100)) (outa i (read-sample sampler))))) ;; filter it using fft-filtering (let* ((len (mus-sound-framples "test1.snd")) (fsize (expt 2 (ceiling (log len 2)))) (rdata (make-float-vector fsize)) (idata (make-float-vector fsize))) (file->array "test1.snd" 0 0 len rdata) (mus-fft rdata idata fsize 1) (let ((fsize2 (/ fsize 2)) (cutoff (round (/ fsize 10)))) (do ((i cutoff (+ i 1)) (j (- fsize 1) (- j 1))) ((= i fsize2)) (set! (rdata i) 0.0) (set! (idata i) 0.0) (set! (rdata j) 0.0) (set! (idata j) 0.0))) (mus-fft rdata idata fsize -1) (array->file "test2.snd" (float-vector-scale! rdata (/ 1.0 fsize)) len 44100 ;(srate "oboe.snd") 1) (open-sound "test2.snd")) load this into snd and you should see the 3 files. If they appear to be all ones, move the graph slider to show a smaller portion of the file. File:Open is probably showing only a small portion of the file in its initial window -- I think the variable that sets that is initial-dur which defaults to .1 seconds. From j_hearon at hotmail.com Fri Dec 8 09:42:01 2023 From: j_hearon at hotmail.com (James Hearon) Date: Fri, 8 Dec 2023 17:42:01 +0000 Subject: [CM] make-sampler vs. open In-Reply-To: References: Message-ID: Hi, Yes. Snd's make-square-wave works great. I took another look at my code and figured out the problem was not reading from make-sampler, but my trying to get the maxval of the sampler's output to see what was going wrong. I was using (set! maxval (float-vector-max (float-vector-abs! im))) and didn't realize float-vector-abs! was setting all the values to absolute value. I thought it was just getting the abs value. So for a square wave that's deadly. My fault. Thank you, Jim ________________________________ From: cmdist-bounces at ccrma.Stanford.EDU on behalf of cmdist-request at ccrma.Stanford.EDU Sent: Thursday, December 7, 2023 10:00 AM To: cmdist at ccrma.Stanford.EDU Subject: Cmdist Digest, Vol 187, Issue 1 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. make-sampler vs. open (James Hearon) ---------------------------------------------------------------------- Message: 1 Date: Thu, 7 Dec 2023 18:12:56 +0000 From: James Hearon To: "cmdist at ccrma.Stanford.EDU" Subject: [CM] make-sampler vs. open Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hi, I was trying to use make-sampler, but having a problem opening (read-sample) a non-bandlimited square wav effectively. Snd's Open menu function works fine, but the make-sampler approach gives a max'd out flat line which seems like it might be an aliasing problem? I tried low-pass filtering with make-sample without much success. Instead I was tweaking this code below from spectrum as an fft filter for file based bandlimiting. Reason being most of what I was doing is outside the editor, or file-based manipulation before the sound gets opened in the editor. The result is better than before but I'm still not seeing anything resembling a square wav yet with make-sampler and read-sample. I also tried some peak limiting on amplitudes, but still no joy. I'm wondering what might be the difference with Snd's file Open and why it works so well vs. the lower level approach of make-sampler, and read-sample, or what might be a better way to approach those pesky non-bandlimited snds? (let* ((len (mus-sound-framples "oboe.snd")) (fsize (expt 2 (ceiling (log len 2)))) (rdata (make-float-vector fsize)) (idata (make-float-vector fsize))) (file->array "oboe.snd" 0 0 len rdata) (mus-fft rdata idata fsize 1) (let ((fsize2 (/ fsize 2)) (cutoff (round (/ fsize 10)))) (do ((i cutoff (+ i 1)) (j (- fsize 1) (- j 1))) ((= i fsize2)) (set! (rdata i) 0.0) (set! (idata i) 0.0) (set! (rdata j) 0.0) (set! (idata j) 0.0))) (mus-fft rdata idata fsize -1) (array->file "test.snd" (float-vector-scale! rdata (/ 1.0 fsize)) len (srate "oboe.snd") 1) (let ((previous-case (find-sound "test.snd"))) (if (sound? previous-case) (close-sound previous-case))) (open-sound "test.snd")) Regards, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ _______________________________________________ Cmdist mailing list Cmdist at ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist End of Cmdist Digest, Vol 187, Issue 1 ************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From anders at avinjar.no Thu Dec 14 04:44:14 2023 From: anders at avinjar.no (Anders Vinjar) Date: Thu, 14 Dec 2023 13:44:14 +0100 Subject: [CM] bug-report: crash in snd-motif.scm - 'XLoadQueryFont' Message-ID: <87cyv9dkdd.fsf@avinjar.no> Hi all! When i (require snd-motif.scm) my snd crashes. Seems to break during the call to XLoadQueryFont inside 'make-sound-box' ;;; down in in snd-motif.scm, the 'XLoadQueryFont' - thing breaks snd (define make-sound-box ;; graphics stuff (fonts etc) (let* ((gv (XGCValues)) (shell ((main-widgets) 1)) (button-fontstruct (XLoadQueryFont (XtDisplay shell) (if (> (length *listener-font*) 0) *listener-font* "9x15")))) My snd sometimes complains - "can't find listener font 9x15" in other contexts - but it doesn't crash. Any suggesions? About: This is Snd version 23.9 of 27-Nov-23: s7: 10.7 (27-Nov-2023), Xen: 4.3 Jack Sndlib 24.8 (5-Oct-21) CLM 6.19 (17-Nov-18) GSL 2.7.1 fftw-3.3.10-sse2-avx Motif 2.3.4 X11R6 xm: 6-Nov-20 Xpm 3.4.11 Compiled Dec 1 2023 10:19:59 C: gcc 13.2 Linux 6.6.3-100.fc38.x86_64 x86_64 *features* '(snd-23.9 snd23 snd audio snd-s7 snd-motif gsl jack alsa xm clm6 clm sndlib gcc linux autoload dlopen system-extras overflow-checks ieee-float complex-numbers ratios s7-10.7 s7) -anders From anders at avinjar.no Thu Dec 14 05:45:42 2023 From: anders at avinjar.no (Anders Vinjar) Date: Thu, 14 Dec 2023 14:45:42 +0100 Subject: [CM] snd widget-size Message-ID: <875y10ew3d.fsf@avinjar.no> it looks as it should be possible to set a widgets widget-size - fex. ((sound-widgets) 0) - to adjust the size of the current snd's main-pane Aim is to 'balance' all (sounds) in the programs vertical space, in the same way as equalize-panes (in snd-motif.scm) does with one snd's channels. Trying various (set! (widget-size ((sound-widgets) 0) ' (1000 500))) but nothing happes in the window. Any suggestion where to look? -anders From bil at ccrma.Stanford.EDU Thu Dec 14 06:10:22 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 14 Dec 2023 06:10:22 -0800 Subject: [CM] bug-report: crash in snd-motif.scm - 'XLoadQueryFont' In-Reply-To: <87cyv9dkdd.fsf@avinjar.no> References: <87cyv9dkdd.fsf@avinjar.no> Message-ID: <03e8b0973108bd92503937b196da6438@ccrma.stanford.edu> I think this is the same problem that Kenneth Flak reported in July. Here's a portion of my reply: "... In snd-motif.scm, there are two uses of the font "9x15" -- this is a very old (but very good) fixed width font that may now be relegated to the X miscellaneous fonts package. You may have to install it by hand, xorg-x11-fonts-misc in Fedora. I need to add some other choice there ..." It looks like I fixed the first of the two cases, but forgot the second. From j_hearon at hotmail.com Fri Dec 29 18:40:54 2023 From: j_hearon at hotmail.com (James Hearon) Date: Sat, 30 Dec 2023 02:40:54 +0000 Subject: [CM] edit selection color Message-ID: Hi, This is a bit odd, but I'm posting in case someone might have a suggestion. I'm on fc39, Snd 23.9, using motif, no gl. I've recompiled Snd a few times recently trying to solve a wacked color problem with the edit selection color. When I select an area to edit, the color is yellow with a red tinge looking something like overlay or spectrum instead of the default lightsteelblue1. I've defined using make-color and set selection-color to change the color from the listener a few times but the edit color just gets worse. I tweaked colors in preferences, and checked nothing is odd in my ./snd prefs file. In the preferences color panel other colors seem okay. Seems to only affect the selection-color. I upgraded my ram from 8gb to 16gb recently and I'm thinking maybe the wacked edit colors have something to do with rgb and ram? I also changed the laptop's color profile a few times using Genome's Settings for Colors, but no joy there either. Stranger still if i select and area for editing, leave it selected, and open any other menu (ex. reverbs), and close that menu, part of the reverbs menu is showing up faintly in the edit area of the waveform. That's very odd but gets me thinking about screen refresh and memory issues. Maybe the ram was bad, but strange it only seems to affect the edit area for color. Thanks, Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: