sndfile-waveform: 6-channel input => Channel 6 missing from generated PNG
Closed this issue · 2 comments
wolfgangw commented
Hi Erik,
sndfile-waveform apparently drops channel 6 from a 6-channel input audiofile, at least from the ones I've been throwing at it (24 bps, 48 kHz).
The command I've used:
sndfile-waveform -c -1 -l -g 1280x980 <input> <output>
See https://github.com/wolfgangw/blobs/tree/master/sndfile-waveform-material to reproduce. The 6-channel audiofile contains -- in temporal sequence -- 1 tone per channel in center (ch 3), left (ch 1), right (ch 2), left surround (ch 5), right surround (ch 6) and LFE (ch 4).
x42 commented
the channel
parameter starts counting at 1 for the 1st channel (0
means downmix to mono).
Fix:
--- a/src/waveform.c
+++ b/src/waveform.c
@@ -151,7 +151,7 @@ calc_peak (SNDFILE *infile, SF_INFO *info, double width, int channel, AGC *agc)
float* data ;
long f_offset = 0 ;
- if (channel < 0 || channel >= info->channels)
+ if (channel < 0 || channel > info->channels)
{ printf ("invalid channel\n") ;
return ;
} ;
@@ -232,7 +232,7 @@ render_waveform (cairo_surface_t * surface, RENDER *render, SNDFILE *infile, SF_
float* data ;
long f_offset = 0 ;
- if (channel < 0 || channel >= info->channels)
+ if (channel < 0 || channel > info->channels)
{ printf ("invalid channel\n") ;
return ;
} ;
erikd commented
Fixed in the above commit.