Open Patrykot opened 5 years ago
Thanks! I'll take a look.
But since samples per pixel is integer, higher values of desired number of pixels can get the SAME number of samples per pixel.
This is true, and means that it's not currently possible to achieve the exact length of waveform you specify, due to the rounding error. This issue affects the PNG output, where the image size is as specified on the command line, the actual waveform width may not exactly fill the image.
At this moment I'm not shure how to write tests for it. Feature will give you the the possibility to set maximum number of pixels on the output files. In order to achive it we need to take number of all frames (frame is block of samples, one for each channel) and devide it by desired number of pixels. We will receive then samples per pixel. But since samples per pixel is integer, higher values of desired number of pixels can get the SAME number of samples per pixel. Consider this example, based on test_file_mono.wav: It has 113519 of frames. Let's say i want to 376 samples.
Now, let's say i want to 377 samples.
Thus we are able to set precisly pixels count till the diferrence between these to samples_per_pixel1 - samples_per_pixel2 is greater than 1. The higher the pixels-count the more often you will encounter lower values than given the maximum.
This is kind of a remedy for issue: https://github.com/bbc/audiowaveform/issues/41