Forums: 

package gractenote;

import com.gracenote.gnsdk.GnException;
import com.gracenote.gnsdk.GnMusicIdFile;
import com.gracenote.gnsdk.GnMusicIdFileInfo;
import com.gracenote.gnsdk.GnUser;

public class TestCode {

    private final String CLIENT_ID = "****************";
    private final String CLIENT_TAG = "************************";

    public void addAudioFiles() throws GnException {
        GnUser gnUser = new GnUser(null, CLIENT_ID, CLIENT_TAG, null);
        GnMusicIdFile audioFile = new GnMusicIdFile(gnUser);
        GnMusicIdFileInfo mirrors = new GnMusicIdFileInfo();
        try {
            mirrors.fileName("JTMirrors.mp3");
        } catch (GnException e) {
            e.printStackTrace();
        }

   }

}

As metioned in the documentation, 

"Each audio file your application wishes to identify must be added to the GnMusicIdFile instance with a unique identifier. The unique identifier is used to correlate identification results and audio files.

Each audio file is represented by a GnMusicIdFileInfo object. You can use the object to add more information about the audio file, such as textual metadata including track title and artist name, and a fingerprint if the audio file can be decoded to PCM."

I am trying to build a Java tool the regogniozes song on the basics of sample audio file provided. The code I wam working with is pasted above. 
My Problem is GnMusicIdFileInfo has no contructor and I don't now to how to create a  GnMusicIdFileInfo object.

Any help is appricated. Thanks in advance. 

Hello.

You should get GnMusicIdFileInfo object through GnMusicIdFileInfoManager, see this example:

                    GnMusicIdFile gnMusicIdFile = new GnMusicIdFile(your_gn_user_object, your_object_for_receiving_callbacks);
                    GnMusicIdFileManager gnMusicIdFileInfoManager = gnMusicIdFile.fileInfos();
                    GnMusicIdFileInfo gnMusicIdFileInfo = gnMusicIdFileInfoManager.add(path_to_your_file);

Hope this helps.

 

Forum Discussions