-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't know how to copy audio into object #31
Comments
AFAI can tell the keyfinder code assumes the file is some plain PCM-encoded audio data (eg. a In order to proceed, either ensure your input audio is of the format the decoder from the example expects or use a proper audio decoding library (such as ffmpeg) that produces the I will take the liberty and close this issue as this is not related to Keyfinder itself. The examples probably need some thorough modernization as well as better explanations to avoid these kinds of confusions in the future. |
Thank you @Swiftb0y , I'll try to get the float samples from mp3 file. Moreover, I've found that in ibsh's repo is_KeyFinder, he used libav to process mp3 file and turn it to correct float samples that the libkeyfinder expects, but the code in that repo is too complicated for me to understand because I have little knowledge of encoding and decoding audio file. |
yes, thats exactly the code you need in order to use keyfinder with audio data that is not plain wav. If decoding the file automatically is too complicated for you, you can use the simpler example code from the beginning (even though I don't recommend it because its simplicity brings some major flaws) if you transcode the file you're interested in to a |
@Swiftb0y , I decide to not spend time on understanding the decoding code now. I do as the 'basic.cpp' do, and the audio file is original `
............... |
And the source code in libkeyfinder/src/fftadapter.cpp: |
Yeah. I'm not a keyfinder dev. I don't know how to solve that or even what the cause is exactly. Try |
Thank you @Swiftb0y , I tried |
yeah. not sure what the problem is. I'm sorry I don't have the time to look into it. |
It's ok, thanks for your help. |
As it's shown in docs/Introduction.txt and examples/basic.cpp, I set FrameRate, Channels, and SampleCount which I get from taglib. And then I need to copy audio into the object as instructed, but my audio file is mp3, and it's sampleSize is not an integer(I don't know if the sampleSize is calculated correctly, if it's not, please tell me).As a result, I don't know how to copy my audio into the object. In addition, I don't understand the code in basic.cpp:
Here's my code:
output:
the value of sampleSize is about 3.71
Because sampleSize is not an integer, I get the result "Silence". If I set sampleSize manually to 3 or 4, I'll get a wrong key like B minor or E minor, but the real key of the song is G minor
The text was updated successfully, but these errors were encountered: