I’ve discovered how to edit the WAV samples to modify the volume, and succeeded in converting an MP3 to WAV.
Now the next problem: ensuring that I can process any sound file and capture its samples, but making sure the samples are always formatted the same way from one input file to the next.
For example, the MP3 I put through the decoding process, using FSOUND_SampleLock, gave a stereo 16-bit audio file, which I could convert to WAV.
But putting an 8-bit monaural WAV through the same process gave 8-bit samples, with the high-order bit of each byte flipped.
How can I force FMOD to deliver similar samples from FSOUND_SampleLock with whatever audio format it’s reading?
[quote:3miyhts1]you want 8bit samples to be stored as 16bit? thats a bit of a waste of memory isnt it?[/quote:3miyhts1]
Actually, what I want is consistency. I might be stringing the samples produced from a number of input files in various formats to produce my WAV. If I can get away with 8-bit and the result doesn’t sound lousy, so much the better.
From my thread, “Mixing WAVs in Memory” in the other forum, you probably know that I’ve found a DSP callback to be effective.
[quote:25r5bvl2]saving memory is more important than consistancy[/quote:25r5bvl2]
Not for me. I can’t string these sounds into a WAV that’s half 8-bit and half 16-bit.
Remember, my task is to produce a single WAV by concatenating the samples from a number of inputs with different formats.
[quote:25r5bvl2].. if you want to use extra memory you can convert it yourself.[/quote:25r5bvl2]
Why go to the trouble when fmod will do it for me?
Seriously, if I can take a 16-bit input and produce an 8-bit output, that’ll be fine. I don’t know how to get the samples delivered by DSP_Callback to be 8-bit; can that be done, or would I have to convert it myself?
Anyway, by now it should be clear that SampleLock is not the way to go. DSP_Callback gives me the samples from various input formats in a consistent manner, and that’s what I’m using. There’s nothing more to add to this thread–except the answer to the question at the end of the previous paragraph.
Actually, after giving a good look at the code to convert one format to another, it looks like I could convert another format, or WAV itself, to WAV, but cut it off after sampling and writing the desired length, figuring the number of bytes can be determined from the average bytes per second.
The requirement is to add the WAV to an AVI I’m creating. Callbacks to alter volume won’t do, since the AVI is out of my hands.
I don’t know if the conversion to WAV could be done with the output of the sound as it plays, but this wouldn’t be desirable: we wouldn’t want to wait while that happens. Better would be to adjust the volume as the WAV stream is written, but I haven’t the foggiest idea how, or if it’s even possible. I could live without it, I suppose.
Please login first to submit.