Comments (7)
你好,我看了下findMaxAmplitude
修改之后的代码,你的目的是想避免 endIndex < startIndex
造成这个问题的原因呢,是因为参数bandWidth
与实际的bandWidth
不一致。
而bandWidth = Float(buffer.format.sampleRate) / Float(self.fftSize)
,也就是说self.fftSize
错了
总之,我们只要确保 RealtimeAnalyzer
对象中的fftSize
和 传给analyse
的buffer
的frameLength
是一致的,就不会出问题。
以上就是根本解决的办法。
from audiospectrum.
你好,我试了一下并没有发现什么问题,动画能正常显示呢。测试环境是 Xcode 10.2.1 模拟器是 iPhone XS 12.2
from audiospectrum.
你好,我试了一下并没有发现什么问题,动画能正常显示呢。测试环境是 Xcode 10.2.1 模拟器是 iPhone XS 12.2
你好,我试了下直接播放本地文件是没问题的,我是在线播放fetch AVAudioPCMBuffer的,但是这样得到的buffer的format.sampleRate和前面的不一样,前面的是48000,后面的是32000。
我再好好看下了。
from audiospectrum.
如果方便的话提供你的代码我们来一起研究下
from audiospectrum.
AudioSpectrum02-final.zip
大致改了下
from audiospectrum.
抱歉,这么晚才回复。我下载代码并运行了,大概听了10多分钟吧,还是没能复现你所说的那个问题
不过,你在buffer的回调函数函数里面的这个语句可以删除:
buffer.frameLength = AVAudioFrameCount(2048)
因为你换了播放器之后,这里的设置肯定就没必要了。这里的buffer.frameLength都是4096,我暂时没找到这个播放器可以设置 tap 这个buffer大小的地方。
from audiospectrum.
抱歉,我也现在才看到。没崩是因为findMaxAmplitude这个函数那里的代码我已经修改了
怪我没先说,上面注释的代码是之前的。虽说崩溃原因是数组越界,但是我觉得这样并不是从根本解决。
from audiospectrum.
Related Issues (6)
- 可以来一份oc的代码吗 HOT 1
- 录音 HOT 2
- 如何播放网络音乐 HOT 2
- 如何支持实时录音 HOT 2
- 将代码拷贝到自己项目后,直接编译功能正常,打包后会卡死或闪退。 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audiospectrum.