# This script has been written by Guillaume Rolland, ICP # comments to : rolland@icp.inpg.fr # The MOMEL_f0 PRAAT script change a signal f0 curve into its MOMEL representation # It can be useful to perceptualy test the efficience of the MELodic MOdelisation # This program just change the voiced values of the F0 initial contour into the MOMEL # values, obtained by approximating the initial f0 curve by second order polynoms # Load arguments : the sound file (default = selected sound file) # and the fo curve (default = momel curve) # Example : Use the MOMEL script to first generate the *.momel file # Copy the generated file in the directory where this script is and run # The script can run under prompt : praat momel_fo.script file_input.wav file_input.momel file_output.wav form Parameters word Input Sound word Pitch Momel word Output Sound_out.wav endform # Clear the text window clearinfo # What's the input files ? Sound = selected sound file.wav / Pitch = file.momel if input$ <> "Sound" and input$ <> "sound" Read from file... 'input$' endif name$ = selected$("Sound") name = selected("Sound") if pitch$ <> "Momel" and pitch$ <> "momel" input_file$ = pitch$ else input_file$ = name$+".momel" endif # What's the output file ? Create it. if output$ <> "Sound_out.wav" and output$ <> "Sound_out.wav" copy output$ output_file$ else output_file$ = name$+"_out.wav" endif filedelete 'output_file$' select 'name' To Analysis... 0.01 75 600 5 5500 0.025 50 0.01 8000 analysis = selected("Analysis") select 'analysis' Extract pitch tier pitch_tier = selected("PitchTier") # Takes duration as the number of points select 'pitch_tier' duration = Get duration duration = floor (100 * duration) # Creation du fichier d'entree Read Strings from raw text file... 'input_file$' name_string = selected("Strings") print Courbe MOMEL : printline # Load the MOMEL file in the input array for i from 1 to duration value = Get string... i input'i' = value print 'value' printline endfor Remove # Change the pitchtiers select 'pitch_tier' for i from 1 to duration j = i/100 current_point = Get nearest index from time... j time = Get time from index... current_point if abs(time - j) < 0.005 new_value = input'i' Remove point... current_point Add point... time new_value endif endfor # Generate (Resynthesis) output file select 'analysis' plus 'pitch_tier' Replace pitch tier select 'analysis' Get resynthesis (PSOLA) sound_out = selected("Sound") Rename... 1_out Write to WAV file... 'output_file$' # Cleaning up select 'analysis' plus 'pitch_tier' Remove select 'sound_out' Play