;; pitch-seq.sal -- convert data to pitch sequence ;; ;; Roger B. Dannenberg ;; Nov 2018 load "data-plot.sal" function data-to-pitch(x) return round(float(x) / 20000 * 80 + 30) function pitch-seq(pairs) ;; pairs is an array of pairs of data: (m/z, intensity) begin with data = pairs-to-array(pairs) exec plot-array(pairs) exec score-gen(score-len: length(data), pitch: data-to-pitch(data[sg:count]), ioi: 0.1, save: quote(sonification-score)) return sonification-score end function f4() begin with filename print "Enter number for file pair:" loop for fn in FILES for i from 0 exec format(t, "~A: ~A~%", i, fn) end set filepair = nth(read(), FILES) exec format(t, "Sonifying ~A~%", filepair) exec score-play(pitch-seq(data-read-pairs(filepair))) end