ECMC PVC example file bandamp1-1

# ECMC PVC example script "bandamp1-1" uses the frequency response
# file of a fragment of a soprano tone created by example "freqresponse1"
# The input soundfile is the same soundfile (/sflib/voice/sop1.ds4)
# on which the freqresponse analysis was performed
# aiffinput=/sflib/voice/sop1.ds4 # freqresponsefile=sop1.ds4.ss.fr # created by ECMC example script "freqresponse1"

# In the resynthesis, only partials with intensities between -20 and -96
# dB are used. All of the stronger partial frequency components - those
# with intensities above -20dB - are eliminated:
# WINDOW_type__bandpass_0__bandreject_1=0
# WINDOW_upper_threshold_in_dB=-20 # int, float or FUNC
# WINDOW_lower_threshold_in_dB=-96 # int, float or FUNC
# The result is a type of unvoiced singing, emphasizing the noise
# components within the tone
# The time varying amplitudes of the partials are smoothed out to
# eliminate artifacts that might otherwise occur:
# envelope_attack_in_seconds=.1 # int, float or FUNC
# envelope_release_in_seconds=.1 # int, float or FUNC
# To restore some of the amplitude lost by eliminating the stronger
# frequency components we increase the output amplitude by 12 dB:
# gain_in_decibels=12 # int, float or FUNC

#******************************************************
#*************** BANDAMP (ECMC version)  **************
# ******ECMC CHANGES & ADDITIONS: ***************
PVCDIR=/usr/local/soundapps/PVC
PVCBIN=$PVCDIR/bin
cd $PVCBIN
#******** AIFF INPUT & OUTPUT SOUNDFILES *************
aiffinput=/sflib/voice/sop1.ds4
aiffoutput=bandamp1-1
freqresponsefile=sop1.ds4.ss.fr # created by ECMC example script "freqresponse1"
#******************************************************
# No gen functions are created in this example, so the template
# lines for creating these functions have been delted

#------------------------------------------------------
#******************** ANALYSIS ************************
#------------------------------------------------------

peaks_analysis_file=$freqresponsefile


peak_analysis_begintime=0
peak_analysis_endtime=0

ANALYSIS_METHOD_average_0_peak_1_flag=1
ANALYSIS_frames_per_second=32

ANALYSIS_print_response_to_terminal_0_no__1_yes=0

#------------------------------------------------------
#******************* SYNTHESIS ************************
#------------------------------------------------------

#******** BEGIN/END TIMES *****************************
# (-1 end time defaults to end of file)
begintime=0
endtime=-1  # begin & end times determine output duration

FFT_length=1024
windowsize=0

frames_per_second=200
time_expansion_contraction_factor=1


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

oscillator_resynthesis_threshold_in_dB=-96

#****** DYNAMIC PARAMETERS ****************************
frequency_shift=0  # int, float or FUNC
gain_in_decibels=12  # int, float or FUNC
pitch_transposition_in_semitones=0  # int, float or FUNC

#****** WINDOW PARAMETERS *****************************
peaks_response_smooth_factor_in_octaves=0
print_smoothed_freq_response_to_terminal_0_no__1_yes=0

WINDOW_type__bandpass_0__bandreject_1=0
WINDOW_upper_threshold_in_dB=-20  # int, float or FUNC
WINDOW_lower_threshold_in_dB=-96  # int, float or FUNC

#******** LOW/HIGH SHELF EQ (post transpose/shift) ****
LOW_SHELF_EQ_gain_in_decibels=-0
LOW_SHELF_EQ_frequency=200

HIGH_SHELF_EQ_gain_in_decibels=-0
HIGH_SHELF_EQ_frequency=4000
#************ENVELOPE RESPONSE **********************
envelope_attack_in_seconds=.1  # int, float or FUNC
envelope_release_in_seconds=.1  # int, float or FUNC

#********** 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)
#====================================================
# *****  ECMC CHANGES: ******* #
cd $SFDIR  # ECMC
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 $aiffinput -t au pvcin # ECMC
pvanalysisroutine=$PVCBIN/freqresponse  # ECMC
#  ****** end of ECMC changes & additions ****** #
# ANALYSIS

PVFLAGS="\
\
-N$FFT_length \
-M0 \
-D$ANALYSIS_frames_per_second \
\
-b$peak_analysis_begintime \
-e$peak_analysis_endtime \
\
-c$ANALYSIS_METHOD_average_0_peak_1_flag \
\
-P$ANALYSIS_print_response_to_terminal_0_no__1_yes \
\
-C$channel_1_to_max__0_all \
\
-B1 \
\
"
echo "\n$pvanalysisroutine $PVFLAGS $input_file $peaks_analysis_file"

$pvanalysisroutine $PVFLAGS $input_file $peaks_analysis_file ;

#exit ;
#====================================================
# SYNTHESIS
pvroutine=$PVCBIN/bandamp   # ECMC


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$channel_1_to_max__0_all \
-t$oscillator_resynthesis_threshold_in_dB \
\
-b$begintime \
-e$endtime \
\
-F$peaks_analysis_file \
-Q$WINDOW_upper_threshold_in_dB \
-q$WINDOW_lower_threshold_in_dB \
-S$peaks_response_smooth_factor_in_octaves \
-Z$print_smoothed_freq_response_to_terminal_0_no__1_yes \
-L$envelope_release_in_seconds \
-l$envelope_attack_in_seconds \
-W$WINDOW_type__bandpass_0__bandreject_1 \
\
-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 \
\
"
echo "\n$pvroutine $PVFLAGS $input_file $output_file"

$pvroutine  $PVFLAGS $input_file $output_file   ; 

# *****  ECMC CHANGES & ADDITIONS: ******* #
echo 'Converting temporary NeXT format output soundfile to aiff format:"'
/usr/local/bin/sox -t au pvcout -t aiff  $aiffoutput # ECMC
/sbin/rm -f pvcin pvcout   # ECMC
/usr/sbin/sfinfo -s $aiffoutput # ECMC
#  ****** end of ECMC changes & additions ****** #

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