bbc / audiowaveform

C++ program to generate waveform data and render waveform images from audio files
https://waveform.prototyping.bbc.co.uk
GNU General Public License v3.0
1.94k stars 242 forks source link

Scaling of the output image #45

Closed bhaskargr closed 7 years ago

bhaskargr commented 8 years ago

Hello, I am trying to generate an image with 600 (width) and 325 (height), but sometimes if the audio file is very flat (say someone speaking), my output waveform height is too small within my entire image height, I was hoping that the waveform scale is determined automatically, but for some reason, it's not working in these cases... any suggestion would help

chrisn commented 8 years ago

The way it currently works is that the image height covers the full range of the audio signal so, as you've found, a low amplitude input will produce a small waveform.

I'll consider adding a new command-line option to allow the scaling to be adjusted, either automatically to fit the available height, or by a user-specified amount. Something like:

This option would only be used when rendering waveform images, and not when creating .dat or .json waveform files.

Thanks for the suggestion!

bhaskargr commented 8 years ago

This will be awesome, keep me posted.

Sent from Mailbird [http://www.getmailbird.com/?utm_source=Mailbird&utm_medium=email&utm_campaign=sent-from-mailbird] On 10/17/2016 3:02:37 AM, Chris Needham notifications@github.com wrote: The way it currently works is that the image height covers the full range of the audio signal so, as you've found, a low amplitude input will produce a small waveform. I'll consider adding a new command-line option to allow the scaling to be adjusted, either automatically to fit the available height, or by a user-specified amount. Something like:

This option would only be used when rendering waveform images, and not when creating .dat or .json waveform files. Thanks for the suggestion! — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [https://github.com/bbc/audiowaveform/issues/45#issuecomment-254127993], or mute the thread [https://github.com/notifications/unsubscribe-auth/ACW5P_29EmS9t0X6S_evbINidj-DRGeyks5q0x2MgaJpZM4KYJ7t].

bhaskargr commented 8 years ago

Chris, did you get a chance to implement this?

chrisn commented 8 years ago

Yes, it's on this branch. Let me know if it does what you need, or if you find any problems.

taylorvc commented 8 years ago

Hey, I checked out the amplitude-scale branch wanting to test this new option but I cannot seem to get it to work. I'm definitely on the right branch with the updated code, but when I try to run a command with the option, I still get: Error: unrecognised option '--amplitude-scale=auto'

chrisn commented 8 years ago

I don't think you're running the updated code. If you enter audiowaveform --help you should see this line in the output:

  --amplitude-scale arg (=1.0)    amplitude scale

I was waiting for @bhaskargr to verify the feature before merging into master and publishing a new release.

taylorvc commented 8 years ago

Yeah, I don't see that option in the output for --help. I just cloned a fresh repo and checked out the branch: amplitude-scale.

Would it matter if I built from source?

chrisn commented 8 years ago

You'll need to build from source to try this feature. Details are in the ReadMe. After compiling, use ./audiowaveform from your build directory to run the program, or make install to install it to your /usr/local/bin directory.