我没有找到Soundtouch的任何Java包装器,除了这里指出的一个:
Android上的SoundTouch?
据我所知,这个包装器应该只适用于Windows,但我正在努力Linux
.我对C++开发并不熟悉,这也是我想尽可能地保持Java工作的原因.
有人知道该包装的替代品吗?
我正在尝试在Android上编译SoundTouch.我从这个配置行开始:
./configure CPPFLAGS =" - I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include /"LDFLAGS =" - Wl,-rpath-link =/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -L / Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -nostdlib -lc"--host = arm-eabi --enable-shared = yes CFLAGS =" - nostdlib -O3 -mandroid"host_alias = arm-eabi --no-create --no-递归
因为Android NDK以ARM为目标,所以我还必须更改Makefile以删除要进行的-msse2标志.
当我运行'make'时,我得到:
/bin/sh ../../libtool --tag=CXX --mode=compile arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c -o FIRFilter.lo FIRFilter.cpp
libtool: compile: arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c FIRFilter.cpp …
Run Code Online (Sandbox Code Playgroud) 我在网上搜索过,无法找到有关如何使用SoundTouch库进行节拍检测的教程.
(注意:在此之前我没有C++经验.我确实知道C,Objective-C和Java.所以我可能搞砸了一些,但它编译了.)
我将框架添加到我的项目中并设法获得以下内容进行编译:
NSString *path = [[NSBundle mainBundle] pathForResource:@"song" ofType:@"wav"];
NSData *data = [NSData dataWithContentsOfFile:path];
player =[[AVAudioPlayer alloc] initWithData:data error:NULL];
player.volume = 1.0;
player.delegate = self;
[player prepareToPlay];
[player play];
NSUInteger len = [player.data length]; // Get the length of the data
soundtouch::SAMPLETYPE sampleBuffer[len]; // Create buffer array
[player.data getBytes:sampleBuffer length:len]; // Copy the bytes into the buffer
soundtouch::BPMDetect *BPM = new soundtouch::BPMDetect(player.numberOfChannels, [[player.settings valueForKey:@"AVSampleRateKey"] longValue]); // This is working (tested)
BPM->inputSamples(sampleBuffer, len); // Send the …
Run Code Online (Sandbox Code Playgroud) soundtouch ×4
android ×2
android-ndk ×1
audio ×1
compilation ×1
ios ×1
iphone ×1
java ×1
pitch ×1