stevethefiddle wrote:endolith wrote:Is there a better way to handle mono/stereo?
Yes there is, using (multichan-expand #'function arg1 arg2 ...)
I suggest getting the plug-in working just with mono tracks. Once it is working with mono tracks it is easy to convert it to accept multi-channel sounds.
stevethefiddle wrote:For stereo tracks, are you wanting to output data for the combined channels, or "left channel data" / "right channel data"?
(defun analyze (s-in) ; code that does the analysis and returns data as a string
(format NIL "Peak level ~a dB~%"
(linear-to-db (peak s-in ny:all))))
(defun analyze-mono (input) ; for mono tracks
(format NIL "Mono track.~%~a~%" (analyze input)))
(defun analyze-stereo (input) ; for stereo tracks
(format NIL "Stereo track.~%Left Channel: ~aRight Channel: ~a~%" (analyze (aref input 0))(analyze (aref input 1))))
(if (arrayp s)(analyze-stereo s)(analyze-mono s))
stevethefiddle wrote:No, I think it's written in C, but I know so little about C programming that I wouldn't know what to look for to find it.
(snd-fetch-array sound len step)
Reads sequential arrays of samples from sound, returning either an array of FLONUMs or NIL when the sound terminates.
(snd-samples sound limit)
Converts the samples into a lisp array.
Return to General Audio Programming
Users browsing this forum: No registered users and 3 guests