pouët.net

4k and gm.dls

category: general [glöplog]
hi all! after a talk with graga about 4k music i got enthousiastic again so decided to have a go at it, just for kicks!

as such, here's some noob questions for those 4k coders doing the gm.dls hack:
do you guys all make smooth resampler code and put it in the intro? if so, how do you get it smooth but small? if not, is there a trick? or does everyone just send midi notes? if so, does that time well with generated waveforms (i.e. playsound)?
added on the 2008-07-10 23:15:45 by skrebbel skrebbel
Nothing times well with PlaySound. Use WaveOut.
added on the 2008-07-10 23:36:07 by Blueberry Blueberry
My player is a waveout based, not realtime, sample remixer. It's all around 400. It does sound loading (from gm.dls), song decoding, resampling (with linear interpolation), mixing and some stupid effects. It all happens in fixed point (it was smaller this way), the C code fits in two "pagedowns".
added on the 2008-07-10 23:36:34 by iq iq
With the exception of gm.dls support (yet), mine is the same as iq's (from this thread's standpoint).
added on the 2008-07-10 23:49:25 by ferris ferris
amazing stuff :)
added on the 2008-07-11 00:24:06 by rc55 rc55
Check it.
added on the 2008-07-11 00:28:27 by xernobyl xernobyl
ohyeah that was another question - what the hell is the point of that tool, other than being able to preview (and get offsets for) about half of the sounds in gm.dls? i don't get the point of the envelope thing - why would i want to apply an envelope to those wavs before i save them? how does that help a 4k coder OR a musician?

iq, thanks for the note, it's good to know what i should be aiming for. you hid your OpenFile trick well on in4k btw! (and thanks)
added on the 2008-07-11 07:23:16 by skrebbel skrebbel
on glitterati (the only 4k intro where ive used gm.dls) i basically used the sample data as a replacement for oscillators, and then did all the filters+fx on them as i would in a softsynth.
the gm.dls sounds arent brilliant :) there's a few usable ones, but they often need a lot of fx on top to sound decent - so you still need quite a lot of code.
added on the 2008-07-11 09:52:54 by smash smash
smash: Great to hear about that - we've been thinking about using the gm.dls sounds in a similar way (with a lot of postprocessing). The sound in glitterati is great, maybe we should try out that "trick" soon ;)
added on the 2008-07-11 09:56:13 by Puryx Puryx
u r wellcome. I can only add content in in4k in my user section, it's now up to them to move the article to the main "Sound" section, not me :|
added on the 2008-07-11 09:56:15 by iq iq
puryx: yea, the only problem is in 4k it seemed like i had to make the decision to use either gm.dls or oscillators, and some things are annoying to do with gm.dls. :) so it comes down to a stylistic choice i guess.
added on the 2008-07-11 10:00:12 by smash smash
smash: that was our idea as well - at least it will leave with more creative freedom when getting ideas around the theme of a 4k intro. Oh, and drums (except the kick) almost always sounds crap in a normal 4k synth :) - I would like to make some 4k music with "real" drums
added on the 2008-07-11 10:02:45 by Puryx Puryx
... well - at least it will leave + us ...
added on the 2008-07-11 10:03:29 by Puryx Puryx
iq; ahhh arghh, they still have all those pages locked?? fair enough then :)

puryx, i've only found a tiny few decent drums in gm.dls btw
added on the 2008-07-11 10:49:07 by skrebbel skrebbel
i dont think gm.dls gives you a major benefit concerning filesize, at least not if you want good sound.

basically you can replace your wave generator with a wave player. but without filters, distortions, delays it will just sound crappy and boring.
and if you add these modules and additionally want modulations of parameters via envelopes and lfos you basically have the same amount of code as for a complete softsynth iin the end (you save a few bytes of instrument definition data though).

apart from the fact that you get the usual sample playback issues like:
- always having the waves envelope/articulation included
- the usual pitching problems/artifacts
- more or less noticable looping of waves
- only 22khz sample rate

i used gm.dls for sprite-o-mat and decided afterwards to code a 4k softsynth from scratch. it's not an easy task to get it small, flexible and good sounding and took quite some time. but afterall it was fun :)

anyway, its fair enough to use gm.dls. and especially if you only do plain sample playback the code will be very tiny (and better crappy sound than none). but everything you do to enrich the sound to a level it doesnt sound crappy anymore takes you one step closer to the size of a real softsynth.
added on the 2008-07-11 13:18:30 by gopher gopher

by the way, if youve got the bytes for it you can get the location of gm.dls using:
SHGetValue(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic", "GMFilePath", 0,regKeyValue,&bufferSize );

which is probably the "best" way. maybe keep it for the compatible version. :)

gopher: youre right, thats exactly what i found too. it's not a free "make my 4k sound great" magic trick. :) and thats why i used a regular synth for my other 4ks.
added on the 2008-07-11 13:22:06 by smash smash
wait a minute - i haven't attempted to figure it out myself yet so.. are *all* waves in gm.dls exactly 22050 khz?

smash, ahh nice one! then again, i'm also quite flattered by iq's solution in case you hadnt seen it yet.

smash/gopher: i agree that the instruments in gm.dls aren't all that cool. however, it has e.g. some snaredrums that aren't awesome but still better than anything anyone except loaderror could reasonably synthesize, imho (not sure why those drums don't show up in blackpawn's tool though). with some simple effects on top, i believe those could turn out reasonably cool, definitely better than the standard "kick+noise" recipe.
added on the 2008-07-11 13:47:21 by skrebbel skrebbel
i would never have found this in4k page without you linking to it, thx
Quote:
wait a minute - i haven't attempted to figure it out myself yet so.. are *all* waves in gm.dls exactly 22050 khz?

iirc, yes

especially some drum sounds can be useful, agreed, but e.g. the basedrum is quite weak in gm.dls, thats why i added a synth base over that when i used it. and as you said, its not so easy to synthesize good drum sounds, but its rather a question of how flexible your synth and and how good your musician is ;)

just use whatever you feel comfortable with :)
added on the 2008-07-11 14:17:05 by gopher gopher
well i'm the musician too so that should help, productivity wise :)

thanks for the info guys!! i'll be refurbishing this thread if i start sucking again :)
added on the 2008-07-11 18:02:25 by skrebbel skrebbel
By the way, what are some common filters that are good to code for 4k's? Right now all I have in mine is a simple echo (which just does a simple operation like bufferpointer+offset = clip(bufferpointer+offset + bufferpointer+currentpoint*attenuation) for each buffer point).
added on the 2008-07-12 12:45:13 by ferris ferris
And BTW skrebbel, envelopes eliminate sudden frequency/amplitude changes which cause ugly sounding pops or clicks in the sound.
added on the 2008-07-12 12:47:53 by ferris ferris
ferris:
common filters/units in a 4k synth:

- resonant multimode filter supporting lowpass, highpass and bandpass (or even bandstop, peak, allpass)
- distortion (e.g. via atan), may also support sample&hold

both should be possible in < 50 byte compressed

the delay line can also be extended to support chorus/flanger if you add a lfo to it.
added on the 2008-07-13 00:03:14 by gopher gopher
ferris, for filters try:

// init
float l=0, b=0, h=0;
float freq, reso; // <- set both between 0 and 1

// per sample:
l+=freq*b;
h=in-(reso*b)-l;
b+=freq*h;

l, b and h are the outputs for lowpass, bandpass and highpass respectively. You can add l+h to get a bandstop filter or all three to get an allpass.
added on the 2008-07-13 00:44:40 by kb_ kb_
Here is nice link for sound filters...
added on the 2008-07-13 01:05:40 by Tigrou Tigrou

login