how to get txt for FOFS?

Started by Phoenix cat, April 04, 2024, 06:07:38 AM

Previous topic - Next topic

Phoenix cat

In Soundloom almost all effects using FoFs requires a txt files for certain parameters. But I dont know what to write in that file. May someone write a default text for that file? Thanks.

rwdobson

It looks like the assumed procedure (by Trevor Wishart) is to obtain the pitch breakpoint file from the (or a) source soundfile, using "Repitch getpitch 2..." (or Repitch->extract etc in Soundloom). Perhaps editied or modified using any number of tools to process breakpoint files. It is a plain time/freq format file. Of course, "repitch" requires an analysis file, which will requires running pvoc on the source soundfile first. If you are on a PC, you always have the GUI option of using BrkEdit, but I think there is a basic GUI draw/edit facility in Soundloom as well. I think a core idea is to start with repitch getpitch, and then apply changes to the breakpoint data (e.g. data reduction, shifts etc) according to the compositional goal.

How practical it is to apply such changes manually of course depends on the length of the source and the density of pitch movements - the generated breakpoint file may easily contain 100s of points. There is however no serious technical reason not to use short hand-written data files - the spirit of the software is very much that of experiment, trial and error - but the duration of the breakpoint file (final data line) should normally match or exceed that of the source file.

The FOFS tool in Soundloom uses the commandline program "psow" behind the scenes, and it may be useful to run that directly to see the usage messages, in conjunction with the general CDP documentation.

In Soundloom, the somewhat convoluted process starts with running pvoc on a source soundfile, and then selecting the analysis file as the input for "Repitch" - save the text output to some name, to ensure it appears in the Workspace (may need to click "Refresh"). Select the original soundfile, to make FOFS available in the Process window, and in the relevant parameter page use "Get File" to select the required breakpoint file.

And so on.

Robert Fraser

The PSOW (FOF) programs require a pitch-trace breakpoint file extracted using PTOBRK WITHZEROS.  And that requires a pitch file (.frq) extracted from a frequency analysis file (.ana), using REPITCH GETPITCH 1.  This is all better put in a little script (Windows CMD batch file or MacOS bash shell script).

Here are two similar scripts: the first kindly supplied by Richard Dobson for bash, and my own batch file (PC) based on Soundshaper. Both make use of arguments supplied on the commandline - particularly the infile and outfile names. Bash scripts have variables $1, $2 and so on, referring to the first, second etc. arguments; the equivalent in CMD batch files is %1, %2, etc.   Both scripts assume a mono input sound.

First, Richard's bash script frqtotext: note the usage "frqtotxt insndfile outtextfile", where outtextfile is the name of the pitch-trace file.

#!/bin/bash
echo frqtotxt.sh - shell script to prepare pitch-brkpnt-data file for
echo                use with a FOF-source file: lengths must match.
if [ $# -ne 2 ]
    then
        echo usage: frqtotxt insndfile outtextfile
        exit 1
fi
echo
echo pvoc anal 1 $1 infile.ana
pvoc anal 1 $1 infile.ana
echo repitch getpitch 1 infile.ana infilepchdummy.aiff infile.frq
repitch getpitch 1 infile.ana infilepchdummy.aiff infile.frq
echo ptobrk withzeros infile.frq $2 20
ptobrk withzeros infile.frq $2 20
echo Delete \(temporary\) files no longer needed:
echo rm infile.ana
rm infile.ana
echo rm infilepchdummy.aiff
rm infilepchdummy.aiff
echo rm infile.frq
rm infile.frq

Now the BAT version, which adds parameter values for the application PSOW STRETCH. In this example the file suffixes are in the script, so would not be supplied on the commandline:

REM %1 is input wav (just the name without .wav); %2 is the output wav (also without .wav)
REM %3 is amount of stretch; %4 is no. of grains
echo ***** PSOW STRETCH BATCH SCRIPT (PC) *****
echo off
REM  Convert wav to ana
pvoc anal 1 %1.wav %1.ana -c1024 -o3
REM Extract pitch
repitch getpitch 1 %1.ana %1pch.ana %1.frq 
REM erase unwanted pitch file             
erase %1pch.ana   
REM Create pitch-trace text file                                   
ptobrk withzeros %1.frq %1.pch 20   
REM Stretch the input sound                     
psow stretch %1.wav %2.wav %1.pch %3 %4   
REM Erase intermediate files...             
if exist %1.ana erase %1.ana                             
if exist %1.frq erase %1.frq                             
if exist %1.brk erase %1.brk
REM Optionally play the output
if exist %2.wav paplay -i %2.wav 

A typical commandline for this might be fofstretch my mystr 2.0 20. For test purposes, put the script in the same folder as the input file.
 

Robert Fraser

Addendum:
In the bash script above, .aiff should ideally be .wav nowadays (infilepchdummy.wav) and CDP is also advocating the use of PVOCEX instead of .ana for freq. analysis files  - i.e. "infile.pvx" instead of "infile.ana".  Pvx ensures compatibility with CSOUND; .ana still works though and is used in Soundshaper, which doesn't support .pvx yet.

For the PC version, check that you have the replacement REPITCH.exe (see post under the "Announce" category).