[Clam-devel] Re: [CLAM] Question regarding CLAM::Audio::GetEndTime()
Xavier Amatriain
xavier at create.ucsb.edu
Fri Feb 2 00:38:37 PST 2007
So that is definitely a bug... BeginTime is being incremented in seconds
while EndTime is output
in milliseconds and expects BeginTime to be also in milliseconds.
The error is in line 128 in MultichannelAudioFileReader:
mDeltaTime = TData <http://www.clam.iua.upf.edu/doc/CLAM-doxygen/namespaceCLAM.html#b9c6321b061069797fcc173f61e8111a>(sizeTmp) / mConfig.GetSourceFile().GetHeader().GetSampleRate();
There is a *1000. missing.
Actually I am seeing that the same error repeats in different places... so I guess the
issue would be easier to fix in the Audio getter. I'll push the discussion to the clam-devel list.
Bad Data wrote:
> This is what I'm doing for every chunk:
> std::cout << "EndTime: " <<
> incomingAudioChannels[0].GetEndTime()
> << " Size: " <<
> incomingAudioChannels[0].GetSize()
> << " BeginTime " <<
> incomingAudioChannels[0].GetBeginTime()
> << "\n";
>
>
> And this is what it is outputing:
>
> audioMixer examples # ./FilePlayback_example blue_serge.wav
> EndTime: 23.22 Size: 1024 BeginTime 0
> EndTime: 23.2432 Size: 1024 BeginTime 0.02322
> EndTime: 23.2664 Size: 1024 BeginTime 0.0464399
> EndTime: 23.2896 Size: 1024 BeginTime 0.0696599
>
>
> James
>
>
> */Xavier Amatriain <xamat at iua.upf.edu>/* wrote:
>
> That is weird indeed but I can't see the bug by looking at the
> code. It
> is clear that BeginTime is set incorrectly for the first audio.
> Can you
> print both GetSize() and GetBeginTime() for all chunks?
>
> Bad Data wrote:
> > I've starting to work with CLAM and have come across something
> that I
> > don't understand. I started with the FilePlayback_example.cxx to
> get a
> > basic idea how Audio is worked with. I changed the main loop of the
> > program around to see what can be done with the Audio class, during
> > one such test I did the following:
> >
> > while( reader.Do( incomingAudioChannels ) )
> > {
> > count += incomingAudioChannels[0].GetSize();
> > time += incomingAudioChannels[0].GetDuration();
> >
> > for ( int i = 0; i < audioOutputs.Size(); i++ ){
> > audioOutputs[i].Do( incomingAudioChannels[i] );
> > }
> > std::cout << "Durr: " <<
> > incomingAudioChannels[0].GetEndTime() << "\n"; // I added this line.
> > }
> >
> >
> > when I compile and run this program the first few lines output to
> > stdout are:
> > audioMixer examples # ./FilePlayback_example blue_serge.wav
> > Durr: 23.22
> > Durr: 23.2432
> > Durr: 23.2664
> > Durr: 23.2896
> > Durr: 23.3128
> > Durr: 23.3361
> > Durr: 23.3593
> >
> >
> > Shouldn't the first line be 0.002322 and aren't the subsequent
> lines
> > off by 23.22?
> > It's my understanding that GetEndTime() returns the end time of the
> > audio in ms, and that the first chunk is only 1024 samples long.
> Am I
> > misunderstanding the correct use?
> >
> >
> > James
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
> > Get your own web address.
> >
> > Have a HUGE year through Yahoo! Small Business.
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > CLAM mailing list
> > CLAM at iua.upf.es
> > http://www.iua.upf.es/mtg/clam
>
>
> ------------------------------------------------------------------------
> TV dinner still cooling?
> Check out "Tonight's Picks"
> <http://us.rd.yahoo.com/evt=49979/*http://tv.yahoo.com/> on Yahoo! TV.
> ------------------------------------------------------------------------
>
> _______________________________________________
> CLAM mailing list
> CLAM at iua.upf.es
> http://www.iua.upf.es/mtg/clam
More information about the clam-devel
mailing list