understanding getByteTimeDomainData and getByteFrequencyData in web audio

前端 未结 3 1937
旧时难觅i
旧时难觅i 2020-12-29 07:29

The documentation for both of these methods are both very generic wherever I look. I would like to know what exactly I\'m looking at with the returned arrays I\'m getting fr

3条回答
  •  生来不讨喜
    2020-12-29 07:43

    Mozilla 's documentation describes the difference between getFloatTimeDomainData and getFloatFrequencyData, which I summarize below. Mozilla docs reference the Web Audio experiment ; the voice-change-o-matic. The voice-change-o-matic illustrates the conceptual difference to me (it only works in my Firefox; it does not work in my Chrome).

    TimeDomain

    • TimeDomain functions are over some span of time.
    • We often visualize TimeDomain data using oscilloscopes.
    • In other words, we visualize TimeDomain data with a line chart, where the x-axis is time, and the y axis is a measure of a signal.
    • Change the voice-change-o-matic "visualizer setting" to sinewave to see getFloatTimeDomainData(...)

    Frequency

    • Frequency functions (GetByteFrequencyData) are at a point in time.
    • We sometimes see these in mp3 players/ winamp-style music players (aka "equalizer' visualizations).
    • In other words, we visualize Frequency data with a bar graph, where the x-axis are frequency bands, and the y-axis is the strength of each frequency band
    • Change the voice-change-o-matic "visualizer setting" to frequency bars to see getFloatFrequencyData(...)

提交回复
热议问题