Open xeruf opened 2 years ago
I am creating a json data file and only need a specific piece of my whole audio file as waveform.
I use the --pixels-per-second 15
to reduce the filesize. For the whole file, this works perfectly.
Now I tried to only get the part between 00:10 and 00:40 by using --start 10 --end 40
. But this fails due with the message Specify either --end or --pixels-per-second but not both
. I do not understand why. Is there a way to achieve this?
Now I tried to only get the part between 00:10 and 00:40 by using
--start 10 --end 40
. But this fails due with the messageSpecify either --end or --pixels-per-second but not both
. I do not understand why. Is there a way to achieve this?
I think this should be allowed, i.e., set --start
, --end
, and --pixels-per-second
, and use these to determine the width. I'll work on a fix.
As a workaround, you can set the --width
option instead of --pixels-per-second
. So in your example, you want a 30 second waveform at 15 pixels per second, so the width is 450 pixels: --start 10 --end 40 --width 450
.
It would also be nice to automatically calculate the end from the width.
From the behavior I observed when setting width
it still processes the audio file till the end and then cuts it off, incurring significant extra processing.
Hey Chris, I tried your suggested workaround. It does work, if I output a PNG file. The image looks correct and does fit the audio. But as far as I can see, it does not work, if I output a JSON data file. The JSON data always contains the peaks for the complete length of the original audio file. @xeruf what output format do you use?
Ah, sorry, I should have checked that would actually work before suggesting it. The options are handled differently for creating images vs creating data files, hence the discrepancy - for historical reasons, as we only needed full duration data files, whereas images could be any period within the audio.
output as image for display with timg
Ok, I understand. Unfortunately, I am not a CPP Developer, so I am unable to contribute here. But is there a chance, you and your contributors could implement that feature, that enables me to create Waveform JSON Files, the same way as it is possible for PNG Images respecting --start and --end arguments? I can create a dedicated Issue here, if that helps. Otherwise I will find a way to workaround this limitation by using an already shortened WAV File.
Well, it's just me in my spare time really - but yes. There's no need to create an issue.
I'm going to look at this together with https://github.com/bbc/audiowaveform/issues/157, as they're related.
When using
pixels-per-second
, one cannot add--end
- understandable, since it is redundant to--width
then. But unfortunately,--end
is the only flag that limits the time of audio that is processed, so that even on a shortwidth
, long audio files take a long time to process withpixels-per-second
. Through a simple division this should be limited internally :)