ECMC PVC example file twarp3
# ECMC pvc example twarp3: illustrates frequency shifting and
# modifications in playback speed of the analysis

# The analysis file is read at half the original speed:
# rate_multiplier=.5 # int, float or FUNC
# but not at a constant rate. Instead, it is read forwards then backwards,
# and speeds up and slows down, following the shape of the first half of
# a sine wave:
# gen5 -L1000 .5 1. 0
# Before being written to a file this table is piped into the PVC
# "rehape" utility, where the values are rescaled between 0 and 1.46
# (the furation of the analysis file):
# gen5 -L1000 .5 1. 0 | reshape -b0 -B1.46 > /$SFDIR/timepointfunc
# This function is applied to the following parameters:
# lower_time_boundary=$SFDIR/timepointfunc # 1 # 0 # int, float or FUNC
# upper_time_boundary=$SFDIR/timepointfunc # 1 # -1 # # int, float or FUNC
# The gain is increased by 3 dB, and 45 herz is added to each frequency
# in the spectrum, causing detuning:
# gain_in_decibels=3 # 3 dB gain applied int, float or FUNC
# frequency_shift=45 # int, float or FUNC
#******************************************************
#......................TWARP ..........................
# time varying reading of an analysis file previously created with pvcanal
#******************************************************
     # ******ECMC CHANGES & ADDITIONS: ***************
#******** INPUT & OUTPUT SOUNDFILES *************
  # input analysis file can be aiff or wave format on Linux, aiff only on SGI
input_analysis_file=voicetestclip.pvc
outputsf=twarp3  # output soundfile
    # can be aiff or wave format on Linux, aiff only on SGI
outputformat=AIFF  # for Linux only : specify AIFF or WAVE output format

 ### 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
duration=5.84          # MUST BE CHANGED to desired output resynthesis duration
# ********************* #

   ##### Cmusic function file generator tempates #####
# timepoint function is the first half of a sine wave:
  gen5 -L1000 .5 1. 0 | reshape -b0 -B1.46 > /$SFDIR/timepointfunc
# gen5 -Llength h1 a1 p1 ... hN aN pN

   ##### End of gen routine function generator tempates #####

#......................................................

output_data_format=1
   # 0 (default) = Same as input file, no input file reverts to integers 
   # 1 = integers  2 = floats ; normally set to 0 or 1 for integer output

#======================================================
#*** ANALYSIS PARAMETERS ******************************
windowsize=0  # 0 will automatically set window to 2*FFT size or larger
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=200
  # 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 pvcanal 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=3   # int, float or FUNC

#.................. PITCH .............................

frequency_shift=45   # int, float or FUNC
pitch_transposition_in_semitones=0   # 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=0  # 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=0   # int, float or FUNC
rate_multiplier=1

#......................................................

lower_time_boundary=$SFDIR/timepointfunc   # int, float or FUNC
upper_time_boundary=$SFDIR/timepointfunc   # 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=0 
time_point_change_response_time_in_seconds=0
  # Unless you want flanging, time_point_change_response_time should typically
  # be set to between .01 and .05

#******************************************************
#********** SPECTRUM MODIFICATIONS ********************
#******************************************************

#............ SPECTRUM WARPSHAPE ......................
spectrum_warpshape_index=0   # 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=40  # 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=60  # 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) 
#====================================================
# SYNTHESIS
PVCDIR=/usr/local/soundapps/PVC
PVCBIN=$PVCDIR/bin
pvroutine=$PVCBIN/twarp  # ECMC
cd $SFDIR  # ECMC

if  [ "$OSTYPE" = "irix" ]
then
   input_file=pvcin  # ECMC temporary NeXT format input soundfile
   output_file=pvcout  # ECMC temporary NeXT format output soundfile
   /sbin/rm -f pvcin pvcout  
   #  Create temporary NeXT format input soundfile "pvcin:" ECMC
   /usr/local/bin/sox -t aiff $inputsf -t au pvcin # ECMC
elif [ `echo "$OSTYPE" | grep linux`  ]
 then
  input_file=$inputsf
  output_file=$outputsf
fi
#  ****** end of ECMC changes & additions ****** #
pvroutine=twarp 

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   ; 

# *****  ECMC CHANGES & ADDITIONS: ******* #
if  [ "$OSTYPE" = "irix" ]
then
   echo 'Converting temporary NeXT format output soundfile to aiff format:"'
   /usr/local/bin/sox -t au pvcout -t aiff  $outputsf # ECMC
   /sbin/rm -f pvcin pvcout   # ECMC
   echo "Header information for output soundfile >> $outputsf << :"
   /usr/sbin/sfinfo -s $outputsf # ECMC
elif [ `echo "$OSTYPE" | grep linux`  ]
then
   if  [ "$outputformat" = "AIFF" ] 
     then
            echo "   Converting output soundfile $output_file to AIFF format ..."
            /usr/local/soundapps/PVC/bin/wav2aiff $output_file
   fi
   echo "Header information for output soundfile >> $outputsf << :"
   /usr/local/bin/sfinfo -s $outputsf 
fi
#  ****** end of ECMC changes & additions ****** #


# If you have created any gen function files above delete them below:
rm $SFDIR/timepointfunc