Givent a audio.wav recording with silence at both start and end for at least 1second...
How to denoise with SOX ?
What is SOX
SoX - Sound eXchange, the Swiss Army knife of audio manipulation
Create noise file from input audio's initial 0.9s silence + room's noise
# sox in.ext out.ext trim {start: s.ms} {duration: s.ms}
sox audio.wav noise-audio.wav trim 0 0.900
Generate a noise profile in sox:
sox noise-audio.wav -n noiseprof noise.prof
Clean the noise from the audio
sox audio.wav audio-clean.wav noisered noise.prof 0.21
According to source :
Change 0.21 to adjust the level of sensitivity in the sampling rates (I found 0.2-0.3 often provides best result).
Sources
How To Do Noise Reduction Using ffmpeg And sox
Related
I have some audio files that look like this:
I wanted to know if it is possible to delay the trimming process by a specified amount, for example 0.1s, prior to trimming the audio at the end of each silence sections?
The sox command that I use to trim at the end of each silence section is:
for %%i in ("*.wav") do "%_sox%" -V3 "%%~fi" "SilenceTrimBegin-1secclips\%%~ni.wav" silence 1 0.0 -40d trim 0 1 : newfile : restart
Can you assist me in basically leaving some silence before the active audio event? Thanks!
add "pad 0.5 0.5" at the end of the sox recording command to prevent too strict clipping.
In Operating Systems Design and Implementation by Andrew S. Tanenbaum and Albert S. Woodhull, there's the following fragment:
In MINIX 3 every file has an 11-bit mode used for protection. Nine of these bits are the read-
write-execute bits for the owner, group, and others.
And then, a few lines after, they write:
The other two protection bits, 02000 [octal 200] and 04000 [octal 400], are the SETGID (set-group-id) and SETUID (set-
user-id) bits, respectively.
But Python shows that octal 400 is a 12-bit long mask:
>>> len(str(bin(0o4000))) - len('0b')
12
How can a 12-bit long mask be applied on a 11-bit field?
01000 is the "sticky" bit in Unix, and Minix didn't support it at the time the book was released. It didn't add support until 2010 (the book was released in 2005).
I am analysing very large images in R, in the order of tens of thousands of pixels square. Unfortunately, even with 64 GB RAM, these images sometimes fail to fit into memory, and when they do I can only open one at a time, precluding parallelisation.
My current strategy is to load them using the JPEG or TIFF packages. e.g.:
image <- readJPEG('image.jpg')
However, as I am only performing simple mathematical manipulations (summing, thresholding etc.) that could be performed piece-by-piece, is it possible to only open part of an image at a time by specifying the dimensions to load? If so, I could write a loop to open 1024 x 1024 sized tiles. The JPEG and TIFF packages do not offer an option to do this.
If you are working with very large images, libvips is probably your best bet. You can shell out to it from R using system().
Your question is not very specific, but let's make a 10,000x10,000 pixel TIFF with ImageMagick and it is a black-white gradient:
convert -size 10000x10000 gradient: -depth 8 a.tif
Now threshold that at 50% with vips and check memory required:
vips im_thresh a.tif b.tif 128 --vips-leak
memory: high-water mark 292.21 MB
Pretty frugal, no? By comparison, the equivalent ImageMagick command requires 1.6GB of RAM:
/usr/bin/time -l convert a.tif -threshold 50% b.tif
Sample Output
...
1603895296 maximum resident set size
...
How about adding 64 to every pixel using im_gadd which does:
usage: vips im_gadd a in1 b in2 c out
where:
a is of type "double"
in1 is of type "image"
b is of type "double"
in2 is of type "image"
c is of type "double"
out is of type "image"
calculate a*in1 + b*in2 + c = outfile
So we use:
vips im_gadd 1 a.tif 0 b.tif 64 c.tif --vips-leak
memory: high-water mark 584.41 MB
Need to do some statistics?
vips im_stats c.tif
band minimum maximum sum sum^2 mean deviation
all 64 319 1.915e+10 4.20922e+12 191.5 73.6206
1 64 319 1.915e+10 4.20922e+12 191.5 73.6206
As it turns out, there is an R package - RBioFormats - that allows you to specify part of an image being opened (though it is not available on CRAN). It can be installed from Git as follows:
source("https://bioconductor.org/biocLite.R")
biocLite("aoles/RBioFormats") # You might need to first run `install.packages("devtools")`
library(RBioFormats)
The dimensions of the image can be read from the metadata without having to open the image:
metadata <- read.metadata('image.tiff')
xdim <- metadata#.Data[[1]]$sizeX
ydim <- metadata#.Data[[1]]$sizeY
Suppose that we want to load the top-left 512 x 512 pixels, we use the subset function:
image <- read.image('image.tiff', subset = list(X = 1:512, y = 1:512))
From this it is trivial to write a loop to iteratively process a whole large image. RBioFormats is an R interface into the Java BioFormats library and will open Tiffs, PNGs, JPEGs as well as many proprietary imaging formats.
I've a tape contains a corrupt tar file.
I'm using Unix SunOS 5.5.1.
So when I run this command :
dd if=/dev/rmt/0 of=/tmp/outputfile.tar
I get this error message :
warning /pci#1f, 0/pci#1/pci#1/sunw, isptwo#4/st#4,0 (st4):
Error for command : read Error Level: Fatal
Requested Block : 11900 Error Block : 11900
Vendor : TANDBERG Serial Number: =:CREATED081
Sense Key: Media Error
ASC: 0x11 (unrecorded read error), ASCQ: 0x1, FRU: 0x0
Please Help me I really need solution for this problem
Finally I solved my problem ^^' it was the bs format type :D
Data was written in 512 so I did this :
dd if=/dev/rmt/0 of=/tmp/outputfile.tar bs=512 and all is fine :)))
The bad news is that the tape drive is reporting a media error.
Now this still can mean a few things:
Bad tape drive
This is possible, but rather uncommon. To test it: check if it can read other tapes (it wrote itself), or read tapes other drives wrote.
Dirty heads
Tape drives heads do need periodic cleaning. Esp if they are kept in less that spotless conditions this is very important. Cleaning tapes are commercially available, do match them with the right drive and do not overuse them either.
Mismatch between tape drive and tape medium
Different tape formats (e.g. LTO) have generations (e.g. LTO-3), and there is a need for compatibility between the tape medium and the tape drive.
Bad tape
Tapes do wear out, and need replacement to prevent that. Moreover a written tape has a limited shelf life just as well.
In this last case, you might be able to find a commercial recovery service to try to do something, but I'd not bet the farm on the results ... And data recovery services are expensive ...
I downloaded the 3GPP AMR-WB codec (26.173) from http://www.3gpp.org/DynaReport/26173.htm and successfully compiled it. However, the file format generated from the decoder is some so-called binary synthesized speech file (*.out). I am wondering what is the exact format and how I can play the the file? Thanks
For AMR-WB, output will be raw PCM with following properties
16000 (16Khz) sampling frequency
1 (mono) channel
16 bits per channel
You can play it using Audacity or any other player which supports PCM input.