saysmy / flv-audio-visualization Goto Github PK
View Code? Open in Web Editor NEWFlv audio visualization, parse AAC and use audioContext to realize visualization.
Flv audio visualization, parse AAC and use audioContext to realize visualization.
关于之前在开会的时候提出过的问题,是否可以从getByteFrequencyData看出有实际意义的数据变化。
我这边查找MDN及其他资料发现,数据原谱即真实存在的数据为时域谱,即横轴为时间,纵轴为幅度,频率由斜率(或者说周期决定)。通过傅里叶变化,可以获取其转换后的频域谱,横轴为频率,纵轴为幅度。
那么问题就是采样的问题。根据MDN显示,AnalyserNode.minDecibels
表示频谱结果的最小值,AnalyserNode.maxDecibels
表示频谱结果的最大值。也就是说getByteFrequencyData
的结果,表示在 A - [AnalyserNode.minDecibels, AnalyserNode.maxDecibels]上幅度的变化。
最后可视化的逻辑中
let array = new Uint8Array(this.analyser.frequencyBinCount)
this.analyser.getByteFrequencyData(array)
array.length
与this.analyser.frequencyBinCount
相等,所以frequencyBinCount
与AnalyserNode.maxDecibels - AnalyserNode.minDecibels
共同决定了采样的精度,即单位长度上有表示多少赫兹的频率范围的数据量。
至此,可以了解到。我们可视化的数据步长可以直接使用array.length | frequencyBinCount
,来表示实际的精度,如果需要降低可视化的步长,减少fftSize值的大小即可。当然也可以像您的代码中那样,自定义步长,但是这样就存在一部分数据没必要计算(因为我们并没有使用到)。
存在理解有误的地方,望指出。感恩~
我是按照你的思路来写的,直接
this.audio = document.createElement('audio')
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)()
this.analyser = this.audioCtx.createAnalyser()
this.audioSrc = this.audioCtx.createMediaElementSource(this.audio)
...
打开查看元素 ,音乐有时会停掉,而且arry数组没变,导致动画一直卡住
你好,在工作中有这样一个需求:实现直播视频的音频可视化。请问如何利用flvjs库,如何从视频中获取音频buffer数据?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.