Re: [Audacity-nyquist] Nyquist trouble saving sound file
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
|
From: Domonkos N. <na...@ya...> - 2004-11-30 10:48:36
|
hi Eivind,
i don't have nyquist at hand so cannot verify, but i see 2 problems
at first sight:
1. when you initialize the new instance of the substract-class,
you do not initialize both parameters, so in the following
the second line should be (setf s2 (snd-copy p2)):
> (send subtract-class :answer :isnew '(p1 p2)
> '((setf s1 (snd-copy p1))
> (setf s1 (snd-copy p1))))
2. similarly in the command line you initialize my-snd3 twice, and
then try to substract my-snd2 (this might be just a typo though).
> (setf my-snd3 (snd-copy (aref my-snd 0)))
best,
Domonkos
On Mon, Nov 29, 2004 at 08:13:07PM +0100, Eivind L. Rygge wrote:
> Hi!
>
> I am trying to write an audacity plugin in Nyquist, I use the nyquist
> prompt for the development.
>
> I have borrowed some code from the Nyquist manual (the DSP chapter), the
> code is as follows (never mind that it returns a sound with only zeros, at
> least then I know it's working...):
>
> ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
> ;nyquist plug-in
> ;version 1
> ;type process
> ;name "Wav-fix (test)"
> ;action "Calculating delta values in waveform"
>
> (setf subtract-class (send class :new '(s1 s2)))
>
> (send subtract-class :answer :next '()
> '((let ((f1 (snd-fetch s1))
> (f2 (snd-fetch s2)))
> (cond ((and f1 f2)
> (- f1 f2))
> (t nil)))))
>
> (send subtract-class :answer :isnew '(p1 p2)
> '((setf s1 (snd-copy p1))
> (setf s1 (snd-copy p1))))
>
> (defun snd-subtract (s1 s2)
> (let (obj)
> (setf obj (send subtract-class :new s1 s2))
> (snd-fromobject (snd-t0 s1) (snd-srate s1) obj)))
>
> I then try to load this file (wav-fix3.ny) and use it on a stereo wav-file:
>
> eivind@lennart:~$ ny
> XLISP version 2.0, Copyright (c) 1986, by David Betz
> CMU MIDI Toolkit, Copyright (c) 1993,1994, by Roger B. Dannenberg
> ; loading "/usr/share/nyquist/runtime/init.lsp"
> ; loading "/usr/share/nyquist/runtime/nyinit.lsp"
> ; loading "/usr/share/nyquist/runtime/fileio.lsp"
> AutoNorm feature is on.
> ; loading "/usr/share/nyquist/runtime/follow.lsp"
> Default sound file is eivind-temp.wav.
> system.lsp : *RUNTIME-PATH* = /usr/share/nyquist/runtime/
>
> Nyquist -- A Language for Sound Synthesis and Composition
> Copyright (c) 1991,1992,1995 by Roger B. Dannenberg
> Version 2.29
>
> > (load "/home/eivind/src/eivind/wav-fix/trunk/wav-fix3.ny")
> ; loading "/home/eivind/src/eivind/wav-fix/trunk/wav-fix3.ny"
> [ gc: total 16640, 402 free; samples 1KB, 0KB free ]
> T
> > (setf my-snd (s-read
> "/home/eivind/src/eivind/wav-fix/trunk/MozartKons_part2_pcm32.wav"))
> #(#<Sound: #401ee348> #<Sound: #401ee7e0>)
> > (setf my-snd3 (snd-copy (aref my-snd 0)))
> #<Sound: #401ee848>
> > (setf my-snd3 (snd-copy (aref my-snd 0)))
> #<Sound: #401ee898>
> > (setf new-snd (snd-subtract my-snd2 my-snd3))
> #<Sound: #401ee9d0>
> > (s-save new-snd 100000000 "./testfil2.wav")
> Saving sound file to ./testfil2.wav
> error: bad argument type - NIL
> 1> (s-save new-snd 100000000 "./testfil2.wav")
> Saving sound file to ./testfil2.wav
> SND_get_first returned 0 samples
> snd_list info: 401eea20 allocated by snd_list_create, seq_num 35
> block info: 401eeaa0 allocated by fromobject__fetch, seq_num 38
> SOUND PRINT TREE of 401f1ad0
> sound_type@401f1ad0(SND_get_first@809d040)t0 0 stop 2147483647 sr 96000
> lsc -1030 scale 1 pc 0->snd_list@401\
> eea20 (skipping 1) ->
> susp@401ee988(fromobject)toss_cnt 0 current 0 lsc -1030 sr 96000 t0 0
> 401eea88
> It is possible that you created a recursive sound
> using something like: (SETF X (SEQ (SOUND X) ...))
> Nyquist aborts from non-recoverable error
> /usr/bin/ny: line 6: 31570 Avbrutt (SIGABRT)
> XLISPPATH=/usr/share/nyquist/runtime:/usr/share/nyquist/l\
> ib /usr/bin/ny.bin
> eivind@lennart:~$
>
> So there. I am a bit stuck. What is the NIL it is complaining about the
> first time I use s-save? And why does it crash the second time?
>
> Hope the lines are formatted ok (I guess I will know when I get the email
> from the list...)
>
> Eivind
> --
> Denne epost er fri for dihydrogenmonoksid. / This email does not contain
> any dihydrogen monoxide. (http://www.dhmo.org)
>
|