batch extraction of features - csv files not stored - audio

I want to extract audio features from a large set of files using pyaudioanalysis, using the following command line (as suggested on the github project's page):
python3 audioAnalysis.py featureExtractionDir -i data/ -mw 1.0 -ms 1.0 -sw 0.050 -ss 0.050
This seems to indeed run the feature extraction - it takes time and return to prompt without error - but does not write any csv files.
Any hint about why this does not work would be greatly appreciated. Thank you.

Found the answer:
the files to be analyzed were actually ADPCM-compressed files, which apparently does not work. Therefore, this led to the following error (in the background, it was NOT returned, and only discovered while trying to run the command in a system call in R):
ValueError: Unknown wave file format: DVI_ADPCM. Supported formats: PCM, IEEE_FLOAT
Once files were uncompressed, the pyAudioAnalysis call worked as expected.

Related

Compressing a netCDF file with the pynco package

I'm interested in compressing a NetCDF file in python using the pynco package. From the command line, I would usually use:
nccopy -d 3 input_file.nc output_file.nc
In python, I have tried the following:
from nco import Nco
Nco.nccopy(input='input_file.nc', output='output_file.nc', options=['-d 1'])
This produces an attribute error 'Nco' has no attribute 'nccopy'. Is nccopy supported within pynco?
nccopy is a netCDF command, not an NCO command. However, ncks can do nearly everything nccopy does, and a whole lot else. To compress as in your example, try
Nco.ncks(input='input_file.nc', output='output_file.nc', options=['-7 -L 1'])
Just to list an alternative to pynco, you can also do this within python using the cdo package:
from cdo import *
cdo = Cdo()
cdo.copy(input='input.nc',output='output.nc',options='-f nc4 -z zip_7')
You can choose the compression level from light (zip_1) all the way up to most compressed (zip_9), I usually find that going above level 4 or 5 there is not much gain (i.e. additional size saving very minor) for a lot of pain (command takes a lot longer!). I think the -f nc4 to ensure netCDF4 output is perhaps not needed if the input is netCDF4 standard, but it doesn't hurt to put it anyway.
You can install cdo with
pip3 install cdo

How to run Tutorial: Simple LSTM on fairseq

While trying to learn fairseq, I was following the tutorials on the website and implementing:
https://fairseq.readthedocs.io/en/latest/tutorial_simple_lstm.html#training-the-model
However, after following all the steps, when I try to train the model using the following:
! fairseq-train data-bin/iwslt14.tokenized.de-en \ --arch tutorial_simple_lstm \ --encoder-dropout 0.2 --decoder-dropout 0.2 \ --optimizer adam --lr 0.005 --lr-shrink 0.5 \ --max-tokens 12000
I receive an error:
`fairseq-train: error: argument --arch/-a: invalid choice: 'tutorial_simple_lstm' (choose from 'fconv', 'fconv_iwslt_de_en', 'fconv_wmt_en_ro', 'fconv_wmt_en_de', 'fconv_wmt_en_fr', 'fconv_lm', 'fconv_lm_dauphin_wikitext103', 'fconv_lm_dauphin_gbw', 'transformer', 'transformer_iwslt_de_en', 'transformer_wmt_en_de', 'transformer_vaswani_wmt_en_de_big', 'transformer_vaswani_wmt_en_fr_big', 'transformer_wmt_en_de_big', 'transformer_wmt_en_de_big_t2t', 'bart_large', 'bart_base', 'mbart_large', 'mbart_base', 'mbart_base_wmt20', 'nonautoregressive_transformer', 'nonautoregressive_transformer_wmt_en_de', 'nacrf_transformer', 'iterative_nonautoregressive_transformer', 'iterative_nonautoregressive_transformer_wmt_en_de', 'cmlm_transformer', 'cmlm_transformer_wmt_en_de', 'levenshtein_transformer', 'levenshtein_transformer_wmt_en_de', 'levenshtein_transformer_vaswani_wmt_en_de_big',....
Some additional info: I am using google colab. And I am writing the entire code until train step into .py file and uploading it to fairseq/models/... path as per my interpretation of the instructions. I am following the exact tutorial in the link.
And, before running it on colab, I am installing fairseq using:
!git clone https://github.com/pytorch/fairseq %cd fairseq !pip install --editable ./
I think this error happens because the command line argument created as per the tutorial has not been set properly.
Can anyone please explain if on any step I would need to do something else.
I would be grateful for your inputs as for a beginner learner such help from the community goes a long way.
Seems you didn't register the SimpleLSTMModel architecture as follow. Once the model is registered you can use it with the existing Command-line Tools.
#register_model('simple_lstm')
class SimpleLSTMModel(FairseqEncoderDecoderModel):
...
.
.
...
Please note that copying .py files doesn't mean you have registered the model. To do so, you need to execute the .py file that includes abovementioned lines of code. Then, you'll be able to run the training process using existing command-line tools.
You should put your .py into:
fairseq/fairseq/models
not to fairseq/models

how to convert .lm file(language model) to .lm.bin(binary file)?

I am using pocketsphinx for offline speech recognition. I use lmtool to get language model and dictionary.But the language model has extension .lm but pocketsphinx requires .lm.bin file. So, how can I convert this?
You just need to:
1. Download http://sourceforge.net/projects/cmusphinx/files/sphinxbase/0.8/sphinxbase-0.8-win32.zip
Unpackage sphinxbase-0.8-win32.zip. The folder will be PATH\
In my case thats C:\Users\carope9\Desktop\
Move lm file to PATH\sphinxbase-0.8-win32\bin\Release
Open CMD and write cd PATH\sphinxbase-0.8-win32\bin\Release
Write sphinx_lm_convert -i YOUR_LM_FILE -o YOUR_LM.BIN_FILE
example: sphinx_lm_convert -i es_ES.lm -o es_ES.lm.bin
Your new lm.bin file will be into PATH\sphinxbase-0.8-win32\bin\Release
If you don't use Windows need to download source files from http://sourceforge.net/projects/cmusphinx/files/sphinxbase/0.8/sphinxbase-0.8.tar.gz but I don't know how to install it I'm reading https://sourceforge.net/p/cmusphinx/discussion/help/thread/c67930c0/?limit=25
P/D: According to some people this doesn't work, it worked for me and I don't know how to correct their error. Hope it helps you.

Gromacs: .ene extension not recognized

I'm new to Gromacs (and protein-analysis coding in general, but have some experience with python-based code). I'm trying to convert a .ene file received from pyDock to a more readable format (it currently opens
When I try to use different commands that the gromacs guide says accept .ene files (gmx eneconv and gmx dump), for example
gmx eneconv -f project.ene -o converted.edr
and
gmx dump -e project.ene -om read.mdp
I get the error
File 'project.ene' cannot be used by GROMACS because it does not have a recognizable extension.
The following extensions are possible for this option:
.edr
I have updated my OS and re-installed gromacs. My installation is working according to the 'Getting Started' page.
I am also open to suggestions for other programs to open and read the .ene file type.
Thanks!
"ene" is short for "energy" which contains binary data for energy, temperature, volume, etc, and is only used in older version of Gromacs. In new version of Gromacs this is replaced by "edr" file which contains portable binary data. See "gmx dump -h", you will find the following lines:
Options to specify output files:
-o [<.edr>] (fixed.edr)
Energy file
If you insist on using ene file, you should install an older version of Gromacs.

MPEG DASH:using Gpac to get MPD files

My goal is to convert some mpeg4 files in my hard disk into mpd files that will alllow me to use it in mpeg dash streaming .i read about gpac's MP4Box capability to create mpd files and i followed the instructions of the following link to successfully compile gpac for ubuntu like in the instructions in this two links
http://gpac.wp.mines-telecom.fr/2011/04/20/compiling-gpac-on-ubuntu/
http://gpac.wp.mines-telecom.fr/2012/02/01/dash-support/
But when i try to execute any command such as
MP4Box -dash 10000 -frag 1000 -rap myFile.mp4
I get the following error
Option -dash unknown. Please check usage
I wonder is there any commands or instructions that i must execute when building gpac to add the dash and if is there any other methods to get my own MPD File not those provided by itec.
Thanks in advance !!!
Try to follow the compile instruction carefully & make sure to fetch the latest version from SVN.
MP4Box should work with your commands.
looks like you are using a outdated version of MP4Box. try downloading and compiling the latest one from here (for me the same command works): http://gpac.wp.mines-telecom.fr/downloads/gpac-nightly-builds/

Resources