Jump to content
  • Advertisement
Sign in to follow this  
Evil Steve

Unity WAV files and sampler chunks

This topic is 2599 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm trying to add a loop point to a WAV file so I can run it through one of the Nintendo DS tools to convert it into a usable format. That's done by adding a sampler ("smpl") chunk to the wave file. I've written a tool to add sampler chunks myself, and it's worked fine up till now - I think that was just luck. Now when I try to run this WAV file through my tool, I get the oh-so-helpful error message: "waveconv: Unexpected exception" (And that's after I turned on "verbose" mode, grr). So, is there something fancy I need to do to add a sampler chunk to a wave file? Here's the code I currently have:
#pragma pack(push, 1)
struct SamplerChunk
{
	DWORD chunkID;			// 'smpl'
	long chunkSize;

	long dwManufacturer;
	long dwProduct;
	long dwSamplePeriod;
	long dwMIDIUnityNote;
	long dwMIDIPitchFraction;
	long dwSMPTEFormat;
	long dwSMPTEOffset;
	long cSampleLoops;
	long cbSamplerData;

	// Sample loop data
	long dwIdentifier;
	long dwType;
	long dwStart;
	long dwEnd;
	long dwFraction;
	long dwPlayCount;
};
#pragma pack(pop)

// Snip...
// Write sample chunk
SamplerChunk theChunk;
ZeroMemory(&theChunk, sizeof(theChunk));
theChunk.chunkID = s_dwSmplChunkHeader;
theChunk.chunkSize = sizeof(theChunk) - 8;
theChunk.dwSamplePeriod = (DWORD)(1000000000.0 / (double)format.nSamplesPerSec);
theChunk.dwMIDIUnityNote = 60;
theChunk.cSampleLoops = 1;

// Set loop point
theChunk.dwStart = 0;
theChunk.dwEnd = dwDataSize-1;


I assume that something has to be a multiple of something else, but I don't know what. I've had a look at various sites and not found anything relevant on any sites. Alternatively, can anyone recommend a free program I can use to add a loop point to a wave file and export a sampler chunk? I'm not sure what forum this should go in either (Since Music and Sound is under "The creative side"), so I've just bunged it here. Mods, feel free to move it if you think it belongs somewhere else. Cheers, Steve

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Did you find any solution for that?
Because I'm looking for the same thing : a software that could add the sampler chunk for me.
Else, do anybody has an answer?

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!