Add image to MP3

You can add album art images to your mp3 files. Use EasyTAG (GUI) or eyed3 (CLI) ID3 tag editors to accomplish that.

Example. Use eyed3 to remove any embedded images, then list options for embedded image file, then embed an image for an icon:

  • eyeD3 --remove-images test.mp3
  • eyeD3 --list-image-types
  • eyeD3 --add-image=test.jpg:ICON test.mp3

Update:

Add an image, various text info and a longer comment from a text file:

  • comment=`cat test.txt`;
  • eyeD3 --set-encoding="utf8" --year="2018" --artist="test" --album="test" --publisher="test" --title="test" --comment=:"test":"$comment" --add-image=test.jpg:ICON test.mp3

Brown noise generator

Simple brown noise generation script using sox on Linux.


Installing Boodler on Mint 17

Install prerequisites:

  • sudo apt-get install python-dev libpulse-dev

Make temporary directory, download Boolder, compile and install it:

  • mkdir -p boodler
  • cd boodler
  • wget http://boodler.org/dl/Boodler-2.0.4.tar.gz
  • tar zxvf Boodler-2.0.4.tar.gz
  • cd Boodler-2.0.4
  • python setup.py build
  • sudo python setup.py install

Test the install. If you hear the sound, everything is all right and you may proceed. (Remember to use -o pulse switch on Ubuntu based distributions)

  • boodler -o pulse --testsound

Save the list below into a file packages.txt : Read the rest of this entry »


Record from webcam

You can use guvcview to record from webcam.


Bash script to play .m4v video and .ul audio together

So you have a lot of .m4v video files and a lot of .ul audio files with the same names. That, for example, might be a collection of  CCTV records, where the name of the file is the date and time of when the record was made. Now you would like to play them.

Create a bash script file in ~/bin, /usr/bin or similar directory. Paste the code inside. Add execution rights. Then run the script with .m4v video  file name as the only argument. The script will figure out name of the audio file on its own and afterwards it will play it all with a bunch of various parameters.

Let’s call it playit:

#!/bin/bash
 videoFile=$1
 audioFile="${videoFile%.*}.ul"
 mplayer -fps 25 -vf denoise3d=0:0:100:0 -cache 16000 -framedrop $videoFile -audiofile $audioFile -audio-demuxer rawaudio -rawaudio format=0x0007:channels=1:rate=8000

Later you can play all video files in the current directory with their accompanying audio files by means of another script, let’s call this one playall:

#!/bin/bash
 for i in *.m4v; do
    playit $i
 done

And another improvement. A script to look into all subdirectories of the current directory and play media found there. Useful if you have your packs of audio &  video files stored in timestamped directories. Let’s call this one playdirs:

#!/bin/bash
rootDir=$(pwd)
for subDir in */; do
cd $subDir
playall
cd $rootDir
done

And then yet another one. Play only files only in a single directory. That will be playdir:

#!/bin/bash
 subDir=$1
 rootDir=$(pwd)
 cd $subDir
 playall
 cd $rootDir

Losslessly convert MP4 to MKV

  • avconv -i test.mp4 -c:v copy -c:a copy test.mkv

Merge WAV files

Merge all WAV files in directory into a single big WAV file using sox:

  • myvar=`ls *.wav | awk ‘{ ORS=” “; print; }’`; echo $myvar; sox $myvar all.wav

P.S.

If the copy+pasted example script does not work, try to retype the tick marks, as they can be “spoiled” by HTML formatting of the web page.


Get rid of electret microphone buzz

So you get an audio module consisting of a preamp running on DC and an electret microphone in a metal capsule, connected by two wire line to the preamp. You plug it into either CCTV camera audio input or microphone socket of your PC and there is a buzz. A loud humming noise. Sometimes it is the hum of 50 Hz (60 Hz I suppose if you are in the States) electric power line,  sometimes it is a loud tearing noise or similar…

01

When you touch the body of the microphone, the buzz is gone. Nearly complete silence! Slight hiss remains, but we can live with that, that’s common…

You look for a solution. You read on-line a lot about audio equipment noises, grounding issues, ground loops etc., but the information is insufficient, superficial and more often than not is provided by incompetent individuals. It does not help the least.

The solution is simple.

Shield the damn thing!
Read the rest of this entry »


All ls output in one line

Ways to get output in one line so that you can feed it to another program:

  • File names are separated by a comma and a space:
ls -m
  • Files names in the line are separated by a space:
ls | awk '{ ORS=" "; print; }'

Example:

Merge all WAV files in directory into a single big WAV file using sox:

myvar=`ls *.wav | awk '{ ORS=" "; print; }'`; echo $myvar; sox $myvar all.wav

Extract audio from video file

Extract audio from MP4 video file and save it as MP3 audio file:

  • avconv -i filename.mp4 -vn -ar 44100 -ac 2 -ab 128k -f mp3 filename.mp3

Quick and dirty way to extract audio from all video files in the directory:

  • for i in *.mp4; do myname=`basename “$i”`; avconv -i “$i” -vn -ar 44100 -ac 2 -ab 128k -f mp3 “$myname.mp3”; done

P.S.
If you copy and paste this code and it does not work, please check the back tick and quotation marks. they normally get “spoiled” when copying HTML.