ECMC PVC example file plainpv6-1
# Example PVC script used to create /sflib/x soundfile >> plainpv6-1 <<
# ECMC pvc example "plainpv6-1," which illustrates use of time
# varying functions applied to both pitch and spectral warp index
# of an oboe tone.
# For details on this example, type : pvcex plainpv6
# This script produced the first tone in /sflibx example "plainpv6
#******************************************************
#****** script to run PLAINPV (ECMC version) **********
#******************************************************

# ******ECMC CHANGES & ADDITIONS: ***************
PVCDIR=/usr/local/soundapps/PVC
PVCBIN=$PVCDIR/bin
cd $PVCBIN

     # ******ECMC CHANGES & ADDITIONS: ***************
#******** INPUT & OUTPUT SOUNDFILES *************
  # input soundfile, can be aiff or wave format on Linux, aiff only on SGI
inputsf=/sflib/wind/oboe.d4
outputsf=$SFDIR/plainpv6-1 
  # output soundfile
outputformat=AIFF  # for Linux only : specify AIFF or WAVE output format
# ********************* #

# 2 function files created to control time varying frequency spectrum and pitch:
#  gen3 generates amp values & linear connections at equally spaced time points
# gen3 -Llength v1 v2 ... vN
 gen3 -L1000 5 5 -5 -5 5 > $SFDIR/spectrumfunc
#   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
 gen4 -L1000 0 -2 1 \
.25 -2 1 \
.5 4 1 \
.8 4 1 \
1 2 > $SFDIR/pitchfunc


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



output_data_format=1
   #  0=  Same as input file, 1 = integers 2 = rescaled floats

#******** BEGIN/END TIMES *****************************
   # beginning and end times within input soundfile for analysis/resynthesis
begintime=0    # time in input soundfile to begin analysis/resynthesis
endtime=0      # (-1 or 0 end time defaults to end of file)


#*** ANALYSIS PARAMETERS ******************************
FFT_length=1024  # must be power-of-2, usually 1024, 512 or 2048
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
windowsize=0
        # 0 sets windowsize to 2 * FFT (or larger)
frames_per_second=300   # generally 200, occasionally 400 or 600 when time stretching

time_expansion_contraction_factor=1.5

#**** OUTPUT CHANNEL(S) *******************************
resynthesis_channel_1_to_max__0_all=0
# (channels are numbered from 1-maximum)
# (0 = all channels)

oscillator_resynthesis_threshold_in_dB=-80

#****** RESYNTHESIS PARAMETERS **************************
frequency_shift=0   # detune partials, in herz; int, float or FUNC
gain_in_decibels=-0   # in dB, int, float or FUNC
pitch_transposition_in_semitones=$SFDIR/pitchfunc  # int, float or FUNC

#************ENVELOPE RESPONSE ************************
release_time_in_seconds=0   # int, float or FUNC
attack_time_in_seconds=0   # int, float or FUNC

#********** SPECTRUM WARPSHAPE ****************************
spectrum_warpshape_index=$SFDIR/spectrumfunc   # int, float or FUNC


#******** BRICKWALL BAND OR REJECT FILTER WINDOW ************
# (-1 selects respective lowest or highest)
FILTER_TYPE__0_bandpass__1_bandreject=1
BRICKWALL_FILTER_window_low_frequency=500
BRICKWALL_FILTER_window_high_frequency=1200

#*************** LOW/HIGH SHELF EQ *************************
LOW_SHELF_EQ_gain_in_decibels=0   
LOW_SHELF_EQ_frequency=1000

HIGH_SHELF_EQ_gain_in_decibels=-0
HIGH_SHELF_EQ_frequency=1100


#******** TERMINAL DISPLAY ****************************
TERMINAL_DISPLAY_0_off__1_phase__2_magnitude__3_both=0
TERMINAL_DISPLAY_low_bin=10
TERMINAL_DISPLAY_high_bin=30
TERMINAL_DISPLAY_number_of_frames=1
#======================================================
#........... 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
amplitude_statistics_time_interval=.25
 

#====================================================
# COMMAND LINE SETUP -- OFFICE USE ONLY
#      (DO NOT WRITE BELOW THIS LINE)
#====================================================
PVCDIR=/usr/local/soundapps/PVC
PVCBIN=$PVCDIR/bin
pvroutine=$PVCBIN/plainpv  # 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 ****** #

PVFLAGS="\
\
-N$FFT_length \
-M$windowsize \
-D$frames_per_second \
-I$time_expansion_contraction_factor \
\
-a$frequency_shift \
-P$pitch_transposition_in_semitones \
-A$gain_in_decibels \
\
-C$resynthesis_channel_1_to_max__0_all \
-t$oscillator_resynthesis_threshold_in_dB \
\
-b$begintime \
-e$endtime \
\
-H$LOW_SHELF_EQ_gain_in_decibels \
-m$LOW_SHELF_EQ_frequency \
\
-X$HIGH_SHELF_EQ_gain_in_decibels \
-R$HIGH_SHELF_EQ_frequency \
\
-L$release_time_in_seconds \
-l$attack_time_in_seconds \
\
-W$spectrum_warpshape_index \
\
-T$FILTER_TYPE__0_bandpass__1_bandreject \
-f$BRICKWALL_FILTER_window_low_frequency \
-F$BRICKWALL_FILTER_window_high_frequency \
\
-S$TERMINAL_DISPLAY_0_off__1_phase__2_magnitude__3_both \
-u$TERMINAL_DISPLAY_low_bin \
-U$TERMINAL_DISPLAY_high_bin \
-n$TERMINAL_DISPLAY_number_of_frames \
\
-p$print_amplitude_statistics_0_no__1_yes \
-i$amplitude_statistics_time_interval \
"

echo "\n\n$pvroutine $PVFLAGS $input_file $output_file "

$pvroutine  $PVFLAGS $input_file $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/spectrumfunc $SFDIR/pitchfunc