NAME
Audio::Gramofile - Perl interface to libgramofile, a library derived from Gramofile
SYNOPSIS
use Audio::Gramofile;
my $gramofile = Audio::Gramofile->new;
$gramofile->set_input_file($wav_file);
$gramofile->set_output_file($out_file);
# track splitting methods
$gramofile->init_tracksplit("make_use_rms" => 1);
$gramofile->split_to_tracks;
# signal processing methods
$gramofile->init_filter_tracks(@filter_list);
$gramofile->init_simple_median_filter("num_samples" => 7);
$gramofile->init_double_median_filter("first_num_samples" => 5);
$gramofile->init_simple_mean_filter("num_samples" => 9);
$gramofile->init_rms_filter("num_samples" => 3);
$gramofile->init_cmf_filter("rms_length" => 9);
$gramofile->init_cmf2_filter("rec_med_len" => 11);
$gramofile->init_cmf3_filter("fft_length" => 8);
$gramofile->init_simple_normalize_filter("normalize_factor" => 25);
$gramofile->use_begin_end_time($begin_time, $end_time);
$gramofile->process_whole_file;
$gramofile->adjust_frames($framesize);
$gramofile->filter_tracks;
ABSTRACT
This module provides a Perl interface to Gramofile, a program for recording gramophone records. It is able to record hours of CD quality music, split long sound files in separate tracks, and remove ticks and pops from recordings.
Gramofile was written by Anne Bezemer and Ton Le.
Gramofile is available from http://www.opensourcepartners.nl/~costar/gramofile/
libgramofile - a library derived from Gramofile is available from http://sourceforge.net/projects/libgramofile
DESCRIPTION
new
returns an object initialised with the parameters specified in the original C code.
e.g. my $gramofile = Audio::Gramofile->new;
set_input_file
sets the input .wav file for track splitting and signal processing methods.
e.g. $gramofile->set_input_file($wav_file);
track splitting methods
init_tracksplit
The following elements may be initialised by this method. All are used to modify the track splitting algorithm.
-
make_use_rms # Save/load signal power (RMS) data to/from .rms file
-
make_graphs # Generate graph files
-
blocklen # Length of blocks of signal power data (samples)
-
global_silence_factor # Global silence factor (0.1 %)
-
local_silence_threshold # Local silence factor (%)
-
min_silence_blocks # Minimal length of inter-track silence (blocks)
-
min_track_blocks # Minimal length of tracks (blocks)
-
extra_blocks_start # Number of extra blocks at track start
-
extra_blocks_end # Number of extra blocks at track end
e.g. $gramofile->init_tracksplit("make_use_rms" => 1, "min_silence_blocks" => 10);
split_to_tracks
The input file is split into a number of tracks. A file with name new.wav will be split into tracks called new01.wav, new02.wav etc.
e.g. $gramofile->split_to_tracks;
signal processing methods
init_filter_tracks
Any, or all, of the following filters may be specified:
simple_median_filter
simple_mean_filter
cond_median_filter
double_median_filter
cond_median2_filter
rms_filter
copyonly_filter
monoize_filter
cond_median3_filter
simple_normalize_filter
experiment_filter
The filters are applied in the order given in the list.
e.g. $gramofile->init_filter_tracks("rms_filter", "simple_mean_filter");
by default the cond_median2_filter is used.
set_output_file
sets the output .wav file name for the signal processing method, filter_tracks.
e.g. $gramofile->set_output_file($out_file);
init_simple_median_filter
This method allows the parameters to be set for the simple median filter.
The following elements may be set for this filter:
num_samples # the number of samples of which to take the median.
e.g. $gramofile->init_simple_median_filter("num_samples" => 7);
init_double_median_filter
This method allows the parameters to be set for the simple median filter.
The following elements may be set for this filter:
first_num_samples # the number of samples of which to take the median
second_num_samples # the number of samples of the second (correction) median.
e.g. $gramofile->init_double_median_filter("first_num_samples" => 5);
init_simple_mean_filter
This method allows the parameters to be set for the simple mean filter.
The following elements may be set for this filter:
num_samples # the number of samples of which to take the mean.
e.g. $gramofile->init_simple_mean_filter("num_samples" => 9);
rms_filter
This method allows the parameters to be set for the rms filter.
The following elements may be set for this filter:
num_samples # the number of samples of which to take the rms.
e.g. $gramofile->init_rms_filter("num_samples" => 3);
init_cmf_filter
This method allows the parameters to be set for the conditional mean filter.
The following elements may be set for this filter:
num_samples # the number of samples of the median which will be used to interpolate ticks.
rms_length # the number of samples of which to take the rms.
rms_med_len # the length of the recursive median operation.
rms_med_dec # the decimation factor of the recursive median operation.
tick_threshold # the threshold for tick detection.
e.g. $gramofile->init_cmf_filter("rms_length" => 9, "tick_threshold" => 3000);
init_cmf2_filter
This method allows the parameters to be set for the second conditional mean filter.
The following elements may be set for this filter:
rms_length # the number of samples of which to take the rms.
rms_med_len # the length of the recursive median operation.
rms_med_dec # the decimation factor of the recursive median operation.
fine_threshold # the fine threshold for tick start/end.
tick_threshold # the threshold for detection of tick presence.
e.g. $gramofile->init_cmf2_filter("rec_med_len" => 11, "fine_threshold" => 2500);
init_cmf3_filter
This method allows the parameters to be set for the second conditional mean (frequency domain using fft) filter.
The following elements may be set for this filter:
rms_length # the number of samples of which to take the rms.
rms_med_len # the length of the recursive median operation.
rms_med_dec # the decimation factor of the recursive median operation.
fine_threshold # the fine threshold for tick start/end.
tick_threshold # the threshold for detection of tick presence.
fft_length # Length for fft to interpolate (2^n).
e.g. $gramofile->init_cmf3_filter("fft_length" => 8, "fine_threshold" => 2500);
init_simple_normalize_filter
This method allows the parameters to be set for the simple normalize filter.
The following elements may be set for this filter:
normalize_factor # the normalization factor.
e.g. $gramofile->init_simple_normalize_filter("normalize_factor" => 50);
use_begin_end_time
A begin time and end time can be specified. These times will be used instead of the track times derived from the split_to_tracks method.
e.g. $gramofile->use_begin_end_time($begin_time, $end_time);
process_whole_file
The whole file can be passed through the signal processing routines if this method is used.
e.g. $gramofile->process_whole_file;
adjust_frames
The default frame size is 588 (1/75 sec. @ 44.1 khz). This method allows this value to be user-defined.
e.g. $gramofile->adjust_frames($framesize);
filter_tracks
This method filters the tracks with the previously specified (or default) parameters.
e.g. $gramofile->filter_tracks;
EXPORT
None by default.
SEE ALSO
Gramofile : available from http://www.opensourcepartners.nl/~costar/gramofile/
libgramofile : A dynamically linked library derived from Gramofile, which this module needs, available from http://sourceforge.net/projects/libgramofile
fftw - the fastest Fourier Transform in the west : available from http://www.fftw.org
Signproc.txt, Tracksplit.txt, Tracksplit2.txt supplied with the Gramofile source code.
AUTHOR
Bob Wilkinson, <bob@fourtheye.org>
COPYRIGHT AND LICENSE
Copyright 2003-2005 by Bob Wilkinson
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.