mardi 20 novembre 2018

Normalize a bunch of audio files to the same loudness

I had a bunch of audio files in a directory, each recorded live with different devices, and it proved very ear-painful to ear same in a row because of the difference of loudness.

For this purpose you can find a number of tool working with ID3 tags, but after testing with vlc, mplayer, and the pogo mp3 player it did not produce a measurable change. So I converted everything to wav, normalized the wav files, then converted back to mp3.

delete funny chars and spaces in file names

detox music_dir

converting files to wav is just a matter of

for f in $(ls); do ffmpeg -i $f $(basename $f .mp3).wav; done

normalizing files with the normalize-audio program, from the debian package of the same name.

normalize-audio *

converting back to mp3

for f in $(ls); do ffmpeg -b:a 192k -acodec libmp3lame -i $f $(basename $f .wav).mp3; done

dimanche 2 septembre 2018

Test if your microphone input is working from the command line on Linux

arecord -vv /dev/null

That's it. Now clap your hand and observe the ascii vumeter.

mercredi 25 juillet 2018

Inspecting an Atari ST hard disk image with Unix / Linux tools

GNU libparted has Atari partition table support since two years ago. For this you will need the disktype and parted programs. Any good Unix should have those (I use Debian GNU/Linux)

Let us try this with a disk image I used for my Ultrasatan device, for example st_mint
wget http://www.subsole.org/static/retrocomputing/st_mint-0.7.img.zip
Unzip the disk image
unzip st_mint-0.7.img.zip
 Inspect the diskimage with the disktype program, an excellent disk analysis tool.
disktype st_mint-0.7.img

--- st_mint-0.7.img
Regular file, size 600 MiB (629145600 bytes)
ATARI ST partition map
Partition 1: 128.0 MiB (134201344 bytes, 262112 sectors from 4, bootable)
  Type "BGM" (Big GEMDOS)
  FAT16 file system (hints score 3 of 5, ATARI ST bootable)
    Unusual sector size 4096 bytes
    Volume size 127.9 MiB (134119424 bytes, 16372 clusters of 8 KiB)
Partition 2: 384.0 MiB (402666496 bytes, 786458 sectors from 262116)
  Type "MIX" (Unknown)


Notice the two partitions, first one is of type BGM, the second one is a Minix partition.

Print the partition table parted (this will output some warnings if running as non-root)
parted st_mint-0.7.img print
Partition Table: atari
Disk Flags: 

Number  Start  End    Size   Type     File system  Flags
 1      2048B  134MB  134MB  primary               boot
 2      134MB  537MB  403MB  primary

 Print the partition table with the begin and end of each partition being printed in bytes we will need this to create the loopback devices
parted  st_mint-0.7.img -- unit b print
Partition Table: atari
Disk Flags: 

Number  Start       End         Size        Type     File system  Flags
 1      2048B       134203391B  134201344B  primary               boot
 2      134203392B  536869887B  402666496B  primary

 Now using the beginning and end of each partition in bytes from the line above, create the /dev/loop devices corresponding to each partition:
sudo losetup --find --offset 2048 --sizelimit 134201344 --verbose st_mint-0.7.img

This should give a loopback device
losetup --all
/dev/loop3: []: (/home/manu/Téléchargements/st_mint-0.7.img), offset 2048, sizelimit 134201344
Now let us do a file check on the partition
sudo fsck.vfat /dev/loop3 
fsck.fat 4.1 (2017-01-24)
/dev/loop3: 217 files, 966/16372 clusters
and mount it
sudo mount /dev/loop3 /mnt

looks an Atari ST system inside
ls /mnt
APPS  CBHD502   CLIPBRD  FSELECT.INF  MICO  MULTITOS     TOOLS
AUTO  CBHD.SYS  CRIPPLE  HUSHI.SYS    MINT  NEWDESK.INF 
 
file /mnt/APPS/QED/QED.APP 
/mnt/APPS/QED/QED.APP: Atari ST M68K contiguous executable (txt=189972, dat=16234, bss=103214, sym=0)

when your work is finished, unmount the partition and detach the loop device from the disk image
sudo umount /mnt
sudo losetup --detach /dev/loop3 

vendredi 20 juillet 2018

Generating a visual history of a git repo

If you haven't met it yet the gource programm really rocks: it generates a OpenGL rendered graph of all the commits of a git project.

You can see the video on real time just by calling the command gource in your git repo, or generate a video of it by piping to ffmpeg

This is the command line I used to generate my own video:

gource --hide filenames --hide files --title "the history of pmc" -s 0.1 --highlight-users -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4