diff --git a/man/sndfile-generate-chirp.1 b/man/sndfile-generate-chirp.1 index 7eb8023..7598f54 100644 --- a/man/sndfile-generate-chirp.1 +++ b/man/sndfile-generate-chirp.1 @@ -1,78 +1,58 @@ -.TH SNDFILE\-GENERATE\-CHIRP 1 "May 2021" "" "User Commands" -.SH NAME -.B sndfile\-generate\-chirp -\(em create a sound file containing a swept sine wave -.SH SYNOPSIS -.B sndfile\-generate-chirp -.RB [ OPTIONS ] -.RI < sample\ rate > -.RI < length\ in\ seconds > -.RI < sound\ file > -.SH DESCRIPTION -.B sndfile\-generate\-chirp -generates a sound file containing a sine wave that -sweeps from a low starting frequency to a higher ending frequency (i.e., a -chirp). -The file is written using -.UR http://www.mega\-nerd.com/libsndfile/ -libsndfile -.UE . -.P -The output file will contain floating point samples in the range -.BR [\-1.0,\ 1.0] . -The output file type is determined by the file name extension which should be -one of -.BR wav , -.BR aifc , -.BR aif , -.BR aiff , -.BR au , -.BR caf +.Dd May 22, 2024 +.Dt SNDFILE-GENERATE-CHIRP 1 +.Os +.Sh NAME +.Nm sndfile-generate-chirp +.Nd create a sound file containing a swept sine wave +.Sh SYNOPSIS +.Nm +.Op Fl h +.Op Fl from Ar start +.Op Fl to Ar end +.Op Fl amp Ar value +.Op Fl log +.Op Fl quad +.Op Fl linear +.Ar rate +.Ar length +.Ar file +.Sh DESCRIPTION +.Nm +generates a sound file containing a sine wave +that sweeps from a low starting frequency to a higher ending frequency. +The file is written using libsndfile. +.Pp +The output file will contain floating point samples between -1 and 1. +The output file type is determined by the file name extension +which should be one of +.Sq wav , +.Sq aifc , +.Sq aif , +.Sq aiff , +.Sq au , +.Sq caf or -.BR w64 . -.SH OPTIONS -.TP -.B \-from\fR\ \fIstart +.Sq w64 . +.Pp +The options are as follows. +.Pp +.Bl -tag -compact -width fromxstartx +.It Fl h +Print a help message and exit. +.It Fl from Ar start Sweep start frequency in Hz (default 200Hz). -.TP -.B \-to\fR\ \fIend -Sweep end frequency in Hz (default fs/2). -.TP -.B \-amp\fR\ \fIvalue +.It Fl to Ar end +Sweep end frequency in Hz (default rate/2). +.It Fl amp Ar value Amplitude of generated sine (default 1.0). -.TP -.I sweep\ type -One of (default -.BR \-log ): -.RS +14n -.TP -.B \-log -logarithmic sweep -.TP -.B \-quad -quadratic sweep -.TP -.B \-linear -linear sweep -.RE -.TP -.BR \-h ,\ \-\-help -Print a help message and exit. -.P -The -.I length\ in\ seconds -parameter can be a decimal like -.BR 0.5 . -.SH AUTHORS -This manual page was written by -.MT erikd@mega-nerd.com -Erik de Castro Lopo -.ME -in 2009. -It has since been modified and updated by other authors. -.SH "SEE ALSO" -.BR sndfile\-jackplay (1), -.BR sndfile\-mix\-to\-mono (1), -.BR sndfile\-resample (1), -.BR sndfile\-spectrogram (1), -.BR sndfile\-waveform (1) +.It Fl log +Use a logarithmic sweep (the default). +.It Fl quad +Use a quadratic sweep. +.It Fl linear +Use a linear sweep. +.El +.Sh SEE ALSO +.Lk https://github.com/libsndfile/ +.Sh AUTHORS +.An Erik de Castro Lopo Aq Mt erikd@mega-nerd.com diff --git a/man/sndfile-jackplay.1 b/man/sndfile-jackplay.1 index c3af12b..042dfdd 100644 --- a/man/sndfile-jackplay.1 +++ b/man/sndfile-jackplay.1 @@ -1,50 +1,38 @@ -.TH SNDFILE\-JACKPLAY 1 "May 2021" "" "User Commands" -.SH NAME -.B sndfile\-jackplay -\(em play a sound file via the JACK sound server -.SH SYNOPSIS -.B sndfile\-jackplay -.RB [ OPTIONS ] -.RI < input\ sound\ file > -.SH DESCRIPTION -.B sndfile\-jackplay +.Dd May 22, 2024 +.Dt SNDFILE-JACKPLAY 1 +.Os +.Sh NAME +.Nm sndfile-jackplay +.Nd play a sound file via the JACK sound server +.Sh SYNOPSIS +.Nm +.Op Fl a Op Ar port +.Op Fl h +.Op Fl l Op Ar count +.Op Fl w Op Ar port +.Ar file +.Sh DESCRIPTION +.Nm plays the specified sound file via the JACK sound server. -It uses -.UR http://www.mega\-nerd.com/libsndfile/ -libsndfile -.UE -to read the file. -.SH OPTIONS -.TP -.BR \-w ,\ \-\-wait [ =\fIport ] -Wait for input before starting playback; optionally auto-connect to -.I port -using Jack. -.TP -.BR \-a ,\ \-\-autoconnect [ =\fIport ] +It uses libsndfile to read the file. +.Pp +The options are as follows: +.Pp +.Bl -tag -compact -width wportxxxxx +.It Fl a Op Ar port Auto-connect to -.I port +.Ar port using Jack. -.TP -.BR \-l ,\ \-\-loop [ =\fIcount ] -Loop the file -.I count -times -.RB ( 0 -for infinite). -.TP -.BR \-h ,\ \-\-help +.It Fl h Print a help message and exit. -.SH AUTHORS -This manual page was written by -.MT erikd@mega-nerd.com -Erik de Castro Lopo -.ME -in 2009. -It has since been modified and updated by other authors. -.SH "SEE ALSO" -.BR sndfile\-generate\-chirp (1), -.BR sndfile\-mix\-to\-mono (1), -.BR sndfile\-resample (1), -.BR sndfile\-spectrogram (1), -.BR sndfile\-waveform (1) +.It Fl l Op Ar count +Loop the file +.Ar count +times, where 0 means an infinite loop. +.It Fl w Op Ar port +Wait for input before starting playback. +.El +.Sh SEE ALSO +.Lk http://libsndfile.github.io/libsndfile/ +.Sh AUTHORS +.An Erik de Castro Lopo Aq Mt erikd@mega-nerd.com diff --git a/man/sndfile-mix-to-mono.1 b/man/sndfile-mix-to-mono.1 index a92f424..769068e 100644 --- a/man/sndfile-mix-to-mono.1 +++ b/man/sndfile-mix-to-mono.1 @@ -1,37 +1,20 @@ -.TH SNDFILE\-MIX\-TO\-MONO 1 "May 2021" "" "User Commands" -.SH NAME -.B sndfile\-mix\-to\-mono -\(em mix a multi-channel sound file to mono -.SH SYNOPSIS -.B sndfile\-mix\-to\-mono -.RI < multi\-channel\ input\ file > -.RI < mono\ output\ file > -.SH DESCRIPTION -.B sndfile\-mix\-to\-mono +.Dd May 22, 2024 +.Dt SNDFILE-MIX-TO-MONO 1 +.Os +.Sh NAME +.Nm sndfile-mix-to-mono +.Nd mix a multi-channel sound file to mono +.Sh SYNOPSIS +.Nm +.Ar ifile +.Ar ofile +.Sh DESCRIPTION +.Nm reads a multi-channel input file and writes a single-channel output file -consisting of all of the input channels mixed together (like an audio mixing -desk would do). -The input and output files are read/written using -.UR http://www.mega\-nerd.com/libsndfile/ -libsndfile -.UE . -.LP -The format of the output file is determined by the filename extension -of the output file. -.SH OPTIONS -.TP -.BR \-h ,\ \-\-help -Print a help message and exit. -.SH AUTHORS -This manual page was originally written by -.MT erikd@mega-nerd.com -Erik de Castro Lopo -.ME -in 2009. -It has since been modified and updated by other authors. -.SH "SEE ALSO" -.BR sndfile\-generate\-chirp (1), -.BR sndfile\-jackplay (1), -.BR sndfile\-resample (1), -.BR sndfile\-spectrogram (1), -.BR sndfile\-waveform (1) +consisting of all of the input channels mixed into one. +The files are read and written using libsndfile. +The format of the output file is determined by its filename extension. +.Sh SEE ALSO +.Lk https://github.com/libsndfile/ +.Sh AUTHORS +.An Erik de Castro Lopo Aq Mt erikd@mega-nerd.com diff --git a/man/sndfile-spectrogram.1 b/man/sndfile-spectrogram.1 index e4e2250..14d21d3 100644 --- a/man/sndfile-spectrogram.1 +++ b/man/sndfile-spectrogram.1 @@ -1,84 +1,59 @@ -.TH SNDFILE\-SPECTROGRAM 1 "May 2021" "" "User Commands" -.SH NAME -.B sndfile\-spectrogram -\(em generate a spectrogram from an input sound file -.SH SYNOPSIS -.B sndfile\-spectrogram -.RB [ OPTIONS ] -.RI < sound\ file > -.RI < img\ width > -.RI < img\ height > -.RI < png\ name > -.SH DESCRIPTION -Create a spectrogram as a PNG file from a given sound file. +.Dd May 26, 2024 +.Dt SNDFILE-SPECTROGRAM 1 +.Os +.Sh NAME +.Nm sndfile-spectrogram +.Nd generate the spectrogram of a sound file +.Sh SYNOPSIS +.Nm +.Ar file +.Ar width +.Ar height +.Ar pngfile +.Sh DESCRIPTION +.Nm +creates a spectrogram PNG file from a given sound file. The spectrogram image will be of the given width and height. -.P -The input file is read using -.UR http://www.mega\-nerd.com/libsndfile/ -libsndfile -.UE , -the spectrogram is calculated with the help of -.UR http://fftw.org/ -FFTW -.UE , -and the spectrogram is -rendered and written to the output file using -.UR https://www.cairographics.org/ -libcairo -.UE . -.SH OPTIONS -.TP -.BI \-\-dyn\-range= number -Dynamic range (default is -.B 180 -for 180dB range) -.TP -.B \-\-no\-border -Drop the border, scales, heat map and title -.TP -.BI \-\-min\-freq= number -Set the minimum frequency in the output -.TP -.BI \-\-max\-freq= number -Set the maximum frequency in the output -.TP -.BI \-\-fft\-freq= number -Set the lowest resolvable frequency and the height of each band in the linear -spectrogram. -Lower values increase frequency resolution but smear the output horizontally -and higher values improve the temporal definition but decrease the distinction -between the lowest frequencies. -.TP -.B \-\-log\-freq -Use a logarithmic frequency scale -.TP -.B \-\-gray\-scale -Output gray pixels instead of a heat map -.TP -.B \-\-kaiser -Use a Kaiser window function (the default) -.TP -.B \-\-rectangular -Use a rectangular window function -.TP -.B \-\-nuttall -Use a Nuttall window function -.TP -.B \-\-hann -Use a Hann window function -.TP -.BR \-h ,\ \-\-help +The input file is read using libsndfile, +the spectrogram is calculated with the help of fftw +and the output file is rendered using libcairo. +.Pp +The options are as follows. +.Pp +.Bl -tag -compact -width dynrangexnumxxx +.It Fl h Print a help message and exit. -.SH AUTHORS -This manual page was originally written by -.MT erikd@mega-nerd.com -Erik de Castro Lopo -.ME -in 2009. -It has since been modified and updated by other authors. -.SH "SEE ALSO" -.BR sndfile\-generate\-chirp (1), -.BR sndfile\-jackplay (1), -.BR sndfile\-mix\-to\-mono (1), -.BR sndfile\-resample (1), -.BR sndfile\-waveform (1) +.It Fl -dyn-range Ns = Ns Ar num +The dynamic range, 180 dB by default. +.It Fl -no-border +Drop the border, scales, heat map and title. +.It Fl -min-freq Ns = Ns num +Minimum frequency in the output. +.It Fl -max-freq Ns = Ns num +Maximum frequency in the output. +.It Fl -fft-freq Ns = Ns num +The lowest resolvable frequency and +the height of each band in the linear spectrogram. +Lower values increase frequency resolution +but smear the output horizontally +and higher values improve the temporal definition +but decrease the distinction between the lowest frequencies. +.It Fl -log-freq +Use a logarithmic frequency scale. +.It Fl -gray-scale +Output gray pixels instead of a heat map. +.It Fl -kaiser +Use a Kaiser window function (the default). +.It Fl -rectangular +Use a rectangular window function. +.It Fl -nuttall +Use a Nuttall window function. +.It Fl -hann +Use a Hann window function. +.El +.Sh SEE ALSO +.Lk http://libsndfile.github.io/libsndfile/ +.Lk http://fftw.org/ +.Lk https://www.cairographics.org/ +.Sh AUTHORS +.An Erik de Castro Lopo Aq Mt erikd@mega-nerd.com diff --git a/man/sndfile-waveform.1 b/man/sndfile-waveform.1 index d3542ae..d04e5a2 100644 --- a/man/sndfile-waveform.1 +++ b/man/sndfile-waveform.1 @@ -1,115 +1,89 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.17. -.TH SNDFILE-WAVEFORM "1" "January 2021" "sndfile-waveform 1.5" "User Commands" -.SH NAME -sndfile-waveform \- manual page for sndfile-waveform 1.5 -.SH SYNOPSIS -.B sndfile-waveform -[\fI\,OPTION\/\fR] \fI\, \/\fR -.SH DESCRIPTION -sndfile\-waveform \- waveform image generator -.PP -Creates a PNG image depicting the wave\-form of an audio file. -Peak\-signal and RMS values can be displayed in the same plot, +.Dd May 26, 2024 +.Dt SNDFILE-WAVEFORM 1 +.Os +.Sh NAME +.Nm sndfile-waveform +.Nd generate a waveform image +.Sh SYNOPSIS +.Nm +FIXME +.Ar soundfile +.Ar pngfile +.Sh DESCRIPTION +.Nm +creates a PNG image depicting the waveform of an audio file. +Peak-signal and RMS values can be displayed in the same plot, where the horizontal axis always represents time. -.PP -The vertical axis can be plotted logarithmically, and the signal -can optionally be rectified. -.PP -The Time\-axis annotation unit is either seconds, audio\-frames or timecode -using broadcast\-wave time reference meta\-data. -.PP -The tool can plot individual channels, reduce the file to mono, -or plot all channels in vertically arrangement. -.PP +.Pp +The vertical axis can be plotted logarithmically, +and the signal can optionally be rectified. +The time axis annotation unit is either seconds, +audio frames or timecode using broadcast-wave time reference metadata. +.Nm +can plot individual channels, reduce the file to mono, +or plot all channels in a vertical arrangement. Colours (ARGB) and image\- or waveform geometry can be freely specified. -.SH OPTIONS -.TP -\fB\-A\fR, \fB\-\-textcolour\fR -specify text and border colour; default 0xffffffff -all colours as hexadecimal AA RR GG BB values -.TP -\fB\-b\fR, \fB\-\-border\fR -display a border with annotations -.TP -\fB\-B\fR, \fB\-\-background\fR -specify background colour; default 0x8099999f -.TP -\fB\-c\fR, \fB\-\-channel\fR -choose channel (s) to plot, 0: merge to mono; -< 0: render all channels vertically separated; -> 0: render only specified channel. (default: 0) -.TP -\fB\-C\fR, \fB\-\-centerline\fR -set colour of zero/center line (default 0x4cffffff) -.TP -\fB\-F\fR, \fB\-\-foreground\fR -specify foreground colour; default 0xff333333 -.TP -\fB\-g\fR x, \fB\-\-geometry\fR x -specify the size of the image to create -default: 800x192 -.TP -\fB\-G\fR, \fB\-\-borderbg\fR -specify border/annotation background colour; -default 0xb3ffffff -.TP -\fB\-h\fR, \fB\-\-help\fR -display this help and exit -.TP -\fB\-l\fR, \fB\-\-logscale\fR -use logarithmic scale -.TP -\fB\-\-no\-peak\fR -only draw RMS signal using foreground colour -.TP -\fB\-\-no\-rms\fR -only draw signal peaks (exclusive with \fB\-\-no\-peak\fR). -.TP -\fB\-r\fR, \fB\-\-rectified\fR -rectify waveform -.TP -\fB\-R\fR, \fB\-\-rmscolour\fR - specify RMS colour; default 0xffb3b3b3 -.TP -\fB\-s\fR, \fB\-\-gainscale\fR -zoom into y\-axis, map max signal to height. -.TP -\fB\-S\fR, \fB\-\-separator\fR -vertically separate channels by N pixels -(default: 12) \- only used with \fB\-c\fR \fB\-1\fR -.TP -\fB\-t\fR [/], \fB\-\-timecode\fR [/] -use timecode instead of seconds for x\-axis; -The numerator must be set, the denominator -defaults to 1 if omitted. -If the value is negative, audio\-frames are used. -.TP -\fB\-T\fR -override the BWF time\-reference (if any); -the offset is specified in audio\-frames -and only used with timecode (\fB\-t\fR) annotation. -.TP -\fB\-O\fR, \fB\-\-border\-width\fR -change outer border width -default: 1.0 -.TP -\fB\-V\fR, \fB\-\-version\fR -output version information and exit -.TP -\fB\-W\fR, \fB\-\-wavesize\fR -given geometry applies to the plain wave\-form. -image height depends on number of channels. -border\-sizes are added to width and height. -.SH "REPORTING BUGS" -Report bugs to . -.br -Website and manual: -.br -Example images: -.SH COPYRIGHT -Copyright \(co 2007\-2012 Erik de Castro Lopo -Written 2011,2012 by Robin Gareus -.PP -.br -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.Pp +The options are as follows. +.Pp +.Bl -tag -compact -width num/denXXX +.It Fl A Ar argb +Text and border colour, 0xffffffff by default. +.It Fl b +Display a border with annotations. +.It Fl B Ar argb +Background colour, 0x8099999f by default. +.It Fl c Ar chan +Channels to plot: a positive number picks a spcific channel, +a negative number renders all channels vertically separated, +and zero (the default) means mix to mono. +.It Fl C Ar argb +Colour the center line, 0x4cffffff by default. +.It Fl F Ar argb +Foreground colour, 0xff333333 by default. +.It Fl g Ar WxH +Image geometry, 800x192 by default. +.It Fl G Ar argb +Border and annotation colour, 0xb3ffffff by default. +.It Fl h +Display a help message and exit. +.It Fl l +Use a logarithmic scale. +.It Fl -no-peak +Only draw RMS signal using foreground colour. +.It Fl -no-rms +Only draw signal peaks. +.It Fl r +Rectify the waveform. +.It Fl R Ar argb +RMS colour, 0xffb3b3b3 by default. +.It Fl s +Zoom the amplitude axis, map max signal to height. +.It Fl S Ar num +Separate channels by +.Ar num +pixels, 12 by default. +.It Fl t Ar num Ns / Ns Ar den +Use timecode the time axis; +denominator defaults to one. +With a negative value, audioframes are used. +.It Fl T Ar offset +Override the BWF time reference with an +.Ar offset +in audioframes; +only used with the +.It Fl t +option. +.It Fl O Ar num +Outer border width, 1.0 by default. +.It Fl V +Display version information and exit. +.It Fl W +Geometry is given by the waveform +and the number of channels. +.El +.Sh SEE ALSO +.Lk https://github.com/libsndfile/sndfile-tools/ +.Sh AUTHORS +.An Erik de Castro Lopo Aq Mt erikd@mega-nerd.com +.An Robin Gareus Aq Mt robin@gareus.org diff --git a/src/waveform.c b/src/waveform.c index 138fa06..15fb3e7 100644 --- a/src/waveform.c +++ b/src/waveform.c @@ -2,6 +2,7 @@ ** Copyright (C) 2007-2015 Erik de Castro Lopo ** Copyright (C) 2012 Robin Gareus ** Copyright (C) 2013 driedfruit +** Copyright (C) 2024 Jan Stary ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -1011,9 +1012,6 @@ check_int_range (const char * name, int value, int lower, int upper) } /* check_int_range */ -/* NOTE: after editing this, run - * make && help2man -N -n 'waveform image generator' ./bin/sndfile-waveform -o man/sndfile-waveform.1 - */ static void usage_exit (char * argv0, int status) {