realbasic-nug
[Top] [All Lists]

Re: MoviePlayer and MP3 audio sample rates

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: MoviePlayer and MP3 audio sample rates
From: "E. Tejkowski" <lists at sonicamigos dot com>
Date: Fri, 31 Mar 2006 23:28:38 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <f06230900c05361609056 at [192 dot 168 dot 1 dot 11]> <7DD02BB1-2390-47A1-96EB-8B5D4400BD3F at sonicamigos dot com> <f06230900c053ab17d6f9 at [192 dot 168 dot 1 dot 11]>
I see. Well, it sounds like you're on the right path to me. Could the compression possibly be a factor? I'm doubtful that QuickTime (and/or REALbasic) would be playing the audio at some strange sample rate like you mentioned earlier. And, since you are doing all the heavy lifting with declares, it sounds like all you're really getting from RB is a handle to a movie. This makes me think that this is a QuickTime question. (unless you have a mistake in your header length calculations or something) Might still be worth a try to ask on the QuickTime lists. I've found that if you provide sample code (even pseudo code), you're more likely to get a response on that list.

Best of luck,
Erick

On Mar 31, 2006, at 10:18 PM, Jeffrey Mattox wrote:

I'm not getting the length of the file, but rather the number of samples in the audio. After calling the (modified) GetWaveformInfo () function in Addey's routine (which loads the samples into a MemoryBlock), I do this:

   Dim samples as Integer
samples = (SoundMemoryBlock.Size - 84 ) / 2 // number of 16-bit samples

I've modified GetWaveformInfo() to return 16-bit samples instead of 8-bit samples. For 8-bit samples, I believe it's this:

   samples = SoundMemoryBlock.Size - 42 // number of 8-bit samples

(but it might be minus 84 to skip the header, I forget.)

I also sanity check my result by taking the duration of the track and multiply by the sample rate, as in:

   Dim theSongDuration as Integer
   Dim theMovieTimeScale as Integer
   theSongDuration = GetMovieDuration(me.Movie.Handle) ' scaled
   theMovieTimeScale = GetMovieTimeScale(me.movie.Handle)
   g_theSongDuration_sec = theSongDuration / theMovieTimeScale

   Dim samples as Integer
   samples = theSongDuration * SoundSampleRate
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>