An easy way to input song chords into a structure of MATLAB
Hello. I’d like to know the way to enter the name of the song chords into the structure of MATLAB easily.
I do research about the related between chords and a piece of music, and I analyze the chords progression in MATLAB. Howerver, it takes too many time to enter the name of chords by hands like this;
chords = struct( …
‘name’, {}, … % name of chords(ex: ‘Cmaj7’)
‘start_sec’, {}, … % start time[s]
‘end_sec’, {} … % end time[s]
);
N=input(‘the number of chords: ‘);
BPM=input(‘BPM: ‘);
chords(1).start_sec=0;
for i=1:N
fprintf(‘n===== Chord %d =====n’, i);
chords(i).name=input(‘Name: ‘); %”
Start=input(‘Start beat: ‘);
chords(i).start_sec=(60/BPM)*4*(Start-1);
if i >= 2
chords(i-1).end_sec=(60/BPM)*4*(Start-1);
end
end
ends=input(‘End beat: ‘);
chords(N).end_sec=(60/BPM)*4*ends;
save("chords_yoruni.mat","chords");
I am a beginner when it comes to programming, so I don’t have any idea. I would like you to tell me even small things.
Thank you for your helpHello. I’d like to know the way to enter the name of the song chords into the structure of MATLAB easily.
I do research about the related between chords and a piece of music, and I analyze the chords progression in MATLAB. Howerver, it takes too many time to enter the name of chords by hands like this;
chords = struct( …
‘name’, {}, … % name of chords(ex: ‘Cmaj7’)
‘start_sec’, {}, … % start time[s]
‘end_sec’, {} … % end time[s]
);
N=input(‘the number of chords: ‘);
BPM=input(‘BPM: ‘);
chords(1).start_sec=0;
for i=1:N
fprintf(‘n===== Chord %d =====n’, i);
chords(i).name=input(‘Name: ‘); %”
Start=input(‘Start beat: ‘);
chords(i).start_sec=(60/BPM)*4*(Start-1);
if i >= 2
chords(i-1).end_sec=(60/BPM)*4*(Start-1);
end
end
ends=input(‘End beat: ‘);
chords(N).end_sec=(60/BPM)*4*ends;
save("chords_yoruni.mat","chords");
I am a beginner when it comes to programming, so I don’t have any idea. I would like you to tell me even small things.
Thank you for your help Hello. I’d like to know the way to enter the name of the song chords into the structure of MATLAB easily.
I do research about the related between chords and a piece of music, and I analyze the chords progression in MATLAB. Howerver, it takes too many time to enter the name of chords by hands like this;
chords = struct( …
‘name’, {}, … % name of chords(ex: ‘Cmaj7’)
‘start_sec’, {}, … % start time[s]
‘end_sec’, {} … % end time[s]
);
N=input(‘the number of chords: ‘);
BPM=input(‘BPM: ‘);
chords(1).start_sec=0;
for i=1:N
fprintf(‘n===== Chord %d =====n’, i);
chords(i).name=input(‘Name: ‘); %”
Start=input(‘Start beat: ‘);
chords(i).start_sec=(60/BPM)*4*(Start-1);
if i >= 2
chords(i-1).end_sec=(60/BPM)*4*(Start-1);
end
end
ends=input(‘End beat: ‘);
chords(N).end_sec=(60/BPM)*4*ends;
save("chords_yoruni.mat","chords");
I am a beginner when it comes to programming, so I don’t have any idea. I would like you to tell me even small things.
Thank you for your help music, input, chords MATLAB Answers — New Questions









