ECMC PVC example file envelope1
# Example PVC examples >> envelope1 <<
# This script create a analysis file of the amplitude of input soundfile /sflib/perc/maracaroll
# This amplitude-tracking analysis file then is used in ECMC PVC exmaple
# plainpv7, where this maracaroll amplitude envelope is imposed on a gong tone
# Defaults are used for all analysis parameters in this file
#******************************************************
#............ ENVELOPE EXTRACTOR ......................
#******************************************************
     # ******ECMC CHANGES & ADDITIONS: ***************

#******** INPUT SOUNDFILE & OUTPUT ENVELOPE ANALYSIS FILE  *************
 # input soundfile, can be aiff or wave format on Linux, aiff only on SGI
inputsf=/sflib/perc/maracaroll 
envelope_file=pvc.maracaroll.env  #  output envelope analysis file
# ********************* #


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

begintime=0
endtime=0

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

FFT_length=1024
windowsize=0
# (0 sets windowsize to 2 * FFT (or larger))
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 CHANNEL(S) .......................
analysis_channel=0
# channels are numbered from 1-maximum; 0 = all channels
#......................................................
method_on_multiple_channels__average_0__peak_1=1

#.............   FRAMES ...............................
analysis_frames_per_second=200

#======================================================
#*************** DETECTION PARAMETERS *****************
boundary_data_type=0
  # 0 = frequency   1 = octave.pitchclass 

#............... BOUNDARIES ............................

LOW_freq_or_pitch_boundary=0
HIGH_freq_or_pitch_boundary=22050

#...........FILTERED ENVELOPE ..........................
#( This envelope is cut from the original before smoothing
# and compression/gating. )

filtered_envelope_attack_time_in_seconds=0
filtered_envelope_release_time_in_seconds=0

filtered_envelope__0_to_1__cut_proportion=0
#( 0 = off )


#................ OUTPUT RATE  ........................

ouput_sample_rate=1000
#( for non soundfile data types)

#................ OUTPUT FORMAT  ......................

output_data_format=1  # usually use the default 1
#( 0: 0-1 amplitude )
#( 1: -96 to -0 decibels )
#( 2: inverted amplitude (1 - amplitude) )
#( 3: inverted decibels (0 - decibels + 96.) )

#............... OUTPUT TYPE  .........................

output_data_type=1  # default 1 recommended
# 0: ascii # 1: 32-bit floats # 2: integer soundfile (sr = 44100) )

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

#.......... AMPLITUDE RESPONSE ........................
attack_time_in_seconds=0
release_time_in_seconds=0

#............ COMPRESSOR ..............................
compression_threshold_in_decibels=-0
decibels_of_compression=-96

#............ GATE ....................................
gate_threshold_in_decibels=-96

#............ WARP ....................................
amplitude_envelope_warp=0


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

if  [ "$OSTYPE" = "irix" ]
then
   analysis_sndfile=pvcin
   input_file=pvcin  # ECMC temporary NeXT format input soundfile
   #  Create temporary NeXT format input soundfile "pvcin:" ECMC
   /sbin/rm -f pvcin 
   /usr/local/bin/sox -t aiff $inputsf -t au pvcin # ECMC
elif [ `echo "$OSTYPE" | grep linux`  ]
 then
  analysis_sndfile=$inputsf
fi
#  ****** end of ECMC changes & additions ****** #
# ANALYSIS
#
#analysisroutine=envelope

PVFLAGS="\
\
-N$FFT_length \
-w$window_type \
-M$windowsize \
-D$analysis_frames_per_second \
\
-b$begintime \
-e$endtime \
\
-C$analysis_channel \
\
-Q$boundary_data_type \
-f$LOW_freq_or_pitch_boundary \
-F$HIGH_freq_or_pitch_boundary \
-L$release_time_in_seconds \
-l$attack_time_in_seconds \
-W$amplitude_envelope_warp \
-G$decibels_of_compression \
-T$compression_threshold_in_decibels \
-S$gate_threshold_in_decibels \
-r$ouput_sample_rate \
-g$output_data_type \
-q$output_data_format \
\
-j$filtered_envelope_attack_time_in_seconds \
-k$filtered_envelope_release_time_in_seconds \
-m$filtered_envelope__0_to_1__cut_proportion \
\
-X$method_on_multiple_channels__average_0__peak_1 \
-p1 \
\
"
echo "\n\n$analysisroutine $PVFLAGS $analysis_sndfile $envelope_file  "
$analysisroutine $PVFLAGS $analysis_sndfile $envelope_file ;

# *****  ECMC CHANGES & ADDITIONS: ******* #
if  [ "$OSTYPE" = "irix" ]
then
   /sbin/rm -f pvcin 
fi
#  ****** end of ECMC changes & additions ****** #
echo "Header information for PVC envelope analysis file $envelope_file :"
ls -l  $envelope_file

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