From: Steven Lord on 16 Jun 2010 13:04 "ImageAnalyst" <imageanalyst(a)mailinator.com> wrote in message news:0fa6e8b6-67e6-494c-b0a7-67ac9fc9320c(a)a30g2000yqn.googlegroups.com... > That is: > audioForSpeaker1 = allSpeakersAudio(speaker1Start:speaker1Stop); > audioForSpeaker2 = allSpeakersAudio(speaker2Start:speaker2Stop); > audioForSpeaker3 = allSpeakersAudio(speaker3Start:speaker3Stop); > etc. > and so on for all the other speakers. > You said "I have the time boundaries for each speaker " so that means > you have speaker1Start, speaker1Stop, speaker2Start, speaker2Stop, etc. I'd use a slightly modified version of ImageAnalyst's approach, one that scales if you have many speakers and want to do this automatically. Let's assume you have a vector of starting and stopping values: speakerStart speakerStop In this case, create a cell array in which the audio for speaker k (spanning speakerStart(k) to speakerStop(k)) is stored in the kth cell. audioForSpeakers = cell(size(speakerStart)); for k = 1:numel(speakerStart) audioForSpeakers{k} = allSpeakersAudio(speakerStart(k):speakerStop(k)); end That way you can easily iterate through the audio for each speaker using a FOR loop or CELLFUN. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: lama on 17 Jun 2010 20:36 Thank u all for your replies but if the same speaker have more than one segments "Steven Lord" <slord(a)mathworks.com> wrote in message <hvb070$10j$1(a)fred.mathworks.com>... > > "ImageAnalyst" <imageanalyst(a)mailinator.com> wrote in message > news:0fa6e8b6-67e6-494c-b0a7-67ac9fc9320c(a)a30g2000yqn.googlegroups.com... > > That is: > > audioForSpeaker1 = allSpeakersAudio(speaker1Start:speaker1Stop); > > audioForSpeaker2 = allSpeakersAudio(speaker2Start:speaker2Stop); > > audioForSpeaker3 = allSpeakersAudio(speaker3Start:speaker3Stop); > > etc. > > and so on for all the other speakers. > > You said "I have the time boundaries for each speaker " so that means > > you have speaker1Start, speaker1Stop, speaker2Start, speaker2Stop, etc. > > I'd use a slightly modified version of ImageAnalyst's approach, one that > scales if you have many speakers and want to do this automatically. Let's > assume you have a vector of starting and stopping values: > > speakerStart > speakerStop > > In this case, create a cell array in which the audio for speaker k (spanning > speakerStart(k) to speakerStop(k)) is stored in the kth cell. > > audioForSpeakers = cell(size(speakerStart)); > for k = 1:numel(speakerStart) > audioForSpeakers{k} = allSpeakersAudio(speakerStart(k):speakerStop(k)); > end > > That way you can easily iterate through the audio for each speaker using a > FOR loop or CELLFUN. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com >
From: ImageAnalyst on 17 Jun 2010 20:40
Just concatenate all the arrays for a particular speaker, if you want all segments for that particular speaker to be in just one single array. You should learn concatenation - it's one of the most basic yet most useful things to do in MATLAB. |