gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > Krawall Wav to S3M conversion

#62749 - hobby16 - Mon Dec 05, 2005 12:31 pm

Hi all,
I try to use Krawall to play music and vocal messages (sound playing with HAM is buggy!).

I don't know how to do, unless I can convert wav to S3M format.
Can anyone help me.
Many thanks in advance.

#62782 - DekuTree64 - Mon Dec 05, 2005 6:51 pm

That would be a task worthy of writing a PhD thesis on. Even then I doubt anyone could reliably separate more than a few simple instruments from eachother.

You pretty much have to rewrite a song from scratch if you want to convert from wav/mp3 type formats to note-based formats like mod and midi. MODPlug Tracker is good for writing tracked music. Finding/making good instrument samples can be difficult though. Maybe try doing some chiptunes for starters :)
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#62784 - kusma - Mon Dec 05, 2005 7:00 pm

i have a feeling he's after something that krawalls converter eats, so he can get sound-effect samples into krawall. the way you'd do that, is by using something like modplug tracker to assemble an s3m with only samples (no pattern-data) and just feed that to the converter.

#62808 - gauauu - Tue Dec 06, 2005 2:33 am

If you just want to play a short clip from a wav file, use modplug tracker to create a new s3m file. In the samples tab, click the "import sample" button, and import the wav file into the s3m.

Then, you can either save the s3m and use the sample as a krawall SFX, or you can create a pattern in the s3m using that sample once, and play it as music in krawall.

When you do, make sure you give the sample a nice simple name, so you can refer to it from your C code without having problems.

#62852 - hobby16 - Tue Dec 06, 2005 1:27 pm

gauauu wrote:

Then, you can either save the s3m and use the sample as a krawall SFX, or you can create a pattern in the s3m using that sample once, and play it as music in krawall.

Hi gauauu,
thanks for your reply. Maybe I 'm near the solution :
Create my new S3M file : ok
Imported my wav : ok
Save my S3M: ok
Make my gba with the exported S3M by typing "make" => got this message "empty file!!! (sfx?)"


I must misunderstand your statement in bold!
Can you plz give more details (I newbie to Modplug Tracker)

#62862 - gauauu - Tue Dec 06, 2005 3:52 pm

typing "make" depends on there being a makefile to use. I don't know much about ham's make system, but generally, make is a tool that that follow commands you give it to compile things. But you still have to specify how things are compiled.

For S3Ms and krawall, the free krawall distribution comes with a program called "converter.exe"....you run that from a command prompt with the name of the directory that has your s3m. If all goes well, it will spit out some .h and .s files. The .h files can be included into your C project to access the data in the .s files. The .s files need to be assembled using an assembler (if you are using the gcc toolchain from devkit-whichever, you can use AS from the command prompt...you'll maybe want to pass in the -mthumb-interwork parameter also).

Once you've gotten .o files from assembling the .s files, you can link with your .o files and use the krawall functions with your sound effects.

For a simple wav sound, I wouldn't bother with the "create a pattern in the s3m" step. It's really not necessary. But basically what it means....an s3m is a format that takes a bunch of "samples" (wav files, sound effects, etc), and sequences them, at differnet pitches, over and over, to build a song. For example, you might have a sample of a piano key, and a snare drum. With that piano key, you would sequence it to play at different times and frequencies, and with the snare drum behind it, to build your song. But if you just want to play a wav file, you don't need to sequence the whole song out of it.

#62863 - hobby16 - Tue Dec 06, 2005 4:03 pm

gauauu wrote:
typing "make" depends on there being a makefile to use. I don't know much about ham's make system, but generally, make is a tool that that follow commands you give it to compile things. But you still have to specify how things are compiled.


Yeah, the "make" I told about uses converter.exe. It works on the sample S3M BUT not on the S3M exported by Modplug.

The problem is not from my compilation chain but from the Modplug usage :
HOW to convert a wav to S3M with Modplug. I cannot produce a usable S3M file ;-(

#62868 - hobby16 - Tue Dec 06, 2005 4:53 pm

Some news :
I use modplug player to load a WAV file and save as S3M file. This S3M is playable with a windows player.
And now, my S3M is correctly converted and included by my tool chain to produce a GBA exec.

But when playing it, NO SOUND. What a hell !
I wonder if it is outright possible to play a wav file with Krawall (in my case, making my GBA speaking some voices).

#62874 - thegamefreak0134 - Tue Dec 06, 2005 5:38 pm

When it says "empty file (sfx?)" that's telling you that your file has no patterns in it. If you're importing a file for SFX, this is actually the exact message you want. Then, you look at the resulting samples.h and use that name in a SFX call to play the sound. All patternless files return this message from the converter.

If you have patterns in the file, then you're having errors.
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#62882 - hobby16 - Tue Dec 06, 2005 6:38 pm

thegamefreak0134 wrote:
...

Sorry, I don't understand.

Please, see my 3:53 pm message.
My problem is from my WAV to S3M conversion. Not from my compilation suite (or so I think).

#62947 - gauauu - Wed Dec 07, 2005 3:04 am

Ok, see above, where I explain about building a song using the "samples"...that is generally how S3M's are constructed. So if you have samples loaded into your S3M, but have not defined a pattern, then it will be an "empty" S3M, and players like winamp, etc, won't play anything.

BUT Krawall has 2 different ways of handling S3M data...you can play the S3M (using krapPlay()), which will play the same thing that winamp or media player will play when playing the S3M. Or, Krawall is smart enough to extract just the samples from the S3M, and can play them by themselves, using kramPlay().

So probably, you are using krapPlay to play the S3M, but since you didn't define a pattern for playing your samples, it is correctly playing nothing.

If you just want it to play the sample directly, use kramPlay(), and pass it the address of the sample, not the address of the song. Also, like I mentioned before, make sure to give your samples a simple name in the S3M file. If the name is blank or has weird characters, Krawall won't always give you a nice pointer for it.

#62948 - gauauu - Wed Dec 07, 2005 3:07 am

One more thing. Make sure your WAV file is an 8-bit PCM. S3M's can use all sorts of types of wavs, but Krawall can't.

To convert your PCM, you can use something like Switch[/url]

#62971 - hobby16 - Wed Dec 07, 2005 10:50 am

gauauu wrote:
One more thing. Make sure your WAV file is an 8-bit PCM. S3M's can use all sorts of types of wavs, but Krawall can't.

To convert your PCM, you can use something like Switch[/url]


Yeah, that's it, my wav is in 16-bit format. When converted to 8 bit, all is correct NOW. Thank you very much !!!

#63015 - hobby16 - Wed Dec 07, 2005 9:18 pm

I still have a problem : I can't play a stereo wav file.
When importing the wav as "samples" in my S3M file, I see the 2 channels of the sample.
But when playing the S3M with Modplug Player, only the LEFT vue-meters is active.

And when playing with Krawall, the sound is mono.

I am near the end! Can anyone help me ?

#63016 - kusma - Wed Dec 07, 2005 9:28 pm

I'm guessing that krawall only support mono-samples (let's face it, noone does), and that you'd have to split it into two samples and play both at a different pan. either that, or just mix both channels togeither.

#63019 - hobby16 - Wed Dec 07, 2005 10:35 pm

kusma wrote:
I'm guessing that krawall only support mono-samples (let's face it, noone does), and that you'd have to split it into two samples and play both at a different pan. either that, or just mix both channels togeither.


What do you mean by different "pan" ? And how do you split a stereo file as 2 mono files ?

BTW, to mix both channels, I just need to export my sound as a mono WAV (but I want my stereo sound !).

#63021 - keldon - Wed Dec 07, 2005 10:41 pm

Pan decides 'where' the sound is positioned to the ear. Something panned fully left only appears in the left ear. A sound can be panned to the middle where it is heard equally in both ears.

#63101 - thegamefreak0134 - Thu Dec 08, 2005 6:16 pm

There are tools that can separate the audio into separrate channels for you. (I think audacity can do it, but I'm not sure.) As for playing them in Krawall, look in the docs. There are two commands for playing sounds: One for easy use and one that supports different parameters. One of them is panning! Simply play the left channel panned to the left all the way and the right channel panned all the way to the right. Make sure to play them both at the same time r it will sound bad.

Also, Krawall doesn't like panning out less than all the way. It will do it, but the time required to calculate such a pan is much greater, so just avoid it if possible, unless of course you have the CPU time to spare. The easiest way to figure out the whole CPU time thing is if your sounds are "skipping".
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]