[CM] Getting snd to work with conjure/neovim

Kenneth Flak kennethflak at protonmail.com
Sat Jun 24 22:46:49 PDT 2023

Hi Bill,

Forgot to reply all in my previous email as well :-)

Thanks for the gdb tip!

Using the file test.scm:

   (open-sound "/home/kf/xylophone.wav")
   (scale-channel 0.1)
   (save-sound-as "/home/kf/xylophone-scaled-1.wav")

I get this output from gdb:

(gdb) run <test.scm
Starting program: /usr/bin/snd <test.scm
[Thread debugging using libthread_db enabled]                                                                                                      
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff5b3b6c0 (LWP 183068)]                                                                                                           
[Thread 0x7ffff5b3b6c0 (LWP 183068) exited]
[New Thread 0x7ffff5b3b6c0 (LWP 183069)]
[New Thread 0x7ffff52756c0 (LWP 183070)]
[New Thread 0x7fffed3ff6c0 (LWP 183071)]                                                                                                           
[New Thread 0x7fffecbfe6c0 (LWP 183072)]
[New Thread 0x7fffde7ff6c0 (LWP 183073)]
[New Thread 0x7fffddffe6c0 (LWP 183074)]
[New Thread 0x7fffdd7fd6c0 (LWP 183075)]
[New Thread 0x7fffdcffc6c0 (LWP 183076)]
[New Thread 0x7fffc7fff6c0 (LWP 183077)]
[New Thread 0x7fffc77fe6c0 (LWP 183078)]
[New Thread 0x7fffc6ffd6c0 (LWP 183079)]
(gdb) "/home/kf/xylophone-scaled-1.wav"

... at this point I can't give snd any more commands. It just sits there, waiting for something. It is, however, one step further than what I get in conjure: I do get a return value out of it without quitting the program.

 From here I can exit snd from within the running instance by typing (exit) into the listener, in which case I get:

[Thread 0x7fffcaffd6c0 (LWP 183443) exited]
[Thread 0x7fffcb7fe6c0 (LWP 183442) exited]
[Thread 0x7fffdd7fd6c0 (LWP 183439) exited]
[Thread 0x7fffdcffc6c0 (LWP 183440) exited]
[Thread 0x7fffcbfff6c0 (LWP 183441) exited]
[Thread 0x7fffddffe6c0 (LWP 183438) exited]
[Thread 0x7fffde7ff6c0 (LWP 183437) exited]
[Thread 0x7fffecbfe6c0 (LWP 183436) exited]
[Thread 0x7fffed3ff6c0 (LWP 183435) exited]
[Thread 0x7ffff52756c0 (LWP 183433) exited]
[Thread 0x7ffff5b3b6c0 (LWP 183432) exited]
[Inferior 1 (process 183428) exited with code 01]

or I can do ctrl-c from the gdb session and get:

Thread 1 "snd" received signal SIGINT, Interrupt.
0x00007ffff6e5bc0f in __GI___poll (fds=0x7fffffffd790, nfds=1, timeout=59999) at ../sysdeps/unix/sysv/linux/poll.c:29
29	 return SYSCALL_CANCEL (poll, fds, nfds, timeout);                                                                                        
(gdb) q
A debugging session is active.

	Inferior 1 [process 183065] will be killed.

Quit anyway? (y or n) y

... so it seems that even after ctrl-c the process is still alive.

Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @kf at sonomu.club
On 24 Jun 2023  15:15, bil at ccrma.Stanford.EDU wrote:
>[I forgot to "reply all"]:
>In the motif version, XtAppAddInput in snd-motif.c sets get_stdin_string
>as the function to call when input is available on stdin.  That function
>tries to get a full string, then evals it.  It doesn't return the value
>of the incoming expression -- you have to use the write or display
>functions to send that value to stdout or wherever.  In your example,
>the "(begin ...)" is one form in scheme, so eval returns the last value
>of the things in the block.  Since the form is being evaluated, it
>seems to me that get_stdin_string did its job.  I'd omit the "(exit)"
>statement, then use gdb to see where your program is, and if necessary
>try to use gdb to grab the snd process, stop it and see where
>snd is.
>Cmdist mailing list
>Cmdist at ccrma.stanford.edu

More information about the Cmdist mailing list