Error on say when output format is wave - macos

I am trying to create wave files using mac's say command, however, I get the following error:
$ say "hello" -o hi.wav
Opening output file failed: fmt?
although,
$ say --file-format=?
WAVE WAVE (.wav) [lpcm,ulaw,alaw]
Is there some way I can get say to output a wave file?

It infers the file format from the file extension, but you need to specify the data format:
say -o hi.wav --data-format=LEF32#22050 "hello"

Related

pdftk update_info command raising a warning which I don't understand

I'm trying to use the update_info command in order to add some bookmarks to an existing pdf's metadata using pdftk and powershell.
I first dump the metadata into a file as follows:
pdftk .\test.pdf dump_data > test.info
Then, I edit the test.info file by adding the bookmarks, I believe I am using the right syntax. I save the test.info file and attempt to write the metadata to a new pdf file using update_info:
pdftk test.pdf update_info test.info output out.pdf
Unfortunately, I get a warning as follows:
pdftk Warning: unexpected case 1 in LoadDataFile(); continuing
out.pdf is generated, but contains no bookmarks. Just to be sure it is not a syntax problem, I also ran it without editing the metadata file, by simply overwriting the same metadata. I still got the same warning.
Why is this warning occurring? Why are no bookmarks getting written to my resulting pdf?
using redirection in that fashion
pdftk .\test.pdf dump_data > test.info
will cause this known problem by building wrong file structure, so change to
pdftk .\test.pdf dump_data output test.info
In addition check your alterations are correctly balanced (and no unusual characters) then save the edited output file in the same encoding.
Note:- you may need to consider
Use dump_data_utf8 and update_info_utf8 in order to properly display characters in scripts other than Latin (e. g. oriental CJK)
I used pdftk --help >pdftk-help.txt to find the answer.
With credit to the previous answer, the following creates a text file of the information parameters: pdftk aaa.pdf dump_data output info.txt
Edit the info.txt file as needed.
The pdftk update_info option creates a new pdf file, leaving the original pdf untouched. Use: pdftk aaa.pdf update_info info.txt output bbb.pdf

Batch Convert Files Different Output Folder

Goal is to convert all .wav files to .mp3 in a different location.
The following code works, but creates output files in the same directory.
All the newly created .mp3's are right alongside the .wav's.
for file in /path/to/*.wav; do lame --preset insane "$file" "${file%.wav}".mp3; done
How can I use terminal to convert a drive full of .wav's with lame and output the .mp3's to a different drive? I've tried changing lame's output, but this syntax grabs the entire filename. Looking for the most simple solution.
From the lame manual, the synopsis is very straightforward:
lame [options] <infile> <outfile>
Found the basic concept here
Assuming that the output files should be placed to /output, possible to extend loop to calculate the output file name using the 'basename'
OUT=/output
for file in /path/to/*.wav; do
# Replace .wav with .mp3
out=${file%.wav}.mp3
# Remove directory (anything up to the last '/'
out=${file##*/}
lame --preset insane "$file" $OUT/$out
done

How to redirect output from one folder to another?

I try to redirect the result of RNAfold external program that take input files from ./Desktop/Data and want to save execution to the folder ./Desktop/Results/Rfam.
I tried to use the following logic: command < input >> output. But nothing happens except creating files that didn't exist before with a NULL length.
RNAfold < ./Desktop/Data/RF*.fa >> ./Desktop/Results/Rfam/res.txt
None of errors appeared. I work on MAC OS X and it is first time I used bash, I looked manual and saw examples that I used, but nothing happened. RNAfold didn't execute, but when I try RNAfold < RF*.fa >> res.txt
all is going well - obtained results for input files, but they appeared at the same folder.
Default behaviour of RNAfold is to take input from standard input (or the files following RNAfold command)and output to standard out. To specify the input file you can also use -i or --infile=. Similarly for output file -o or --outfile=.
RNAfold -i ~/Desktop/Data/RF*.fa -o ~/Desktop/Results/Rfam/res.txt
or try
RNAfold ~/Desktop/Data/RF*.fa -o ~/Desktop/Results/Rfam/res.txt
Reference

Converting from .dat to netcdf(.nc)

I have a .dat file https://www.dropbox.com/s/8dbjg0i6l7a4sb6/CRUST10-xyz-complete.dat?dl=0 that I need to convert to either .grd or .nc, so that I can visualize the data in GMT(Generic Mapping Tool). I tried to do this using cdo using following command:
cdo -f nc import_binary CRUST10-xyz-complete.dat CRUST10-xyz-complete.nc
but got following error:
Open Error: Unknown keyword in description file
--> The invalid description file record is:
--> 0.5,89.5,4.19,0,2,0.7,0,0.73,1.62,5.01,14.25,10.06,7.36,2.7,1.5,3.81,2,3.5,0,5,6.5,7.1,8.07,5.5865805168986,6.7596467391304,2.3888888888889
The data file was not opened.
cdo import_binary (Abort): Open failed!
Can anyone please guide?
First make .ctl file then apply:-
cdo -f nc import_binary CRUST10-xyz-complete.ctl CRUST10-xyz-complete.nc
Here is the example link for to make .ctl file. http://cola.gmu.edu/grads/gadoc/descriptorfile.html
It will definitely work for you. Thanks!
Without the data itself, it is hard to see what went wrong. In any case, just look at the following message from cdo forum:
https://code.mpimet.mpg.de/boards/1/topics/3631
which you could use as an example of how to convert ASCII data to netCDF using cdo's.

Setting up custom build environment

I am trying to set up my custom build environment for Sublime Text 3 for competitive Programming.
My target is as follows :
Build the current source file
Run it and read inputs from a file input.in
Write output to a file output.out
diff expected output.out. expected file contains the expected output
This is how the window setup looks like
This is my json file for the build system
{
"cmd": ["g++ -std=c++11 ${file} -o ${file_path}/${file_base_name} && ${file_path}/${file_base_name}<${file_path}/input.in>${file_path}/output.out && diff output.out expected"],
"shell":true
}
So far steps 1-3 are working as expected. But for last step 4, I am not able to get the result in proper suitable format. e.g. when files match there is no output (as diff generates nothing in case of match) and in case of non-match, this build system is generating output in non human-readable format.
5a6
> f
[Finished in 0.1s with exit code 1]
Can anyone suggest a better way to output the result or is there a way to use linux's notification utility

Resources