WebAudio / web-audio-api

The Web Audio API v1.0, developed by the W3C Audio WG
https://webaudio.github.io/web-audio-api/
Other
1.05k stars 167 forks source link

WaveTable is poorly named #170

Closed olivierthereaux closed 11 years ago

olivierthereaux commented 11 years ago

Originally reported on W3C Bugzilla ISSUE-19561 Tue, 16 Oct 2012 20:41:47 GMT Reported by Chris Rogers Assigned to

It's been pointed out off-list that the WaveTable name is poor, since this name has other connotations involving synthesis techniques which sweep through through multiple waves: http://en.wikipedia.org/wiki/Wavetable_synthesis

Suggested renaming is: WaveTable -> PeriodicWave

olivierthereaux commented 11 years ago

Original comment by Chris Wilson on W3C Bugzilla. Tue, 16 Oct 2012 20:49:05 GMT

Maybe AdditiveHarmonics? FourierHarmonics? It would be nice to capture that this is a set of harmonics being added to generate the waveform. All Oscillators are periodic waveforms.

olivierthereaux commented 11 years ago

Original comment by Chris Rogers on W3C Bugzilla. Tue, 16 Oct 2012 21:21:41 GMT

(In reply to comment #1)

Maybe AdditiveHarmonics? FourierHarmonics? It would be nice to capture that this is a set of harmonics being added to generate the waveform. All Oscillators are periodic waveforms.

I much prefer PeriodicWave because this captures the essence of what it is. The OscillatorNode generates a periodic output based on a representation of a single cycle -- this is what I'm calling PeriodicWave

olivierthereaux commented 11 years ago

Original comment by Marcus Geelnard (Opera) on W3C Bugzilla. Wed, 17 Oct 2012 08:16:12 GMT

I think I'm with Chris Wilson here. I find it a bit counterintuitive to have "Wave" in the name at all, since to me, a wave is a time domain thing but the WaveTable object holds frequency domain data (it's the OscillatorNode that produces the wave, not the WaveTable object).

More precisely, the data held in the object is the Fourier series of a periodic wave, but I guess PeriodicWaveFourierSeries is a bit too wordy to be practical?

As usual, interface naming is about the hardest thing you can do in computer science ;)

Here's another thought: You could treat the WaveTable object in a way that is independent of frequency/time domain. For instance, if the interface provided a way to set the object state from a time domain signal as well as from a frequency domain signal, and let it be up to the implementation to choose how to store the data internally (could be frequency domain for hi quality synthesis or time domain for low quality synthesis), and use FFT/IFFT internally for the setters, as appropriate for the implementation.

If so, I think "PeriodicWave" would be a very fitting name.

olivierthereaux commented 11 years ago

Original comment by Jussi Kalliokoski on W3C Bugzilla. Wed, 17 Oct 2012 14:21:11 GMT

What about FormantTable?

olivierthereaux commented 11 years ago

Original comment by Jussi Kalliokoski on W3C Bugzilla. Wed, 17 Oct 2012 14:52:36 GMT

(In reply to off-issue-tracker comment)

Formant implies an absolute frequency.

The WaveTable entries are harmonics, i.e. relative to the oscillator's current fundamental frequency.

You're absolutely right, HarmonicTable is more accurate.

I didn't notice your earlier comment because it was made on the mailing list, please refrain from commenting on issues off the issue tracker to avoid the discussion from getting fragmented. :)

olivierthereaux commented 11 years ago

Original comment by Chris Rogers on W3C Bugzilla. Tue, 04 Dec 2012 19:56:01 GMT

(In reply to comment #3)

I think I'm with Chris Wilson here. I find it a bit counterintuitive to have "Wave" in the name at all, since to me, a wave is a time domain thing but the WaveTable object holds frequency domain data (it's the OscillatorNode that produces the wave, not the WaveTable object).

More precisely, the data held in the object is the Fourier series of a periodic wave, but I guess PeriodicWaveFourierSeries is a bit too wordy to be practical?

As usual, interface naming is about the hardest thing you can do in computer science ;)

Here's another thought: You could treat the WaveTable object in a way that is independent of frequency/time domain. For instance, if the interface provided a way to set the object state from a time domain signal as well as from a frequency domain signal, and let it be up to the implementation to choose how to store the data internally (could be frequency domain for hi quality synthesis or time domain for low quality synthesis), and use FFT/IFFT internally for the setters, as appropriate for the implementation.

If so, I think "PeriodicWave" would be a very fitting name.

Actually, the object as it's currently implemented in WebKit does internally represent the data in the time-domain (in multiple tables to avoid aliasing at different playback rates -- this is an implementation technique I can share more details about...). And I do think it's conceivable that we could have a way to create these objects given a time-domain array of data.

So this object isn't really tied to frequency-domain or time-domain and the current way of constructing it is simply a matter of convenience.

So I hope that "PeriodicWave" will be a good name.

olivierthereaux commented 11 years ago

Original comment by Marcus Geelnard (Opera) on W3C Bugzilla. Thu, 06 Dec 2012 08:50:12 GMT

Chris (R), do you think it's a good idea to add another method for creating the WaveTable (aka PeriodicWave) object from time-domain data?

olivierthereaux commented 11 years ago

Original comment by Chris Rogers on W3C Bugzilla. Mon, 17 Jun 2013 20:28:29 GMT

(In reply to comment #7)

Chris (R), do you think it's a good idea to add another method for creating the WaveTable (aka PeriodicWave) object from time-domain data?

Hi Marcus, sorry for the long delay. I think it's useful to add another method, but not critical we add it right now into the spec.

olivierthereaux commented 11 years ago

Original comment by Chris Rogers on W3C Bugzilla. Mon, 17 Jun 2013 20:29:01 GMT

Fixed: https://dvcs.w3.org/hg/audio/rev/7c4a40a9bb57

olivierthereaux commented 11 years ago

Original comment by Marcus Geelnard (Opera) on W3C Bugzilla. Tue, 18 Jun 2013 06:19:06 GMT

(In reply to comment #9)

Fixed: https://dvcs.w3.org/hg/audio/rev/7c4a40a9bb57

Looks good to me. And yes, it's not critical to add another time-domain function right now.

olivierthereaux commented 11 years ago

Original comment by Olivier Thereaux on W3C Bugzilla. Fri, 05 Jul 2013 09:36:01 GMT

Closing.