Author Topic: Music code and tools..at what sizes?  (Read 8817 times)

0 Members and 1 Guest are viewing this topic.

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Music code and tools..at what sizes?
« on: January 12, 2007 »
OK I'd like to hear opinions about what music libs, tools and methods to use at what sizes. For example: 4k, 64k, intro, no restriction

eg I see fmod.dll is used a lot at 64k, so how do you compose a 64k tune? What tools? What are the restrictions?

eg 4k can directmusic be used or is it too byte hungry?

Also Im interested what tools and libs people use to do chip tunes FOR PCs. How is the music done in these cracktros I see?

Thanks for any comments and opinions in advance.
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Music code and tools..at what sizes?
« Reply #1 on: January 13, 2007 »
4k intros - you will need a tiny softsynth or use MIDI music instead.
64K/intros - a good softsynth (eg V2), or you can try uFmod or  minifmod 1.7 , both libs are capable to play .xm files
Demos - For a best sound quality you can use fmod.dll or bass.dll, they are capable to play lots of music formats.

Quote
Also Im interested what tools and libs people use to do chip tunes FOR PCs. How is the music done in these cracktros I see?
People use music trackers, here some good trackers that I know:
http://www.pouet.net/prod.php?which=20929
http://www.pouet.net/prod.php?which=20494

If you have some trouble using those library (ufmod or minifmod) I can provide an example code for you (C/C++).



« Last Edit: January 13, 2007 by rbraz »
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #2 on: January 13, 2007 »
To play wavs and mp3s with a tiny amount of code you can do
Code: [Select]
mciSendString("open c:\\tune.wav type waveaudio alias tune", NULL, 0,0);
mciSendString("play tune from 0", NULL, 0,0);

Mikmod is another very portable multiformat mod player.  The AHX player is also very small.

Jim
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #3 on: January 13, 2007 »
Well first thanks for all the advice. I also talked to a musician (Strobe, just registered here - wave - hi mate) about what system to use in the intro category and they preferred xm and bass. So I downloaded bassmod.dll.

And here is the bugger, from learning what the musician wanted to having a working compiled example was 1 hour. When I was doing my 4ks, it took me 3 months of hard work to do my own softsynth, tools (really saida did these) and optimisation. Its *that* much easier to do intros than to do 4ks!!

Holy cow, I was amazed and of course the sound quality is *way* higher.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Music code and tools..at what sizes?
« Reply #4 on: January 13, 2007 »
So you've finally got the intro bug Taj? :) And I was looking forward to drawing you some 4 colour bitmap logos for your 4kbs... Never mind.  :D
Shockwave ^ Codigos
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Music code and tools..at what sizes?
« Reply #5 on: January 23, 2007 »
To play wavs and mp3s with a tiny amount of code you can do
Code: [Select]
mciSendString("open c:\\tune.wav type waveaudio alias tune", NULL, 0,0);
mciSendString("play tune from 0", NULL, 0,0);

You can do it smaller and more easy! You dont need any MCI commands... why not just this way? :) You can generate any wave data in memory and just play it with the API command sndPlaySound() ? :)

Code: [Select]
szFile.c = "GreetzFromVa!n.wav"
sndPlaySound (@szFile.c,#SND_SYNC)
Sleep(1000)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #6 on: January 23, 2007 »
Can that API play MP3?  But you're right, I'd totally forgotten about the snd*() API.  Thanks!
There's also a non-string version of MCI that uses data structures and constant ints for the commands mciSendCommand() which saves storing all the string data.

Jim
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Music code and tools..at what sizes?
« Reply #7 on: January 25, 2007 »
Can that API play MP3?  But you're right, I'd totally forgotten about the snd*() API.  Thanks!
There's also a non-string version of MCI that uses data structures and constant ints for the commands mciSendCommand() which saves storing all the string data.

No, the API call sndPlaySound() plays only waves... so this API call would be a nice small solution esp. for playing generated wavessounds. The API dont support any MP3 format. (I will see a 4k with mp3 *rofl* just joking...)

Btw, threre are some other API calls you could use for playing sound in 4k... and i dont mean this MCI related stuff... ^^
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #8 on: January 26, 2007 »
:D  mp3 in 4k is up for grabs!

Other APIs are waveOut and DirectSound I suppose?

Jim
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Music code and tools..at what sizes?
« Reply #9 on: January 26, 2007 »
:D  mp3 in 4k is up for grabs!

Other APIs are waveOut and DirectSound I suppose?

Jim


Yup. DirectSound is definately a chioce as far as I know. Maybe you have a
read on this article ( this is part III ) :

http://www.kebby.org/articles/fr08snd3.html
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #10 on: January 26, 2007 »
Karma++ benny for the link!
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #11 on: January 26, 2007 »
I'll add my on thoughts at this point.

I wrote a 4k synth from scratch with nothing but listening to Abba as background experience. I learnt a few things:

1. No music format will ever beat your own.
- With lots of design work I was able to get 3 minutes, 8 tracks of *fast* music, down to 300 bytes with my own format. The music file is 14.1kb and compresses to 300 bytes. Thats a compression of about 46x. So the format is very good for compression. kb quotes 30 as being good.

2. A good 4k musician is one who is willing to work in a limited environment
- After 4 months of coding tools and synth (version 6 was eventually used) only one musician could be bothered to use the tool out of maybe 6. I wrote tutorial, help file, had a place to log bugs and still no response. Such size limited music means compromise at an enormous level and not all musicians want to even try.(*)

3. Sound effects are ten times more important than oscillators
- I spent loads of time writing basic oscillators (sin, saw, noise, triangle, square, ramp, sqr, ramp down and so on) and envelopes but the synth only came to life when I wrote effects (echo, distort etc).

4. lo-hi pass use lots of bytes
- In the end I ditched them in favour of some smaller effects. Maybe my code was rubbish though.

5. I wouldnt do the synth it that way again but the music code was good.
- At a basic level, I used my own code to decode the music and generate a wav file that plays using playSnd. No synch. Next time I'll cut down to maybe three oscillators (sin, ramp, noise) or Ill use samples in gm.dls, then I'll concentrate entirely on effects, for example I could pump it through direct sound.

(*) any artist or musician who thinks coders dont make serious compromise at 4k too should think again :-)

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Music code and tools..at what sizes?
« Reply #12 on: January 27, 2007 »
@taj:

Thanks mate.

It's very interesting to read your thoughts about this topic. I myself didnt spend
a lot of time about this. So it is very cool to here some opinions from another good
and experient programmer like you about this.

 :goodpost:
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #13 on: January 27, 2007 »
If anyone is looking for DirectSound sample code (in C or C++) that uses the above multithread/event technique, give me a shout and I'll post it here.

Thanks for your thoughts Taj.  I've never even considered writing my own synth, but I've written AY chip emulations for my Spectrum emulators and never even considered that actually it's very similar - all square waves, noise, and ADSR enveloping.

Jim
Challenge Trophies Won:

Offline bbear

  • C= 64
  • **
  • Posts: 87
  • Karma: 4
    • View Profile
    • Legacy
Re: Music code and tools..at what sizes?
« Reply #14 on: April 11, 2007 »
and what about old Synth/exotic formats : soundmon, sid, hippel, delta... ?
I already found AHX source replayer, and the BP SoundMon replayer (but a little bit buggy) (see C/C++ section)

how to use these formats in 4k/64k? is the source of Oldskool plugin open ?

or, like Estrayk, it'll be cool to have remakes of some old exotic mods in ahx or mod

(ps: it's for a project I have : do some remakes of old amiga cracktros using c or freebasic with gdi/dx/ogl... for now I only tried with Gdi but I want to use tinyptc/ddraw - here a test)
« Last Edit: April 11, 2007 by bbear »

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Music code and tools..at what sizes?
« Reply #15 on: April 11, 2007 »
They're all probably too big for 4kb, simply because they're generic players that can play a wide range of tunes.  To make a 4Kb you'll need to slash everything you can, and versatility will be one of the first things to go.

Jim
Challenge Trophies Won:

Offline bbear

  • C= 64
  • **
  • Posts: 87
  • Karma: 4
    • View Profile
    • Legacy
Re: Music code and tools..at what sizes?
« Reply #16 on: April 11, 2007 »
err...yes...
but it wasn't my questions (not only for 4k)
sorry for my post in wrong thread