ECMC PVC example file harmonizer1-1
# Example PVC script file >> harmonizer1-1 << :
# COMMENTS: A 4 note dominant 7th chord (cc2 / g3/ bf4/e6) is created
# from a source violin tone. Each of the 4 "harmoinzed" notes
# contains the full frequency spectrum of the source violin tone
# (the -1 low and high frequency parameter arguments in the lines below:
# Note: Do not include any comments (#) or blank lines in the lines that
# create a harmonizer map file
# The following parameter values, written into the scratch file
# $SFDIR/harmonizermap, create 3 "harmonizer" notes with transpositions
# down 19 semitones (c2), up 15 semitones (bf4) and up 33 semitones (e6)# with gain
# adjustments of +9 dB, +4dB and -3 dB
# echo \
# \
# -19 -1 -1 9 \
# 15 -1 -1 4 \
# 33 -1 -1 -3 \
# \
# > $SFDIR/harmonizermap
# HARMONIZER_shift_file=harmonizermap

# The function below creates a master gain that increases linearly from -40 dB
# to -3 dB, and then decreases back to -40 dB, creating an amplitude swell
# in all 4 notes:

# gen3 -L100 -40 -6 -40 > $SFDIR/gainfunc

# The "source" tone g3 is reduced in amplitude by 9 dB:

# SOURCE_gain_in_dB=-6 # -0 # int,float or FUNC
# End of COMMENTS
#******************************************************
#................ HARMONIZER ..........................
#******************************************************
     # ******ECMC CHANGES & ADDITIONS: ***************
#******** INPUT & OUTPUT SOUNDFILES *************
  # input soundfile, can be aiff or wave format on Linux, aiff only on SGI
inputsf=/sflib/string/vln.g3 
outputsf=harmonizer1-1  # output soundfile
outputformat=AIFF  # for Linux only : specify AIFF or WAVE output format
# ********************* #


   ##### Cmusic function file generator tempates #####
gen3 -L1000 -40 -6 -40 > $SFDIR/gainfunc
#   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 **************************
output_data_format=1
   #  0=  Same as input file, 1 = integers 2 = rescaled floats 

#........ BEGIN/END TIMES .............................
begintime=0
endtime=0
# (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=200   # generally 200, sometimes 400 or 600 for time stretching

#........... OUTPUT CHANNEL(S) .......................

output_channel=0
   # channels are numbered from 1 to the maximum; 0 = all channels

#.............OSCIL THRESHOLD ........................

oscillator_resynthesis_threshold_in_dB=-80

#****************** MODIFICATIONS *********************

#.................. TIME ..............................
time_expansion_contraction_factor=1
     # (Adjust frames_per_second in proportion to keep a constant rate.)

#.................. DECIBELS ..........................
MASTER_gain_in_decibels=$SFDIR/gainfunc  # in dB, int, float or FUNC

#********** SOURCE ************************************

#.................. DECIBELS ..........................
SOURCE_gain_in_dB=-6  # in dB, int, float or FUNC

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

SOURCE_frequency_shift=0 # int,float or FUNC
SOURCE_pitch_transposition_in_semitones=0 # int,float or FUNC

#********** HARMONIZER ********************************
#.................. DECIBELS ..........................
HARMONIZER_gain_in_dB=-0 # int,float or FUNC

#.................. PITCH .............................
HARMONIZER_frequency_shift=0  # int, float or FUNC
HARMONIZER_pitch_transposition_in_semitones=0 # int,float or FUNC

#............ SPECTRUM WARPSHAPE ......................
spectrum_warpshape_index=0  # int, float or FUNC

#********* AMPLITUDE STATISTICS **********************
print_amplitude_statistics_0_no__1_yes=1
amplitude_statistics_time_interval=.25

#================ DATA FILE: =========================

HARMONIZER_data_file=$SFDIR/harmonizermap

#................. SHIFT METHOD ....................... 
HARMONIZER_shift_method=2
#( 0 = frequency multipler )
#( 1 = frequency adder )
#( 2 = semitones of transposition )

#............... BOUNDARY FORMAT ...................... 
HARMONIZER_boundary_data_format=1
 # 0 = frequency , 1 = octave.pitchclass )

#=====================================================

#*************** DATA FILE FORMAT ********************
# (1) transposition multiplier/semitone transpose  
# (2) low freq boundary (octave.pclass or freq)
# (3) high freq boundary (octave.pclass or freq)
# (4) dB
#*****************************************************
#EDIT THE LINES BELOW, for harmonizer "notes" 1 & 2, and add similar additional
# lines for additional harmonizer "notes" 
# Example: 
# Transposition = 1 semitone up, freqs. between c3 (7.00) and b4, -3 dB
# 1      7.00  8.11   -3  \


echo \
\
-19  -1  -1   9 \
15   -1   -1  4 \
33   -1   -1  -3 \
\
> $SFDIR/harmonizermap

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


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

PVFLAGS="\
\
-N$FFT_length \
-M$windowsize \
-w$window_type \
-D$frames_per_second \
-I$time_expansion_contraction_factor \
\
-C$output_channel \
-t$oscillator_resynthesis_threshold_in_dB \
\
-b$begintime \
-e$endtime \
\
-A$MASTER_gain_in_decibels \
\
-G$SOURCE_gain_in_dB \
-a$SOURCE_frequency_shift \
-P$SOURCE_pitch_transposition_in_semitones \
\
-W$spectrum_warpshape_index \
\
-Z$HARMONIZER_boundary_data_format \
-z$HARMONIZER_shift_method \
\
-m$HARMONIZER_gain_in_dB \
-q$HARMONIZER_frequency_shift \
-X$HARMONIZER_pitch_transposition_in_semitones \
-F$HARMONIZER_data_file \
\
-p$print_amplitude_statistics_0_no__1_yes \
-i$amplitude_statistics_time_interval \
\
-_$output_data_format \
-=$rescale_level_in_decibels \
\
"
echo "\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/harmonizermap