使用软件合成器制作实时音频应用程序(Making a real-time audio application with software synthesizers)
我正在研究制作一些使键盘功能像钢琴一样的软件(例如,用户按下'W'键并且扬声器播放D音符)。 我可能会使用OpenAL。 我理解数字音频的基础知识,但是在按键时播放实时音频会带来一些我无法解决问题的问题。
问题在于:假设我有10个音频缓冲区,每个缓冲区都有一秒钟的音频数据。 如果我必须在通过扬声器播放之前填充缓冲区,那么我会在播放前一两秒填充缓冲区。 这意味着每当用户尝试播放音符时,按下琴键和正在播放的音符之间将有一到两秒的延迟。
你如何解决这个问题? 你是否只是让缓冲区尽可能小,并尽可能地填充它们? 有一些我不知道的技巧吗?
I'm looking into making some software that makes the keyboard function like a piano (e.g., the user presses the 'W' key and the speakers play a D note). I'll probably be using OpenAL. I understand the basics of digital audio, but playing real-time audio in response to key presses poses some problems I'm having trouble solving.
Here is the problem: Let's say I have 10 audio buffers, and each buffer holds one second of audio data. If I have to fill buffers before they are played through the speakers, then I would would be filling buffers one or two seconds before they are played. That means that whenever the user tries to play a note, there will be a one or two second delay between pressing the key and the note being played.
How do you get around this problem? Do you just make the buffers as small as possible, and fill them as late as possible? Is there some trick that I am missing?
原文:https://stackoverflow.com/questions/1392725
最满意答案
是。 我最近使用Google Analytics for Ionic3应用。 我最初失踪的一件重要事情是在Google Analytics中为
mobile app
创建帐户。 如果您使用网站帐户,则不会从移动设备触发GA事件。您可以将此 Cordova插件用于GA。
按照提供的步骤为bwlow创建移动应用程序的GA帐户。
2.创建新帐户
Yes. I recently used Google Analytics for Ionic3 app. One important thing I was missing initially was to create account for
mobile app
in Google Analytics. If you use website account, GA events will not be fired from mobile devices.You can use this Cordova plugin for GA.
Follow steps mentined bwlow to create GA account for mobile app.
1. Go to Admin panel from side bar.
2. Create new account
相关问答
更多-
由于问题是在奇怪的情况下发生的,因此解决方案必须更加奇怪。 我在$ionicPlatform.ready函数中删除了未定义的双引号,并且它有效。 所以现在代码看起来像: $ionicPlatform.ready(function() { if (typeof analytics !== undefined) { analytics.startTrackerWithId("UA-x-x"); } else { console.log("Google Analy ...
-
使用Cordova google-analytics-plugin时出错(Build error when using Cordova google-analytics-plugin)[2022-12-05]
我只是试图重现你的错误 - 而且没有。 我使用您链接的插件和控制台插件构建了一个新项目。 构建完全正常并且成功。 据我所知,您编辑了gradle构建设置以加快gradle构建。 -Dorg.gradle.daemon=true ...据我阅读文件,这必须是-org.gradle.daemon=true或者是像操作员或必须存在的变量一样的D ? 您还可以尝试以管理员身份运行cmd 。 Cordova从5.1.1降级到4.3.2解决了许多用户的问题。 I just tried to reproduce your ... -
看起来这是我自己的一厢情愿。 尽管在文档中说应用程序数据只会在24小时后出现在分析中,但我不知何故认为它不适用于“实时”选项卡。 它的确如此。 24小时后,实时数据显示延迟秒,但不是更早。 相关问题中的一些答案则相反。 不要认为这是理所当然的,就像我一样。 Looks like it was my own wishful thinking at fault. While it is said in documentation that app data will appear in analytics on ...
-
通过缩小谷歌代码后,我在原始问题中找到了#2的答案: ga('set', 'checkProtocolTask', function(data) { data.set('location', 'http://whatever.host.I.want.com'); }); 重写这样的“checkProtocolTask”会做两件事: 默认/原始“checkProtocolTask”检查请求是否来自http / https并引发file:// URL的异常。 重写这会阻止发生这种情况。 这种方法(如迭 ...
-
这是一个Ripple模拟器问题,缺乏使用本地Java / Swift代码的能力,因此missing exec: 为了使用插件修复或正确测试应用程序,您需要将它安装在更好的模拟器或设备上。 This is a Ripple Emulator issue with the lack of ability to use native Java/Swift code, hence the missing exec:. In order to fix or properly test the app with the ...
-
由于本教程,上述问题得到了解决----> https://github.com/jelled/google-analytics-cordova-ios The above issue got resolved, thanks to this tutorial ----> https://github.com/jelled/google-analytics-cordova-ios
-
我有同样的问题,并在此评论中找到了答案。 运行android然后安装/更新 Android支持存储库 Android支持库 Google Play服务 Google Repository 为我解决了这个问题。 听起来好几个人也不得不改变插件版本 cordova plugin add cordova-plugin-google-analytics@0.7.1 但我不必这样做。 I had the same problem and found the answer in this comment. Runni ...
-
Google Analytics中的实时部分是否适用于Phonegap?(Does Real time section in Google Analytics work with Phonegap?)[2022-06-15]
我找到了答案。 它确实有效,而且它是即时的。 需要在谷歌中定义一个移动应用程序,我的代码中有一些错误。 别忘了在google中禁用过滤器。 并获得最新版本的pf thr GA插件。 I found the answer. It does work, and it's immediat. Needed to define a mobile app in google, and i had some bugs in my code. Dont forget to disable the filters in g ... -
是。 我最近使用Google Analytics for Ionic3应用。 我最初失踪的一件重要事情是在Google Analytics中为mobile app创建帐户。 如果您使用网站帐户,则不会从移动设备触发GA事件。 您可以将此 Cordova插件用于GA。 按照提供的步骤为bwlow创建移动应用程序的GA帐户。 1.从侧栏转到“管理”面板。 2.创建新帐户 3.选择账户类型作为移动应用程序 Yes. I recently used Google Analytics for Ionic3 app. ...
-
有关ga.create()调用的两件事: 1)第三个参数(在您的情况下为“ herokuapp.com ”)应该是Javascript对象,而不是普通字符串。 你真的是指{'cookieDomain': 'herokuapp.com'}吗? 2)如果你做了......那么它应该是example.herokuapp.com - 你不能在herokuapp.com上设置一个cookie。 Two things regarding your ga.create() call: 1) The third param ...