[directmusic] Re: MP3 encoded wav tracks, a pain in the neck..

  • From: "Jason Booth" <jason@xxxxxxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Tue, 7 Jan 2003 11:49:07 -0500

        I originally figured it was something to do with my codec. So I
installed sound forge on a newly built win2k box, which has only had a
small amount of server software installed. Same problem. I've tried
encoding in several different programs, and encoded with 3 different
machines, all with the same result. I also went to microsofts site and
downloaded all the latest audio codecs, with the same results.

        However, doing a bit of math last night, I was able to come up
with something "close" to a correct offset, and padded all my waveforms
and offsets accourdingly. I've got the project up and running correctly,
but I'm beginning to think that writing my own music system may be
better than trying to do this in Direct Music, simply because of the way
DMP handles things:

        - Right now my total audio is about 300megs of wav files
        - The idea is for the system to choose a primary segment based
on location
                - this primary segment is aproximately a 16bar wav
encoded mp3, with about 20 variations
        - A second track, our "danger groove", is layered over this
based on groove level
                - this is a 1 or 2 bar, uncompressed wav with few
variations, but about 20 groove levels
                - I will have to re-impliment groove levels in script
code because they aren't supported on wav tracks

        Now, I've been compressing the data outside of DMP simply
because it's faster than waiting for it in DMP, file by file. I can
batch process everything and be done with it.
        However, when loading them into DMP, I've noticed they are saved
as un-compressed again, and compress on run-time saves. This not only
means it's compressing them twice, but that run-time saving takes
upwards of several hours. Hmm... Perhaps I can get around this by only
runtime saving the files I need (since most of the files are just audio
wavs).
        Additionally, DMP insists on keeping all of this in memory,
which takes upwards of 600megs of ram. And the piece isn't close to done
yet - so loading the project into DMP takes FOREVER, and consumes a ton
of memory - this seems to be causing a lot of glitching in DMP as well..

        Which leads me to believe that it might be faster, easier, and
simpler to write our own music system than to use DMP for our next
project. While DM provides all the functionality we need and we have the
system up and running, the headache of working with DMP, and the sheer
load and save times, are simply too much to bear.

        Anyway, I'm going to keep banging at it and see if I can come up
with something that'll make it more useable, but some of these problems
I don't think I'll be able to get around (load times, memory usage). I'm
also interested to see how this works at run-time, as it should,
theoretically, use very little memory and cpu (although I've seem my CPU
usage very greatly in DMP, for no apparent reason).





-----Original Message-----
From: Scott Morgan [mailto:scott@xxxxxxxxxxxxxxxxx]=20
Sent: Monday, January 06, 2003 9:50 PM
To: directmusic@xxxxxxxxxxxxx
Subject: [directmusic] Re: MP3 encoded wav tracks, a pain in the neck..



I don't think I've ever heard the problem with the gap in audio 2 secs
in. I've encoded a lot of MP3 files.  I have noticed that different apps
and sometimes different versions of the same app have unique behaviors
in how they encode stuff.  Maybe there is a problem with the encoder app
you are using?

I did test the mp3 functionality in DX9 before I left MS and I remember
it being Ok..just with the annoyance of having to set the decompressed
start on the samples.

-Scott Morgan
http://Morganstudios.com


----- Original Message -----
From: "Jason Booth" <jason@xxxxxxxxxxxxxxxx>
To: <directmusic@xxxxxxxxxxxxx>
Sent: Monday, January 06, 2003 1:01 PM
Subject: [directmusic] MP3 encoded wav tracks, a pain in the neck..


>
>
> So my experience with MP3 encoded wav tracks continues:
>
> - I've verified on 3 computers (one running 2k, one running 2kserver,=20
> and one running XP) that the compression codec used in MP3 encoded=20
> wavs has some huge and obvious errors. The main one being a small but=20
> very audable gap in the audio placed about 2 seconds into every=20
> file.=3D20
>
> Also, the encoder doesn't seem to be included natively on winXP=20
> machines, which is extremely annoying considering this is the only way

> to deliver MP3 based playback with Direct Music. (note that the=20
> decoder is present).
>
> This combined with the offset errors makes working with mp3 encoded=20
> wav tracks within direct music a real pain in the arse. My workaround=20
> is as follows:
>
>
> - Save the original track, record it's play time and sample count
>
> - Add a 2.1 second sine wav to the beginning of the track
>
> - compress the file as a wav-encoded MP3 using a third party program
>
> - Load the file into Direct Music, record it's play time and sample=20
> count
>
> - Subtract the difference between the new sample count and the=20
> original files sample count to find the offset
>
> - quickly realize that the max offset is about 37000 samples, far less

> than 2 seconds
>
> - Subtrack the time difference and use this to offset the wav file in=20
> the segment
>
> - visually check the file to make sure that the sine wav isn't present

> in the segment file, and hope the offset is accurate to not cause=20
> drift over time..
>
>
>
> I have a feeling that this still won't be accurate, simply because the

> time scale (in seconds.000) isn't going to be sample accurate.=20
> Somehow, I'll need to convert the time scale offset into sample=20
> counts, then see what the difference between the resulting sample=20
> count and my correct offset is, and use both offsets (time + samples)=20
> in direct music to get the correct offset.. Also, Direct Music reports

> the mp3 encoded wav as being a slightly different number of samples=20
> than Sound Forge does, which makes me wonder which count is correct.
>
>
> Now I have to ask the really annoying end user question: Did anyone=20
> actually try to use MP3 encoded wavs for anything even close to a real

> project before they shipped Direct X 9? I can't believe how convoluded

> this process is, or that anyone used MP3 encoded wavs without noticing

> the gap it places in every file 2 seconds into the stream.
>
>
>
>



Other related posts: