Waveform antialiasing

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Waveform antialiasing

Post by Robert J. H. » Tue Aug 11, 2015 10:37 am

steve wrote:
h-h wrote:You can't say no to an additional option that you won't choose.
Everyone is entitled to give their opinion about proposals.
Whether or not a proposal every gets added to Audacity largely depends on whether someone has the time, enthusiasm and ability to do it.
Decisions about what is enabled by default based on should be based on what is in the best interests of Audacity users. These are often difficult choices, but we try.

When feature requests are transferred from the forum to the list on the wiki "feature requests" page, only votes in favour of the proposed feature are counted, Objections to a proposed feature may be noted in the comments, but votes against a feature are not counted.

h-h wrote:And it seems your view of antialiasing is: "No, surely it's a bad thing." It won't make you glad that it is already considered elsewhere to implement it in some way.
I think that you may be slightly misinterpreting what was said here and on the developer's mailing list.

There is broad agreement from both users and developers that improving the appearance of Audacity is generally a good thing, and I don't think that any of the comments made here detract from that. The crux of the argument against this particular proposal is that accuracy of the visual information is favoured over whether or not it looks pretty.

As James (developer) said, this proposal is an approximate antialiasing technique that does not address situations where (visual) antialiasing matters the most, and that there are many changes to visual presentation that have a bigger impact for the work put in. Federico then suggested that rather than applying antialiasing to the graphics, an effective way to improve the waveform display would be to draw the waveform based on interpolated data.

What is being suggested on the developers mailing list is to approach the issue from the opposite direction from this proposal:
Currently, the zoomed out waveform is plotted using a simple and fast method of plotting the closest pixel to peak data points, and the zoomed in waveform is drawn based on simple and fast linear interpolation between sample values. The proposal here on the forum is to "smooth" the resulting graphical representation. What has been suggested on the developers mailing list is to use more accurate algorithms for translating the audio data points into pixels (parabolic interpolation of the peak data, and sinc interpolation of the zoomed in waveform).

The difference in approach is easiest to see in the case of the zoomed in waveform (where individual sample values are visible):

This is how we draw the waveform now. The waveform is a linear interpolation between the sample points:
linear.png
This image is using the same data points and the same linear interpolation, but the waveform graphic has been antialiased.
dithered.png
This image interpolates between the data points with spline interpolation (sinc interpolation would be better, but this is an approximation for illustration purposes).
The important difference here is not "smoothing the graphic", but smoothing the data from which the graphic is drawn. This final version not only looks prettier (in my opinion) but provides better information to the user as it provides a more accurate visual representation of the analog waveform that is produced when the sound card converts the (digital) sample data into a band limited (analog) waveform.
interpolated.png
+1

The interpolation should be able to approximate the true peaks of the audio as they often occur in between samples (after DAC).

EBU R-128 uses a 48-tap Fir filter for this.
But I think a Lanczos (i.e. sinc) interpolation/resampling will be fine for this.
Their are good results achievable with interpolaters of order 8 and less.
It's mainly a question of trial and error and how to find the best compromise between speed and accuracy.

Robert

h-h
Posts: 110
Joined: Tue Jul 28, 2015 2:37 am
Operating System: Please select

Re: Waveform antialiasing

Post by h-h » Tue Aug 11, 2015 2:47 pm

Gale Andrews wrote:I think h-h should show us waveform images of anti-aliased and not that show the kind of antialiasing he or she proposes.
I don't understand what you want me to show. Antialiased waveforms, but not with the algorithm I propose? The image that you quoted was the only one I could find that adds shades seemingly according to the data and not just on the border to the background. That doesn't add value. It seems different approaches are generally accepted being termed "antialiased".
steve wrote:As James (developer) said, this proposal is an approximate antialiasing technique that does not address situations where (visual) antialiasing matters the most, and that there are many changes to visual presentation that have a bigger impact for the work put in. Federico then suggested that rather than applying antialiasing to the graphics, an effective way to improve the waveform display would be to draw the waveform based on interpolated data.
First: Very good illustrations!

Unfortunately I don't understand: "does not address situations where (visual) antialiasing matters the most." Maybe it's related to the attached image? It shows a mixed zoom level with lines and condensed waves. I guess there can be situations where a light gray not-really-antialiased line could appear by means of just rendering pixel columns, but that's the matter of accuracy that we all want.

Federico spoke about what you showed in the sine example: interpolated data at a high zoom level. However, I don't understand what a huge impact it would have to calculate the "pixel opacity values" based on a parabolic interpolation at a low zoom level (zoomed out). I can't see a problem in using the data now displayed at a high zoom level to calculate one pixel column for a low zoom level. Later you could refine the algorithm and let a pixel column be based on interpolated data if people think it's more accurate.

Although the proposal seemed to be blocked in the mailing list, it would be great to let it go onto the feature requests page if you can imagine what I mean and agree. A demo application would indeed be great, but I can't do it in no-time and not just now. If you are willing to gather the details of the algorithm with me, it would help.
Attachments
Example.png
Example.png (8.17 KiB) Viewed 1260 times
Last edited by h-h on Fri Aug 14, 2015 7:01 am, edited 1 time in total.

rambomhtri
Posts: 230
Joined: Thu Jan 02, 2014 11:05 am
Operating System: Windows 8 or 8.1

Ex-act-ly

Post by rambomhtri » Tue Aug 11, 2015 6:30 pm

Steve said it. I think no one here is against enhancing the looks of the waveform. But that can NOT be at cost of accuracy. Look at your picture:
Image

In the non touched picture (no effects or filters, first one), there's a peak of 1 pixel width, right after a 1 pixel width silence. Because you compress the waveform when you zoom out, you reach a point that you've compressed the waveform "so much" that you don't have a density of pixels high enough to display correctly the compressed waveform, and then you got to cut/remove pixels from the waveform, because you don't have enough.

Nevertheless, in your anti-aliased pictures below, that 1 pixel width peak becomes a 3 pixel width peak. That's wrong, that's just making up pixels just so the waveform looks "cooler" or smoother. But that information should not be there at all. You're putting beauty over accuracy, and what we want is accuracy, as beautiful as it can be, but first accuracy.

cyrano
Posts: 2629
Joined: Fri Apr 17, 2015 11:54 pm
Operating System: macOS 10.13 High Sierra

Re: Waveform antialiasing

Post by cyrano » Tue Aug 11, 2015 9:44 pm

It's a bit of a support nightmare if you have to ask if it's on or not whenever anyone posts a waveform picture to this forum, for starters.

Audacity (with standard settings) is already misleading. Experienced users will switch the waveform settings to "db" as one of the first things. Newbies might think they have plenty of headroom if they look at the waveform.

Add waveform anti-aliasing to this cocktail and it will obfuscate things a lot, I think.

I do have some experience with anti-aliasing and on the graphic design side of things, it is a necessity. With waveform display, it's just a nuisance, especially to those of us who use Audacity as a scope.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Waveform antialiasing

Post by Gale Andrews » Wed Aug 12, 2015 10:58 am

h-h wrote:
Gale Andrews wrote:I think h-h should show us waveform images of anti-aliased and not that show the kind of antialiasing he or she proposes.
I don't understand what you want me to show. Antialiased waveforms, but not with the algorithm I propose? The image that you quoted was the only one I could find that adds shades seemingly according to the data and not just on the border to the background.
Others are arguing here that the images you posted are adding peaks that might not be in the data.

Do you know for sure those antialiased images were based on the data?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Waveform antialiasing

Post by Gale Andrews » Wed Aug 12, 2015 11:07 am

h-h wrote:Although the proposal seemed to be blocked in the mailing list, it would be great to let it go onto the feature requests page if you can imagine what I mean and agree.
I will put it on there some time with the comments against.

Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

waxcylinder
Forum Staff
Posts: 14684
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: Waveform antialiasing

Post by waxcylinder » Wed Aug 12, 2015 1:05 pm

cyrano wrote:Audacity (with standard settings) is already misleading ... Newbies might think they have plenty of headroom if they look at the waveform.
Indeed they do - just that (I did when I started out when I knew no better) - just take a look at the many "Audacity" tutorials on the interweb and facebook. Almost all of them have over-saturated audio.

WC
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

h-h
Posts: 110
Joined: Tue Jul 28, 2015 2:37 am
Operating System: Please select

Re: Waveform antialiasing

Post by h-h » Fri Aug 14, 2015 6:35 am

rambomhtri wrote:Because you compress the waveform when you zoom out, you reach a point that you've compressed the waveform "so much" that you don't have a density of pixels high enough to display correctly the compressed waveform, and then you got to cut/remove pixels from the waveform, because you don't have enough.
Gale Andrews wrote:Others are arguing here that the images you posted are adding peaks that might not be in the data.

Do you know for sure those antialiased images were based on the data?
rambomhtri, as I pointed out, I don't share your point of view in the topics "closest to reality"/"most accurate". I should repeat that I suggest minimum visibility to not make very short peaks complety invisible, but to let the top of a pixel column with only the very short peak on top of it look, say, quarter-visible. I'm against inaccuracy. I suggest a kind of dealing with the limited density you have on a computer monitor, even high-DPI screens. Shades are a possibility to add information. If you don't want them, don't turn them on or turn them off, respectively, in future versions of Audacity.

The pictures I referenced were found via an image search engine. I didn't verify them on a pixel-by-pixel basis. They illustrate shades on a waveform. It's up to you to imagine that the antialiased waveform is independent from the other ones and that every pixel of it represents data. I myself am dissatisfied with the little number of shades the image presents. Please see also steve's good illustrations he gave for zoomed-in waveforms and interpolated data that's closer to the analog output later produced.
Gale Andrews wrote:I will put it on there some time with the comments against.
Would you please reference this thread? I highlighted the important parts of my comments.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Waveform antialiasing

Post by steve » Fri Aug 14, 2015 8:04 am

I think the reason for the disagreement here is due to a misunderstanding of what the waveform view is.

When zoomed in close enough to see samples, the track shows "dots" to represent the sample values (amplitude and time position), and a line is drawn connecting the dots as an approximation of the analog interpolation. The "approximation"t is currently just straight lines joining the dots (linear interpolation) and could be improved both in "looking good" and "more realistic" if sinc interpolation was used to give a smooth curve passing through the dots. The dots and the joining line could be antialiased so that dots look round and the line looks smooth.

This is how the zoomed in track looks now with linear interpolation and no anti-aliasing:

Image

This is a mock-up to show what it would look like with sinc interpolation and anti-aliasing:

Image


When zoomed out, the waveform is drawn differently because sample are smaller than screen pixels. What the waveform shows in this case is the peak level (dark blue) within each pixel width, and the RMS level (light blue) within each pixel width. Essentially it is a bar graph, where each bar is one pixel wide, and the vertical height of each bar represents the peak (or maximum RMS level) within that pixel width.
bar-graph.png
bar-graph.png (1.53 KiB) Viewed 1242 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

rambomhtri
Posts: 230
Joined: Thu Jan 02, 2014 11:05 am
Operating System: Windows 8 or 8.1

Re: Waveform antialiasing

Post by rambomhtri » Fri Aug 14, 2015 12:34 pm

First, I'm not against AA just because. If Audacity gives you the option to activate or deactivate it, then it's alright, I won't activate it, you will, and everyone is happy. What I fear is that they may do it permanent, so you got to use AA, like it or not. That's what I don't like at all.

Second, I'm 100% with steve in the zoomed in view, of course adding there AA and drawing smooth curves is more realistic and good looking, both. But hey, we're not talking about that, not at all. You were talking about adding AA in a zoomed out view. That's a fail, you're gonna make up pixels and columns, and that's what I don't like, cause it is pure inaccuracy.

Image

Locked