Page 2 of 2

Re: EFFECT/AMPLIFY - odd behavior?

Posted: Sat Mar 29, 2014 10:10 pm
by Robert J. H.
NTL2009 wrote:Yes- good point, I'll be mindful of the dither functions as I dig into this. I'm looking for the best audio that the various bit-depths can provide (rather than a strict mathematical reduction to X bit-depth), so I'll probably want dither enabled, but will check both ways.

Also, the above Nyquist Prompt code error-ed on me (probably something in the loop calculation), but there was enough there for me to figure what I needed.
I don't think that there's a bug, unless you've tried it on a stereo sample.
Look what the debug screen says.

Re: EFFECT/AMPLIFY - odd behavior?

Posted: Sat Mar 29, 2014 10:35 pm
by NTL2009
Robert J. H. wrote:
NTL2009 wrote: ...

Also, the above Nyquist Prompt code error-ed on me (probably something in the loop calculation), but there was enough there for me to figure what I needed.
I don't think that there's a bug, unless you've tried it on a stereo sample.
Look what the debug screen says.
I had used a stereo track, so I converted to mono, reset things to 32 bit float, and still got errors. I'm not looking to get this debugged (the "(quantize s X)" command is all I needed, but in case you were curious about the errors, here they are, pretty much all Greek to me:

Code: Select all

error: bad argument type - NIL
Function: #<Subr-SND-QUANTIZE: #a147208>
Arguments:
  NIL
  32768
Function: #<Subr-APPLY: #a146298>
Arguments:
  #<Subr-SND-QUANTIZE: #a147208>
  (NIL 32768)
Function: #<FSubr-COND: #a14758c>
Arguments:
  (LEN (SETF RESULT (MAKE-ARRAY LEN)) (DOTIMES (I LEN) (SETF (AREF RESULT I) (APPLY FN (MAPCAR (FUNCTION (LAMBDA (A) (COND ((ARRAYP A) (AREF A I)) (T A)))) ARGS)))) RESULT)
  (T (APPLY FN ARGS))
Function: #<FSubr-LET: #a145218>
Arguments:
  (LEN NEWLEN RESULT)
  (DOLIST (A ARGS) (COND ((ARRAYP A) (SETF NEWLEN (LENGTH A)) (COND ((AND LEN (/= LEN NEWLEN)) (ERROR (FORMAT NIL "In ~A, two arguments are vectors of differing length." FN)))) (SETF LEN NEWLEN))))
  (COND (LEN (SETF RESULT (MAKE-ARRAY LEN)) (DOTIMES (I LEN) (SETF (AREF RESULT I) (APPLY FN (MAPCAR (FUNCTION (LAMBDA (A) (COND ((ARRAYP A) (AREF A I)) (T A)))) ARGS)))) RESULT) (T (APPLY FN ARGS)))
Function: #<Closure-MULTICHAN-EXPAND: #9df0a04>
Arguments:
  #<Subr-SND-QUANTIZE: #a147208>
  NIL
  32768
Function: #<Closure-QUANTIZE: #9db3cb4>
Arguments:
  NIL
  32768
Function: #<FSubr-PROGV: #a148edc>
Arguments:
  (QUOTE (*WARP*))
  (IF (WARP-FUNCTION *WARP*) (LIST (LIST (SREF-INVERSE (WARP-FUNCTION *WARP*) T0) (WARP-STRETCH *WARP*) (WARP-FUNCTION *WARP*))) (LIST (LIST T0 (WARP-STRETCH *WARP*) NIL)))
  (QUANTIZE S (TRUNCATE (EXPT 2 (- 16 BIT-DEPTH))))
Function: #<FSubr-PROGV: #a148edc>
Arguments:
  (QUOTE (*WARP* *SUSTAIN* *START* *LOUD* *TRANSPOSE* *STOP* *CONTROL-SRATE* *SOUND-SRATE*))
  NYQ%ENVIRONMENT
  (AT-ABS T0 (QUANTIZE S (TRUNCATE (EXPT 2 (- 16 BIT-DEPTH)))))
Function: #<FSubr-SETF: #a1450b0>
Arguments:
  FIRST%SOUND
  (WITH%ENVIRONMENT NYQ%ENVIRONMENT (AT-ABS T0 (QUANTIZE S (TRUNCATE (EXPT 2 (- 16 BIT-DEPTH))))))
Function: #<FSubr-COND: #a14758c>
Arguments:
  ((< BIT-DEPTH LOOP%COUNT) (SETF FIRST%SOUND (WITH%ENVIRONMENT NYQ%ENVIRONMENT (AT-ABS T0 (QUANTIZE S (TRUNCATE (EXPT 2 (- 16 BIT-DEPTH))))))) (IF S%RATE (SETF FIRST%SOUND (FORCE-SRATES S%RATE FIRST%SOUND)) (SETF S%RATE (GET-SRATES FIRST%SOUND))) (SETF BIT-DEPTH (1+ BIT-DEPTH)) (COND ((= BIT-DEPTH LOOP%COUNT) FIRST%SOUND) ((ARRAYP S%RATE) (SND-MULTISEQ (PROG1 FIRST%SOUND (SETF FIRST%SOUND NIL)) SEQREP%CLOSURE)) (T (SND-SEQ (PROG1 FIRST%SOUND (SETF FIRST%SOUND NIL)) SEQREP%CLOSURE))))
  (T (SND-ZERO (WARP-TIME *WARP*) *SOUND-SRATE*))
Function: #<Closure: #a144660>
Arguments:
  184.733
1> 

Re: EFFECT/AMPLIFY - odd behavior?

Posted: Sun Mar 30, 2014 6:24 am
by Robert J. H.
Thanks for the report.
It is obvious that the loop runs out of "sound".
That's queer 'cos I do not get this error.
It might be sufficient to replace "s" with "(cue s)".
Anyways, It is fine that you can work with the quantize part alone.
Another idea would be to use weighted quantization, i.e. quieter sounds are more quantized than louder ones while keeping the bit-depth. That's a trick used in compressed audio formats.