Flash 10.1 AS3 - 将实时效果应用于麦克风 - 口吃问题
我正在尝试编写一个闪存应用程序,它采用麦克风流并应用实时效果并将其输出回扬声器。
我发现从麦克风获取输出时遇到口吃问题,将其复制到 ByteArray amd 中,然后使用单独的
声音 = new Sound();
sound.addEventListener(SampleDataEvent.SAMPLE_DATA, processSound);
声音.play();
从此 ByteArray 读取并播放声音。
我注意到麦克风的 bytesAvailable 的输入发生了变化,而且两个事件(麦克风的 SAMPLE_DATA 和声音的 SAMPLE_DATA)并没有像需要的那样触发 ABABABAB,而是更加随机。
我是否正确地认为 mic.SAMPLE_DATA 事件以不同的时间间隔触发不同数量的数据,并且工作实现需要读取可用数据并缓冲输入,以便 Sound SampleDataEvent 始终有一些内容可以播放以避免馅料?
I'm trying to write a flash application which takes a Microphone stream and applies realtime effects and outputs this back to the speakers.
I'm finding I'm having problems with stuttering when taking the output from the mic, copying this into a ByteArray amd then using a seperate
sound = new Sound();
sound.addEventListener(SampleDataEvent.SAMPLE_DATA, processSound);
sound.play();
to read from this ByteArray and play back the sound.
I have noticed that the input from the mic's bytesAvailable changes, and also that the two events (the mic's SAMPLE_DATA and the sound's SAMPLE_DATA) aren't firing A B A B A B A B like would be needed but is more random.
Am I right in thinking that the mic.SAMPLE_DATA event fires at different intervals with different amounts of data and a working implementation would need to read the available data in and buffer the input so that the Sound SampleDataEvent would always have something to play back to avoid the stuffering?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一个解决方案,所以我想我会将其发布在这里,以防其他人遇到类似的问题(许多谷歌搜索对我来说没有任何结果)。
麦克风的输入似乎不一致,并且需要发送所有字节才能正确处理声音。让它工作的关键是使用数组来缓冲输入。
I found a solution so thought I'd post it on here incase anyone else had similar problems (many google searches turned up nothing for me).
It does seem that the input from the mic is fed through inconsistently, and all the bytes sent through are needed in order to properly process the sound. The key to getting it to work was to use an array to buffer the input.