- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从 iOS 上读取 16 位 16KHz wav(20 秒长)并执行指纹识别。我尝试按照指南“GNSDK-for-Mobile-iOS-Developers-Guide”进行操作,但它在第 53 页(仅 C#)上没有 objective-c 示例。我的代码读入整个文件,然后将 2K block 写入函数 fingerprintWrite(我也尝试过传递一个指向整个文件的指针)。变量“result”永远不会设置为 1 - 表示传递的数据不足 - 但 20 秒应该足够了,对吧?有人可以帮忙吗?谢谢。
这是我所做的:
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"Human.signed.20s.16bit" ofType:@"raw"];
NSData *audioData= [NSData dataWithContentsOfFile:filepath];
BOOL result;
if (error)
NSLog(@"Error reading file: %@", error.localizedDescription);
// for debugging...
NSLog(@"contents: %@", audioData);
NSLog(@"Done:");
unsigned char buffer[audioData.length];
[audioData getBytes:buffer length:audioData.length];
for (int i = 0; i < audioData.length; i++) {
printf("0x%02x ",(unsigned char)buffer[i]);
}
[self.gnMusicIDFileInfo fingerprintBegin:16000 audioSampleSize:16 audioChannels:1 error:&error];
if (error) {
NSLog(@"Error = %@", [error localizedDescription]);
}
int count = 0;
result = 0;
while (result==0 && count<sizeof(buffer)-2048)
{
result = [self.gnMusicIDFileInfo fingerprintWrite:&buffer[count] audioDataSize:2048 error:&error];
NSLog(@"Count = %i",count);
count=count+2048;
}
NSLog(@"result = %i", result);
if (error) {
NSLog(@"Error = %@", [error localizedDescription]);
}
[self.gnMusicIDFileInfo fingerprintEnd:&error];
if (error) {
NSLog(@"Error = %@", [error localizedDescription]);
}
[self.gnMusicIDFileInfo fingerprint:&error];
if (error) {
NSLog(@"Error = %@", [error localizedDescription]);
}
最佳答案
20 秒可能不够,因为识别过程需要足够数量的“可用”音频才能继续。另外,在做MusicID文件识别的时候,需要有歌曲开头的音频文件。如果您的用例只提供了歌曲的一部分并且歌曲没有从头开始,那么它很可能无法工作。您将需要改用 MusicID Stream。
关于ios - 使用 Gracenote SDK (GNSDK) 读取文件并执行指纹识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35436280/
我使用带有 SDK Gracenote (GNSDK) 的脚本来对文件(指纹)进行音频识别。 脚本工作正常,我只是想转义变量中的双引号。 我发现了这个功能: void str_replace(char
我正在尝试从 iOS 上读取 16 位 16KHz wav(20 秒长)并执行指纹识别。我尝试按照指南“GNSDK-for-Mobile-iOS-Developers-Guide”进行操作,但它在第
我想在 Linux 上使用 GNSDK (Gracenote SDK) 编译一个应用程序,但我有错误(我使用 Code::Blocks)。我不想将 gracenote 指纹与 musicid_file
在 x86 AVD 上运行时,适用于 Android 的 GNSDK 示例应用程序因信号 4 (SIGILL)、代码 2 (ILL_ILLOPN) 而崩溃。我在 API 级别 22 和 25 上尝试了
我有一个实时音频流,我尝试使用 GNSDK(3.06) java 包装器对其进行指纹识别和搜索。我的代码基于 musicid_stream 示例。 我使用的代码: gnMusicID.fingerpr
GnAlbum 的标识符标签是什么? GnAlbum(java.lang.String id, java.lang.String idTag) Constructs a GnAlbum o
我是一名优秀的程序员,十分优秀!