>
ECMC PVC example file inharm1-4
# ECMC PVC and /sflib/x example "inharm1-4" :
# The inharmonator fundamental frequency is set to double the frequency
# (392 hz.) of the source violin tone (196):
# INHARMONATOR_fundamental_frequency=392 # int, float or FUNC
# Odd numbered partials are shifted, alternately a major 2nd lower and
# a major second higher, which become major tenths lower and higher:
# echo \
# \
# 1 .89 -0 \
# 3 1.12 0 \
# 5 .89 -0 \
# \
# 7 1.12 -0 \
# 9 .89 -0 \
# 11 1.12 0 \
# 13 .89 0 \
# 15 1.12 0 \
# \
# > $SFDIR/inharmonatorfile
#******************************************************
#................. INHARMONATOR .......................
#******************************************************
     # ******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=$SFDIR/inharm1-4  # output soundfile
outputformat=AIFF  # for Linux only : specify AIFF or WAVE output format
# ********************* #

   ##### Cmusic function file generator tempates #####
# (No gen functions used in this example)
   ##### End of gen routine function generator tempates #####

#******************** OUTPUT **************************
output_data_format=0
   #  0=  Same as input file, 1 = integers 2 = rescaled floats 
#******************** INPUT ***************************
#........ BEGIN/END TIMES .............................
begintime=0
endtime=0
# (0 or less 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, occasionally 400 or 600 when time stretching

#======================================================
#*** RESYNTHESIS PARAMETERS ***************************

#.................. TIME ..............................
time_expansion_contraction_factor=.5 # speed is doubled, duration cut in half

#........... OUTPUT CHANNEL(S) .......................
output_channel=0

# (channels are numbered from 1-maximum)
  # channels are numbered from 1 to the maximum; 0 = all channels

#.............OSCIL THRESHOLD ........................
oscillator_resynthesis_threshold_in_dB=-80

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

#.................. DECIBELS ..........................

MASTER_gain_in_decibels=-2  # int, float or FUNC

#======================================================
#********** SOURCE ************************************

SOURCE_frequency_shift=0  # int, float or FUNC
SOURCE_pitch_transposition_in_semitones=-0  # int, float or FUNC
SOURCE_gain_in_dB=-20  # int, float or FUNC

#............ AMPLITUDE RESPONSE ......................
SOURCE_attack_time_in_seconds=0  # int, float or FUNC
SOURCE_release_time_in_seconds=0  # int, float or FUNC

#********** NON TARGETS ********************************
NON_TARGETS_frequency_shift=0
NON_TARGETS_pitch_transposition_in_semitones=0 # int, float or FUNC
NON_TARGETS_gain_in_dB=-96  # int, float or FUNC
   # Range 0 to -96 (the default)
   # -96 provides the maximum possible suppression of non-target partials
   # but does not provide complete suppression
   # 0 causes no attenuation in the amplitude of the non-target partials
#======================================================
#********** TARGETS ********************************

#............ FUNDAMENTAL FREQUENCY .....................
INHARMONATOR_fundamental_frequency=392  # int, float or FUNC
#  IMPORTANT: If possible change the default value of 500 above
  #  to the fundamental frequency, in herz, of the input soundfile
  #  Use the "midinote" command, or else consult the help file "herz"  #  to determine this frequuency
  #  For inharmonic sounds, try changing the 500 default to various other
  #  values, and choose the value that provides the best result

#*****TARGETS SHIFT FILE: DATA FORMAT
# Edit the template table below, changing the 3 values for each partial
# and adding or deleting lines to specify more or less than 10 target
# partials. Do not include any comments or blank lines within this function
# definition and make sure that the \ at the end of each line is preceded
# by a space
# The 3 arguments on each line below specify the:
# 1) partial number
# 2) shift
# 3) change in gain in decibels

#==== CREATE TARGET SHIFT FILE DATA HERE ==============
echo \
1       .89    -0 \
3       1.12        0 \
5       .89         -0 \
\
7       1.12        -0 \
9       .89         -0 \
11       1.12        0 \
13      .89         0 \
15      1.12        0 \
> $SFDIR/inharmonatorfile  

#*************** TARGETS ********************************
TARGETS_shift_file=$SFDIR/inharmonatorfile #Do not change this line unless
                                         # you really know what you are doing
#======================================================
SHIFT_DATA_FORMAT=0
#  0 = frequency multiplier       1 = map to frequency 
#  2 = map to octave.pitchclass   3 = map to partial number 
#======================================================

TARGETS_partial_band_edge_decibels=-0

#.................. DECIBELS ..........................
TARGETS_frequency_shift=0  # int, float or FUNC
TARGETS_pitch_transposition_in_semitones=0 # int, float or FUNC
TARGETS_gain_in_dB=-0  # int, float or FUNC

#.................CONTROL  ..........................
TARGETS_freq_shift_control_proportion=1  # int, float or FUNC
#(control proportion is 0-1, 0=no shift, 1=full shift)


#............ SPECTRUM WARPSHAPE ......................
TARGETS_spectrum_warpshape_index=0

#............ RESPONSE ...............................

INHARMONATOR_attack_time_in_seconds=0 # int,float or FUNC
INHARMONATOR_release_time_in_seconds=0 # int,float or FUNC
INHARMONATOR_frequency_response_time_in_seconds=0 # 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
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
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=inharmonator

PVFLAGS="\
\
-N$FFT_length \
-M$windowsize \
-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 \
\
-Q$SOURCE_frequency_shift \
-u$SOURCE_pitch_transposition_in_semitones \
-r$SOURCE_gain_in_dB \
-l$SOURCE_attack_time_in_seconds \
-L$SOURCE_release_time_in_seconds \
\
-f$INHARMONATOR_fundamental_frequency \
-v$INHARMONATOR_attack_time_in_seconds \
-V$INHARMONATOR_release_time_in_seconds \
-Y$INHARMONATOR_frequency_response_time_in_seconds \
-Z$SHIFT_DATA_FORMAT \
\
-a$NON_TARGETS_frequency_shift \
-P$NON_TARGETS_pitch_transposition_in_semitones \
-G$NON_TARGETS_gain_in_dB \
\
-F$TARGETS_shift_file \
-B$TARGETS_partial_band_edge_decibels \
-q$TARGETS_frequency_shift \
-X$TARGETS_pitch_transposition_in_semitones \
-m$TARGETS_gain_in_dB \
-S$TARGETS_shift_control_proportion \
\
\
-W$TARGETS_spectrum_warpshape_index \
\
-p$print_amplitude_statistics_0_no__1_yes \
-i$amplitude_statistics_time_interval \
\
-_$output_data_format \
-=$rescale_level_in_decibels \
\
\
"
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/inharmonatorfile