ECMC PVC example file pvcanal2
# Example PVC script file >> pvcanal2 << :
# ECMC PVC example "pvcanal2" creates an analysis file of /sflib/wind/fl.c4
# The resulting analysis file is used in example "convolver2"

 #******************************************************
#... PHASE VOCODER ANALYSIS ...........................
#******************************************************

     # ******ECMC CHANGES & ADDITIONS: ***************
#******** INPUT & OUTPUT SOUNDFILES *************
  # input soundfile, can be aiff or wave format on Linux, aiff only on SGI
inputsf=/sflib/wind/fl.c4 
analysis_outputfile=$SFDIR/fl.c4.pvc  # output analysis file used by other pvc programs
                             # not playable
# ********************* #


   ##### 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 #####


#........ BEGIN/END TIMES to read input soundfile ........................

begintime=0        # time in input soundfile to BEGIN analysis
endtime=0          # time in input soundfile to END analysis
                   # (0 or negative end time defaults to end of file)

#======================================================
#*** ANALYSIS PARAMETERS ******************************

FFT_length=1024  # usually 1024, 512 or 2048
windowsize=0   # window size in samples; default 0 = 2 * FFT_length
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

analysis_frames_per_second=200

#.......... ANALYSIS CHANNEL(S) .......................
analysis_channel_1_to_max=0
    # (channels are numbered from 1-maximum)  (default 0 = use all channels)

#======================================================
#************* MODIFICATIONS **************************
#======================================================

#.................. Amplitude in DECIBELS ..........................

gain_in_decibels=0   # use to increase or decrease amplitude during resynthesis

#********ANALYSIS LOW/HIGH SHELF EQ *******************

ANALYSIS_LOW_SHELF_EQ_gain_in_decibels=0  # change to boost or cut low freqs
ANALYSIS_LOW_SHELF_EQ_frequency=300

ANALYSIS_HIGH_SHELF_EQ_gain_in_decibels=0  # change to boost or cut high freqs
ANALYSIS_HIGH_SHELF_EQ_frequency=600

#................. WARP ...............................

spectrum_warpshape_index=0  # int, float or FUNC
       # timbral modification, boosting (negative) or reducing (positive) low 
       # frequency components 

#.............. PRINT ................................ 

print_average_spectrum=0  # 0 = do not print, 1 = print


#====================================================
# COMMAND LINE SETUP -- OFFICE USE ONLY
#      (DO NOT WRITE BELOW THIS LINE)
#====================================================
PVCDIR=/usr/local/soundapps/PVC
PVCBIN=$PVCDIR/bin
pvroutine=$PVCBIN/pvanalysis  # ECMC
cd $SFDIR  # ECMC

if  [ "$OSTYPE" = "irix" ]
then
   input_file=pvcin  # ECMC temporary NeXT format input 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 ****** #
# ANALYSIS

pvanalysisroutine=pvanalysis

PVFLAGS="\
\
-N$FFT_length \
-M$windowsize \
-w$window_type \
-D$analysis_frames_per_second \
\
-A$gain_in_decibels \
\
-b$begintime \
-e$endtime \
\
-C$analysis_channel_1_to_max \
\
-H$ANALYSIS_LOW_SHELF_EQ_gain_in_decibels \
-m$ANALYSIS_LOW_SHELF_EQ_frequency \
\
-X$ANALYSIS_HIGH_SHELF_EQ_gain_in_decibels \
-R$ANALYSIS_HIGH_SHELF_EQ_frequency \
\
-W$spectrum_warpshape_index \
\
\
-p1 \
-P$print_average_spectrum \
\
"
echo "\n\n$pvanalysisroutine $PVFLAGS $input_file $analysis_outputfile  "

#$pvanalysisroutine $PVFLAGS $analysis_sndfile $analysis_outputfile ;
$pvanalysisroutine $PVFLAGS $input_file $analysis_outputfile ;

# *****  ECMC CHANGES & ADDITIONS: ******* #
if  [ "$OSTYPE" = "irix" ]
then
   /sbin/rm -f pvcin # ECMC
fi
echo 'Output analysis file:'  # ECMC
ls -l fl.c4.pvc  #   ECMC
#  ****** end of ECMC changes & additions ****** #


# If you have created any gen function files above delete them below: