ECMC PVC example file twarp96.metrattle
Example PVC script used to create /sflib/x soundfile >> twarp96.metrattle.wav <
# The analysis file used is # input_analysis_file=metrat.shake.slow.pvc # This analysis has been previously created by the ECMC PVC example file # pvanalysis.96metrattle, which analyzes /sflib96/perc/shaker/metrat.shake.slow.wav # The duration of this source 96k 24 bit soundfile is 3.612 seconds # The output soundfile also will be 96k 24 bit: # outputformat=3 # 96k 24 bit output # However, the reynthesis output duration is set to 7 seconds: # duration=7.0 # original duration of analysis file was 3.61 # The analysis file is read all the way through twice, first backwards the forwards: #gen1 -L1000 0 3.5 .35 .01 1. 3.5 > $SFDIR/timepoint # Reading of the analysis file begins at time 3.5 seconds in the analysis file and, # over 35 % of the output duration of 7 seconds (over 2.45 seconds) the analysis is read # backwards to time .01 seconds. Then over the concluding 65 % of the 7 second output # duration, the analysis is read forwards from time .01 seconds to time 3.5 seconds # This function file is applied to the following 3 parameters: # time_point=$SFDIR/timepoint # int, float or FUNC # lower_time_boundary=$SFDIR/timepoint # int, float or FUNC # upper_time_boundary=$SFDIR/timepoint # -1 int, float or FUNC # The frame rate is increased from the default 200 to 600 framers per second because # of the complex amplitude and timbral envelopes of the source rattle and also because # of the resynthesis time warping #frames_per_second=600 # Output pitch is controlled by this function: # gen1 -L1000 0 2 .35 -4 1. -8 > $SFDIR/pitchfunc # pitch_transposition_in_semitones=$SFDIR/pitchfunc # int, float or FUNC # The pitch begins transposed up by 2 semitones, and during the first 35 % of the resynthesis # (during the backwards reading of the analysis) the pitch glisses down to a major third # (4 half steps) below the original pitch. During the rest of the resynthesis, the pitch # glisses further downwards, enging 8 half steps (a minor 6th) below the original pitch level # The timbral brightness is altered, swelling from ??? # gen1 -L1000 0 3. .18 -2. .35 3. .7 -2.5 1. 3 > $SFDIR/specwarpfunc # spectrum_warpshape_index=specwarpfunc # int, float or FUNC # Dithering is added to avoid flanging and artifacts: # timepoint_dither_window_in_seconds=.03 # to avoid flanging and clicks # time_point_change_response_time_in_seconds=.02 # During initial tests with this example I kept getting a click around 3.5 seconds into # the resynthesis. Fiddling with the output duration, dithering values and the pitchfunc # function eventually produced a clean result.
#****************************************************** #......................TWARP .......................... # time varying reading of an analysis file previously created with pvcanal #****************************************************** # ******TKLA CHANGES & ADDITIONS: *************** #******** INPUT & OUTPUT SOUNDFILES ************* cd $SFDIR # all files are created in your current working soundfile directory # input analysis file can be aiff or wave format on Linux, aiff only on SGI input_analysis_file=metrat.shake.slow.pvc outputsf=twarp96.metrattle.wav # output soundfile outputformat=3 # 96k 24 bit output # 0,1,2, or 3; 1 = 16 bit short ints; 2 = 32 bit floats; 3 = 24 bit ints # 0 outputs 16 bit ints if samp. rate < 50000, 24 bit ints if samp rate > 50000 ### VERY IMPORTANT: Change the 0 below to the desired output duration. If this # duration does not match the duration of the analysis, time warping will result # MUST BE CHANGED to desired output resynthesis duration duration=7.0 # original duration of analysis file was 3.61 # Note: duration of original analysis file is 3.61 gen1 -L1000 0 3.5 .35 .01 1. 3.5 > timepoint # ********************* # ##### Cmusic function file generator tempates ##### # gen0 normalizes function files previously created with other gen routines # gen0 -Llength max < inputfuncfile > outputfuncfile # gen1 creates linear {straight line} segments, like Csound gen 7 # gen1 -Llength t1 v1 ... tN vN # gen2 generates harmonic waveforms from sine {a} & cosine {b} amps # gen2 -Llength [-o (default) or -c] a1 ... aN b0 ... bM N # gen3 generates amp values & linear connections at equally spaced time points # gen3 -Llength v1 v2 ... vN # gen4 generates exponenetial segments; "a" values determine shape & # depth of curve: 0 = linear, neg. = exponential, pos. = inverse expo. # gen4 -Llength t1 v1 a1 ... tN vN # gen5 is like Csound gen 9 : harmonic1/amp/phase harmonic2/amp/phase # gen5 -Llength h1 a1 p1 ... hN aN pN # gen6 generates a table of random numbers between +1 and -1 # gen6 -Llength # cspline: smooth curve {cubic spline} interpolator # cspline len_flag [flags] x0 y0 x1 y1 ... xN yN # genraw reads in a previously created function file # genraw -LN filename (where N is the length of the output function.) # For a usage summary of "reshape" type "reshape" with no arguments. ##### End of gen routine function generator tempates ##### #*** ANALYSIS PARAMETERS ****************************** windowsize=0 # default 0 sets windowsize (in samples) to 2 * FFT_length if # samp. rate <= 48000 or to 4 * FFT_length if samp. rate > 48000 window_type=2 # window type: 0 = Hamming,1 = rectangular, 2 = Blackman (DEFAULT), # 3 = Bartlett triangular, 4-12 = Kaiser windows for alpha = 4-12 # generally recommended: 2 or 8 frames_per_second=600 # Set the frame rate to a value >= the frame rate used in the analysis. # Lesser frame rates create loss of amplitude and phasiness. # Default for both pvanalysis and twarp is 200 #====================================================== #*** RESYNTHESIS PARAMETERS *************************** #........... OUTPUT CHANNEL(S) ....................... output_channel=0 # (channels are numbered from 1 to maximum; 0 = resynthesize all channels #.............OSCIL THRESHOLD ........................ oscillator_resynthesis_threshold_in_dB=-80 # usually -60 to -80 #****************** MODIFICATIONS ********************* #.................. AMPLITUDE OUTPUT in dB .......................... gain_in_decibels=0 # int, float or FUNC #.................. PITCH ............................. frequency_shift=0 # int, float or FUNC gen1 -L1000 0 2 .35 -4 1. -8 > pitchfunc pitch_transposition_in_semitones=pitchfunc # int, float or FUNC #................ AMPLITUDE & FREQUENCY ENVELOPE RESPONSES ................. attack_time_in_seconds=0 # amplitude # int, float or FUNC release_time_in_seconds=0 # amplitude # int, float or FUNC frequency_change_response_time_in_seconds=0 # frequency # int, float or FUNC #====================================================== #**************** DATA TIME ************************** # Controls time varying reading of the analysis file DATA_access_mode__explicit_0__rate_1=1 # 0 = explicit, 1 = rate # In rate mode, set time_point to initial position & use rate_multiplier to # control speed at which analysis file is read (1 = original speed) # In explicit mode, control time_point with a function. # (Rate_multiplier is nonfunctional in explicit mode.) time_point=timepoint # int, float or FUNC rate_multiplier=1 #...................................................... lower_time_boundary=timepoint # int, float or FUNC upper_time_boundary=timepoint # -1 int, float or FUNC #(upper time < 0 defaults to file duration) #.....AUTOSTOP ........................................ autostop_on_1__off_0=1 # When on (1) , this will terminate synthesis if a boundary is crossed. #......TIMEPOINT DITHER ............................... timepoint_dither_window_in_seconds=.03 # to avoid flanging and clicks time_point_change_response_time_in_seconds=.02 # Unless you want flanging, time_point_change_response_time should typically # be set to between .01 and .05 #****************************************************** #********** SPECTRUM MODIFICATIONS ******************** #****************************************************** #............ SPECTRUM WARPSHAPE ...................... gen1 -L1000 0 3. .18 -2. .35 3. .7 -2.5 1. 3 > specwarpfunc spectrum_warpshape_index=specwarpfunc # int, float or FUNC # neg. values increase brightness, positive values descrease brightness #............. SPECTRUM COMPRESSION ................... spectrum_compression_threshold_in_decibels=-0 spectrum_decibels_of_compression=-0 #............. RANDOM AMPLITUDE VARIATION ............ random_amplitude_variation_decibel_floor=-0 # int, float or FUNC amplitude_variation_response_time_in_seconds=0 # int, float or FUNC #====================================================== #************** LOW/HIGH SHELF EQ ********************* LOW_SHELF_EQ_gain_in_decibels=-0 # int, float or FUNC to boost or cut low frequencies LOW_SHELF_EQ_frequency=60 # int, float or FUNC HIGH_SHELF_EQ_gain_in_decibels=-0 # int, float or FUNC to boost or cut high frequencies HIGH_SHELF_EQ_frequency=1000 # int, float or FUNC #====================================================== #............ RESCALE for floating point only................. rescale_level_in_decibels=0 # set to 1 to rescale to peak of input file; do not do this if input amplitude # is low #************ AMPLITUDE STATISTICS ******************** print_amplitude_statistics_0_no__1_yes=1 # use 0 to turn off amplitude display amplitude_statistics_time_interval=.25
#====================================================== # COMMAND LINE SETUP -- OFFICE USE ONLY # (DO NOT WRITE BELOW THIS LINE EXCEPT TO DELETE FUNCTION FILES AT VERY END) #==================================================== pvroutine=twarp # ****** TKLA changes & additions ****** # $pvroutine -d.1 -F$input_analysis_file pvcout 2> twarptmp$$ SR=`/usr/local/bin/sfsr $SFDIR/pvcout | awk '{print $1}'` ; rm -f pvcout if ( ( [ "$outputformat" == 1 ] ) || ( [ "$outputformat" == 2 ] ) ) ; then output_data_format=$outputformat ; output_file=$outputsf elif ( [ "$outputformat" == 3 ] ) ; then output_file=pvcout ; rm -f pvcout ; output_data_format=2 elif ( [ "$outputformat" == 0 ] ) ; then if ( [ `echo "$SR"` -gt 50000 ] ) ; then output_data_format=2 ; output_file=pvcout else output_data_format=1 ; output_file=$outputsf fi fi if ( ( [ `expr "$SR" \> "48000"` == 1 ] ) && ( [ "$windowsize" == "0" ] ) ) ; then # if SR is > 48000 & windowsize is set to 0 increase default windowsize FFTSIZE=`grep FFT\ SIZE twarptmp$$ | grep -v INPUT\ ANALYSIS | awk '{print $4}'` windowsize=`expr $FFTSIZE \* 4` fi rm -f twarptmp$$ # ****** end of TKLA changes & additions ****** # PVFLAGS="\ \ -M$windowsize \ -w$window_type \ -D$frames_per_second \ -d$duration \ \ -a$frequency_shift \ -P$pitch_transposition_in_semitones \ -A$gain_in_decibels \ \ -C$output_channel \ -t$oscillator_resynthesis_threshold_in_dB \ \ \ -F$input_analysis_file \ \ -u$DATA_access_mode__explicit_0__rate_1 \ -Q$time_point \ -Y$rate_multiplier \ -g$lower_time_boundary \ -G$upper_time_boundary \ -T$timepoint_dither_window_in_seconds \ -K$time_point_change_response_time_in_seconds \ \ -L$release_time_in_seconds \ -l$attack_time_in_seconds \ -f$frequency_change_response_time_in_seconds \ \ -W$spectrum_warpshape_index \ \ -b$random_amplitude_variation_decibel_floor \ -e$amplitude_variation_response_time_in_seconds \ \ -E$spectrum_compression_threshold_in_decibels \ -c$spectrum_decibels_of_compression \ \ -H$LOW_SHELF_EQ_gain_in_decibels \ -m$LOW_SHELF_EQ_frequency \ \ -X$HIGH_SHELF_EQ_gain_in_decibels \ -R$HIGH_SHELF_EQ_frequency \ \ -p$print_amplitude_statistics_0_no__1_yes \ -i$amplitude_statistics_time_interval \ \ -S$autostop_on_1__off_0 \ \ -_$output_data_format \ -=$rescale_level_in_decibels \ \ \ " echo "\n$pvroutine $PVFLAGS $output_file" ; $pvroutine $PVFLAGS $output_file ; # ***** TKLA CHANGES & ADDITIONS: ******* # echo outputformat is $outputformat and output_file is $output_file if ( ( [ "$outputformat" == "3" ] ) || ( [ "$outputformat" == "0" ] ) && ( [ "$output_file" == "pvcout" ] ) ) ; then echo "Converting temporary float output file pvcout to $outputsf :" floatto24 pvcout $outputsf 2> /dev/null ; rm -f pvcout echo " -------------------------------------------------------" else echo " -------------------------------------------------------" echo "Header information for output soundfile >> $outputsf << :" /usr/local/bin/sfinfo -s $outputsf fi # ****** end of TKLA changes & additions ****** # # If you have created any gen function files above delete them below: rm timepoint specwarpfunc pitchfunc