Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto -End parameter #58

Open
galenhuckins opened this issue Jan 11, 2018 · 12 comments
Open

Auto -End parameter #58

galenhuckins opened this issue Jan 11, 2018 · 12 comments

Comments

@galenhuckins
Copy link

Is there way to have the script autodetect the length to show the entire audio file without setting start/end/zoom?

@chrisn
Copy link
Member

chrisn commented Jan 11, 2018

At present, no, but I could change the --zoom option to accept an auto value that, when combined with the --width option, scales the waveform to fit the specified width. Does that sound OK? Thanks for the suggestion!

@galenhuckins
Copy link
Author

That would be perfect. I don't have access to duration metadata on some of the files and so displaying an overview is tricky. Thanks for being so responsive, great script!

@chrisn
Copy link
Member

chrisn commented Jan 11, 2018

This is a useful feature, so I will plan to add it, but I can't give any promises about timescale at this stage.

@Proper-Job
Copy link

@chrisn That would be really helpful.

@chrisn
Copy link
Member

chrisn commented Apr 16, 2018

I've just published 1.2.0 which implements this feature. Feedback welcome!

@ashraffayad
Copy link

ashraffayad commented Mar 1, 2021

the --zoom auto function didn't work (v1.4.2).

This was the command
audiowaveform -i a.mp3 -b 8 -w 400 -h 30 -z auto -o track.json

This was the output

Input file: a.mp3
Format: Audio MPEG layer III stream
Bit rate: 160000 kbit/s
CRC: no
Mode: joint (MS/intensity) stereo
Emphasis: no
Sample rate: 44100 Hz
Encoding delay: unknown
Padding: unknown
Invalid zoom: minimum 2

@chrisn
Copy link
Member

chrisn commented Mar 2, 2021

I think you've found a bug. The -z auto option should only work with PNG output, so the error message is wrong. If you want JSON output, you need to pass a number with -z. We could enable auto for JSON output, but you won't get the exact number of output points as you expect, due to rounding errors. See this related issue: #114 for more details.

@ashraffayad
Copy link

I understand. Thanks Chrisn

@chrisn
Copy link
Member

chrisn commented Mar 2, 2021

I'll re-open this, as it would be a useful feature.

@chrisn chrisn reopened this Mar 2, 2021
@henock1
Copy link

henock1 commented Mar 23, 2021

This would be a nice improvement. I seem to be running into this when rendering pngs in 1.4.2 as well:

Example 1:

Command:
audiowaveform -i dat/example1.dat -o output.png --output-format png --no-axis-labels --waveform-color 000000 --background-color 00000000 -z auto -w 3500 -h 250
Output:

Input file: dat/example1.dat
Channels: 1
Sample rate: 44100 Hz
Bits: 8
Samples per pixel: 256
Length: 1540 points
Invalid zoom, minimum: 256

I worked around this error by not passing a -z param:
Command:
audiowaveform -i dat/example1.dat -o output.png --output-format png --no-axis-labels --waveform-color 000000 --background-color 00000000 -w 3500 -h 250
Output:

Input file: dat/example1.dat
Channels: 1
Sample rate: 44100 Hz
Bits: 8
Samples per pixel: 256
Length: 1540 points
Image dimensions: 3500x250 pixels
Channels: 1
Sample rate: 44100 Hz
Samples per pixel: 256
Start time: 0 seconds
Start index: 0
Buffer size: 1540
Axis labels: no
Amplitude scale: 1
Output file: output.png
Done

Example 2
Command:
audiowaveform -i dat/example2.dat -o output.png --output-format png --no-axis-labels --waveform-color 000000 --background-color 00000000 -z auto
Output:

Input file: dat/example2.dat
Channels: 1
Sample rate: 48000 Hz
Bits: 8
Samples per pixel: 480
Length: 556 points
Invalid zoom, minimum: 480

@chrisn
Copy link
Member

chrisn commented Mar 24, 2021

@henock1 With your example 1, the data file length is 1540 points and the image width is 3500 pixels. If you specify -z auto, you're asking for the 1540 data points to be stretched to fit into 3500 pixels. This isn't currently supported, and why it reports "Invalid zoom".

Without -z auto, the data points will not be stretched, and the waveform will not fill the entire image width. The same happens in example 2, where the data file length is 556 points and the default image width (800 pixels) is used.

Is the solution here to implement stretching?

If you want the waveform to fill the image width, you would need to create new data files with higher resolution, e.g., 128 samples/pixel instead of 256.

@ice6
Copy link

ice6 commented Jan 23, 2023

cool, so -z auto is equal to 'auto end' :)

@bbc bbc deleted a comment from sockite Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants