@@ -35,7 +35,7 @@ pub struct Cli {
3535 #[ arg( short = 'f' , long, default_value_t = 512 ) ]
3636 fft_size : u32 ,
3737
38- /// For image->audio conversion. When true, try to retain the spectral envelope and stretch it to fit the fft-size .
38+ /// For image->audio conversion. When true, try to retain the spectral envelope. This might introduce gaps into the resulting audio file .
3939 /// Else use the spectrum as is, and discard harmonics, if there is too many.
4040 #[ arg( short = 'S' , long, default_value_t = false ) ]
4141 stretch_spectrum : bool ,
@@ -141,7 +141,7 @@ pub fn sound_to_img_sequence(file_path: &str, cl_arguments: &Cli) -> Result<(),
141141 let start_sample = ( sample_idx * 2 ) as usize ;
142142 let mut table_size = cl_arguments. fft_size as usize ;
143143 if table_size == 0 { table_size = nr_samples as usize / 2 } ;
144- let end_sample = start_sample + ( table_size * 2 ) ;
144+ let end_sample = start_sample + ( table_size * 2 ) - 1 ;
145145
146146 if end_sample >= nr_samples as usize {
147147 return Err ( format ! ( "Starting at sample {} with an fft-size of {} is out of bounds for a file with {} samples!" ,
@@ -292,7 +292,7 @@ fn map_samples_into_2d(samples: &[f64], width: usize, height: usize, needs_resam
292292
293293 // resample when necessary
294294 if needs_resample {
295- buffer = resample ( & buffer, width * height) ;
295+ buffer = resample ( & buffer, width * height) ;
296296 }
297297
298298 if cl_arguments. a2i_method < 2 {
0 commit comments