93 views
Skip to first unread message

Lin

unread,
Apr 6, 2014, 1:26:45 PM4/6/14
to millionso...@googlegroups.com
Hi,
     My name is Lin Yanzhou,from South China Agricultural University.When I try to process 1.8G data of MSD by Matlab,an error appears:


Attempt to execute SCRIPT mksqlite as a function:
/home/lin/文档/MATLAB/mksqlite-1.12/mksqlite.m

Error in MS1 (line 5)
mksqlite('open',sqldb);

Could you tell me what should I do?Thank you very much and look forward to your reply.here is a image of screenshot


Arjannikov, Tom

unread,
Apr 6, 2014, 8:46:42 PM4/6/14
to millionso...@googlegroups.com

Hi Lin Yanzhou,

 

The detailed information about this problem can be found here: http://www.mathworks.com/matlabcentral/answers/93148 .

There is a walkthrough for MSD and Matlab here: http://labrosa.ee.columbia.edu/millionsong/pages/matlab-introduction .

 

I suspect that you did not setup the paths, before trying to open the file, so Matlab does not know what is msd_addf_path.

This is described in the link above and, for your convenience, I paste it below.

 

--- cut here ---

% set up Million Song paths

global MillionSong MSDsubset

MillionSong ='MillionSongSubset';  % or 'MillionSong' for full set

msd_data_path=[MillionSong,'/data'];

msd_addf_path=[MillionSong,'/AdditionalFiles'];

MSDsubset='subset_'; % or '' for full set

msd_addf_prefix=[msd_addf_path,'/',MSDsubset];

% Check that we can actually read the dataset

assert(exist(msd_data_path,'dir')==7,['msd_data_path ',msd_data_path,' is not found.']);

--- end ---

 

Regards,

- Tom

--
--
You received this message because you are subscribed to the Google
Groups "Million Song Dataset" group.
To post to this group, send email to millionso...@googlegroups.com
To unsubscribe from this group, send email to
millionsongdata...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/millionsongdataset?hl=en?hl=en
Million Song Dataset main webpage:
http://labrosa.ee.columbia.edu/millionsong/

---
You received this message because you are subscribed to the Google Groups "Million Song Dataset" group.
To unsubscribe from this group and stop receiving emails from it, send an email to millionsongdata...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lin

unread,
Apr 7, 2014, 3:50:40 AM4/7/14
to millionso...@googlegroups.com
Dear Tom,
    It's very nice to hear from you.I have solved that problem.Thank you very much.But when I run the code in Matlab,another error occurs to me.It tells that

            -----begin-----
Reference to non-existent field 'Count(track_id)'.
Error in getfield (line 37)
    f = s.(deblank(strField)); % deblank field name
Error in @(x)getfield(x,'Count(track_id)')
Error in MS (line 70)
[unused, order] =
sort(arrayfun(@(x)getfield(x,'Count(track_id)'),res(:)),'descend');
            -----end-----

Here is my code

            -----begin-----
% Compile mksqlite (only needs to be done once)
%cd mksqlite-1.13
%sqlite3.make('mksqlite.mexa64')

%cd ..
% add mksqlite to the path
addpath('mksqlite-1.13');


% set up Million Song paths
global MillionSong MSDsubset
MillionSong ='MillionSongSubset';  % or 'MillionSong' for full set
msd_data_path=[MillionSong,'/data'];
msd_addf_path=[MillionSong,'/AdditionalFiles'];
MSDsubset='subset_'; % or '' for full set
msd_addf_prefix=[msd_addf_path,'/',MSDsubset];
% Check that we can actually read the dataset
assert(exist(msd_data_path,'dir')==7,['msd_data_path ',msd_data_path,' is not found.']);

% path to the Million Song Dataset code
msd_code_path='MSongsDB';
assert(exist(msd_code_path,'dir')==7,['msd_code_path ',msd_code_path,' is wrong.']);
% Build a list of all the files in the dataset
all_files = findAllFiles(msd_data_path);
cnt = length(all_files);
disp(['Number of h5 files found: ',num2str(cnt)]);

% Get info from the first file using our wrapper
h5 = HDF5_Song_File_Reader(all_files{1});
disp(['artist name is: ',h5.get_artist_name()]);
disp([' song title is: ',h5.get_title()]);
methods('HDF5_Song_File_Reader')
%a=h5.get_segments_name;

% Get all artist names by mapping a function to return artist names
% over the cell array of data file names
tic;
all_artist_names = cellfun(@(f) get_artist_name(HDF5_Song_File_Reader(f)), ...
                           all_files, 'UniformOutput', false);
tend = toc;
disp(['All names acquired in ',num2str(tend),' seconds.']);
disp(['First artist name is: ',all_artist_names{1}]);
disp(['There are ',num2str(length(unique(all_artist_names))), ...
      ' unique artist names']);
% takes around 5 min on MacBook Pro to scan 10k files (30ms/file)


% Track metadata database
sqldb = [msd_addf_prefix,'track_metadata.db'];
% Open connection
mksqlite('open',sqldb);

% Run the SQL query.  DISTINCT means we only get the unique names
artist_names = mksqlite('SELECT DISTINCT artist_name FROM songs');
% Close the connection (clean up)
mksqlite('close');
disp(['Found ',num2str(length(artist_names)),' distinct artist names']);%显示有多少歌手
disp('First artist names are:');%把歌手的名字显示出来
for k=1:5;
    disp(artist_names(k).artist_name);
end

mksqlite('open',sqldb);
res = mksqlite(['SELECT DISTINCT artist_id,artist_name,Count(track_id) ' ...
                'FROM songs GROUP BY artist_id']);
mksqlite('close');
disp('Got entries that looks like:');
res(1)

% Sort the results
%[unused, order] = sort(arrayfun(@(x)getfield(x,'Count(track_id)'),res(:)),'descend');    %descend  按下降排序
%res = res(order);
%disp('Artist with the most songs is:');
%res(1)            %res(1)为第一个,res(2)为第二个...
            ----end----

Could you tell me what should I do with it?Thank you and look forward to you apply.

Sincerely
Lin Yanzhou
Reply all
Reply to author
Forward
0 new messages