From: Roger Dannenberg <rbd@cs...> - 2008-01-23 13:48:51
Thanks for the bug reports. As for *default-sf-dir* and other issues, this looks like some interaction between the IDE preferences settings and Nyquist's attempts to find reasonable default values. I'll look into it -- I suspect that since I have preferences cached in the registry that my new installs are not what new users see.
Secondly, I can't help but respond to the following:
>> (setq s (s-read "a.wav"))
>> (setq maxl (snd-maxsamp s))
>> (print maxl)
> The answer depends on the question 'how big is a.wav'?
>The reason why I ask this is that Nyquist has the habit to compute
>everything in-memory. If you try to find the number of samples of a
>sound that doesn't fit into the memory of your computer, Nyquist
>just simply will crash.
>This is IMHO a severe design bug in Nyquist.
First, the documentation for SND-MAXSAMP states: "Calling this function will cause samples to be computed and saved in memory." and "This function will probably be removed in a future version. See peak, a replacement". If you look up PEAK, it has a clear warning not to call it on a variable (as in this example). In fact, if you wrote:
(display "peak" (peak (s-read "a.wav" ny:all)))
then Nyquist would NOT save samples in memory. I would say Nyquist has a habit of NOT computing entire sounds in memory. The only time it does is when you EXPLICTLY save sounds in variables. I think it's really that *programmers* have a habit to save everything in global variables. This is considered bad practice in all programming languages.
OK, I'll stop flaming now.
I suspect that in many of these cases Nyquist does not actually crash, but performance suffers as memory pages out to disk. So I don't see a good way to recover until long after things are thrashing horribly. It might make sense to put an artificial memory limit on Nyquist so that a program like the one above would fail quickly with an "out of sample memory" error rather than attempt to allocate enough memory for all the samples. An built-in function could allow the user to query and change the limit. Comments are welcome.