# This script will add all the selected sounds # corrected to contain new-style syntax 1/9/00 - cjd # To make this script dynamic under the "Combine Sounds -" button run the next line: # Buttons... Sound 0 "" 0 "" 0 Add... Concatenate 1 yourdisk:yourfolder:scripts:Add_dynamic # The "Preserve real time" option keeps the samples that are added together in their absolute time positions. # If sounds have been Extracted from another Sound, then their absolute time position will ONLY have been preserved # if you have used "Extract windowed selection..." with the "Preserve times" option checked. # To preserve absolute times when you extract an UNwindowed waveform you should use "Extract windowed selection..." # with a Rectangular window with "Relative width"=1.0, since "Extract selection" does not have a "Preserve time" option. # Sampling frequency is set to that of the last-finishing sound form Add Sounds boolean Play_after_synthesis 1 positive Scaling_factor 1.0 comment Use "Real time" to preserve real time comment across different time domains and sampling rates (beware distortion) choice Mode: 2 button Point-by-point values button Real time comment Sampling frequency and duration of sum become that of longest sound comment endform #find out how many Sounds have been selected numberOfSounds = numberOfSelected ("Sound") #set up arrays with names and IDs of selected Sounds for ifile from 1 to numberOfSounds sound$ = selected$("Sound",'ifile') soundID = selected("Sound",'ifile') ids'ifile' = soundID names'ifile'$ = sound$ endfor # find the file with the most samples or longest duration maxduration = 0 for ifile from 1 to numberOfSounds filenum = ids'ifile' select 'filenum' if mode = 1 duration = Get number of samples elsif mode = 2 # get finishing time of sound duration = Get finishing time endif if duration > maxduration maxID = filenum maxduration = duration endif endfor # create a blank file that will run from zero to the end of the latest finishing time # with a sampling frequency that is the same as that of the last-finishing sound select 'maxID' sf = Get sample rate if mode = 1 Create Sound... sum 0 (maxduration/sf) sf 0 elsif mode =2 Create Sound... sum 0 maxduration sf 0 endif #now cycle through all selected files, add to sum for ifile from 1 to numberOfSounds sound$ = names'ifile'$ if mode = 1 Formula... self + 'Scaling_factor'*Sound_'sound$'[] else Formula... self + 'Scaling_factor'*Sound_'sound$'() endif endfor if play_after_synthesis Play endif