0
0

been all over the net but I can’t find a single reference of code/doc that tells me how to give this infomation to the .wav header.

of course I am asuming here that it is a flag or something ๐Ÿ˜ณ ๐Ÿ˜ฎ sorry just love those smiles. :) ๐Ÿ˜†

Here is the bit of code I am working with at the moment, don’t worry if your replys are in C I can read those. :) thanks.

[code:35vy8gm0]
Debug(FSOUND_Sample_Lock(smplist()\ptr,0,smplist()\size,@ptr1,@ptr2,@len1,@len2))
Debug("Ptr1 "+Str(ptr1))
Debug("Ptr2 "+Str(ptr2))
Debug("Len1 "+Str(len1))
Debug("Len2 "+Str(len2))
DeleteFile("DUMPTEST.wav")
OpenFile(0,"DUMPTEST.wav")
WriteString("RIFF")
WriteLong((len1-8)) ; size of file -8 bytes for header
WriteString("WAVE")
WriteString("fmt ")
WriteLong(16) ; size of fmt chunk, 16 bytes

            ;   For PCM based samples, data must be signed 8 or 16bit. 
            ;   For compressed samples such as those created with FSOUND_XADPCM,
            ;   FSOUND_VAG, FSOUND_GCADPCM, the data must be in its original compressed format.


            WriteWord(1)                                ; Compression code (Microsoft ADPCM)
            chan=smplist()\_channels                    ; Number of channels
            WriteWord(chan)
            Debug("Channels "+Str(chan))
            samrate=smplist()\deffreq                   ; Sample rate
            WriteLong(samrate)
            Debug("Rate "+Str(samrate))

            BlockAlign=smplist()\_bits/8*chan           ;2 Block align
            Debug("BlockAlign "+Str(BlockAlign))
            AvgBytesPerSec = samrate * BlockAlign       ;4 Average bytes per second
            WriteLong(AvgBytesPerSec)
            Debug("AvgBytesPerSec "+Str(AvgBytesPerSec))

            WriteWord(BlockAlign)                      
            WriteWord(smplist()\_bits)                  ;2 Significant bits per sample
            Debug("Bits "+Str(smplist()\_bits))

            ;WriteWord(0)                               ;2 Extra format bytes

            WriteString("data")
            WriteLong(len1)
            WriteData(ptr1,len1)
        CloseFile(0)

        Debug(FSOUND_Sample_Unlock(smplist()\ptr,@ptr1,@ptr2,len1,len2))

[/code:35vy8gm0]

  • You must to post comments
0
0

??

When the compression code is 1 for ADPCM the data HAS TO BE signed, you don’t have to tell it again in the header.
You cannot make it unsigned with this compression code – no other program than yours could read your data then.

Here’s my favourite WAV-page :
http://www.sonicspot.com/guide/wavefiles.html

Or did I misunderstood you ?

  • You must to post comments
0
0

Yes indeed the comment is wrong :)

-however- the output data, probably should have posted this before hand is this; I’m testing my sample out with ModPlug Tracker / Skale Tracker.

1000 ; Compression

0000 ;(1000) Number of channels ( this should be 1, but MPT says this is an unknown file format. (1=Mono) I asume.

44AC0000 ; Sample rate
44AC0000 ; Average bytes per second
0100 ; Block align
0800 ; Significant bits per sample

fig.1
[img:1md4ya09]http://www.inet.net.nz/~tjr/irc/fig1.jpg[/img:1md4ya09]
This is how my data looks, I’m guessing this is because MPT or another application is thinking that the data is unsigned.

[img:1md4ya09]http://www.inet.net.nz/~tjr/irc/fig2.jpg[/img:1md4ya09]
This is how it is supposed to look.

[quote:1md4ya09]
Here’s my favourite WAV-page :
http://www.sonicspot.com/guide/wavefiles.html
[/quote:1md4ya09]

Have just discover that 16-Bit samples save perfectly fine, it’s just the 8-Bit samples I am having trouble with, [and later still discovers the following] if I save the 8-bit sample data as a 16 bit it works too, is this even proper ? ๐Ÿ˜† :roll:

And of course I am asuming that this data is going to stay constant on me, that it won’t matter if the mod uses an IFF/Voc/XI or Wav, I hope so or I am really in trouble, because that digs to the way over my head area.

Another thing I thought of was converting the data from signed to unsigned, is this really nessary or am I clutching at straws looking for another way around.

Hehee found that in searching the forum, that is how I got this far actually, and quite likely dug myself this hole.

  • You must to post comments
0
0

aha! worked… thank you lots ๐Ÿ˜€ :) ๐Ÿ˜‰

Now to add all the rest of the infomation :)

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.