Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Question on music engine

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Question on music engine
Dale M.A. Johnson
Member #1,103
March 2001
avatar

Is there anyway to create a special "music system" for Allegro games? Let's see if I can explain this...
Well, you know how MOD files store the sound files for the instruments they use? Well, in the interest of space, is there any music file that draws from a common pool of external sound files, so that you use the same instruments for every song? Sort of like the SNES or GBA.
Now I've probebly lost you all...

------> SIG TIME!

"You know, I could be working on that battle engine... But NOOOO~, I'm too busy tweaking the title page." -Me

Goodbytes
Member #448
June 2000
avatar

You haven't lost me. That would be a pretty good system... I was thinking about suggesting it before... I think. :P

Maybe the creators of DUMB will add that to the DUH music file specification? ;D


--
~Goodbytes

Paul Pridham
Member #250
April 2000
avatar

You could probably make this fairly easily using some basic waveforms (square, sine, triangle, sawtooth, and noise), a simple engine to play multiple looping samples at various frequencies, and using a few simple effects (like ADSR envelopes). Use some simple form of scripting for the music sequencer... say, a list tracks to be played, each with a sequence of notes with duration, and the odd effect inserted here and there.

Poof! Oldschool chiptunes in a can (or something)!

X-G
Member #856
December 2000
avatar

MIDI does that, sort of.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Thomas Fjellstrom
Member #476
June 2000
avatar

ohh. this reminds me of an entry from the first SpeedHack. It used a fairly complex 'language' to describe the various 'parts' (instruments) and the actual tune. Its very impressive. I'll try and find a link :)

[edit]Can't seem to find it... But it was very nice :)[/edit]

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Dale M.A. Johnson
Member #1,103
March 2001
avatar

Quote:

MIDI does that, sort of.

The problem with MIDI is that it doesn't use the same sound bank. Each sound card has it's own, so what sounds good on one care may sound horrible on another. And nothing sounds good on junky sound cards.
I'm looking for something where I create a pool of, say, twenty samples, which would include instruments, percussion, etc. All the songs would load that into the bank. So you get the quality of a MOD but in a smaller size.
That, and I like my songs to use simular instruments in a game, since it gives it an "SNES feel," and it keeps a sort unity to the soundtrack. That, and I said so. :P

------> SIG TIME!

"You know, I could be working on that battle engine... But NOOOO~, I'm too busy tweaking the title page." -Me

Bruce Perry
Member #270
April 2000

Quote:

ohh. this reminds me of an entry from the first SpeedHack. It used a fairly complex 'language' to describe the various 'parts' (instruments) and the actual tune. Its very impressive. I'll try and find a link

That wouldn't be SPEED, would it? If there's another entry from the first SpeedHack that does anything like that, I'd like to know! :)

Failing that, there's Cupid which uses some OO stuff to synthesise the sound effects on start-up, or TeleHack which uses DUMB's undocumented architecture to synthesise music (and unwisely sound effects too) in real time, but these aren't from the first SpeedHack...

If you're wondering about DUMB's undocumented stuff - it'll be finalised and documented for DUMB v1.0, but I make no guarantees as to when that'll be ;)

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Thomas Fjellstrom
Member #476
June 2000
avatar

no.. Shawn hard coded all his stuff. The one Im talking about was only a synth (no game), and loaded a text file with a phunky syntax that detailed the tune, tempo, etc...

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Julien Cugniere
Member #947
February 2001

Quote:

The one Im talking about was only a synth (no game), and loaded a text file with a phunky syntax that detailed the tune, tempo, etc...

I don't know if it was in the first speedhack, but this sounds a lot like Christian Schueler's Virtual Synthesizer...

This is quite an impressive piece of code, and the songs actually sound very good. They are however quite indecipherable :)

X-G
Member #856
December 2000
avatar

Quote:

The problem with MIDI is that it doesn't use the same sound bank. Each sound card has it's own, so what sounds good on one care may sound horrible on another. And nothing sounds good on junky sound cards.

That's why I said "sort of". ;)

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Thomas Fjellstrom
Member #476
June 2000
avatar

YES!!! That is it :)

I think It was originally released arround the first SpeedHack (I could have swore that was what he ended up dooing for the first speedhack, but never sent it in...)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Paul Pridham
Member #250
April 2000
avatar

Hmm, now I want to do this. It would be pretty simple and fun and bleepy! :D

Thomas Fjellstrom
Member #476
June 2000
avatar

Ohhh yeah... You still working on 'Bleepy'?? What ever happened to that project Paul?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Bruce Perry
Member #270
April 2000

Quote:

I could have swore that was what he ended up dooing for the first speedhack, but never sent it in...

Well, judging by the comments on the page, it was a SizeHack entry that didn't qualify :)

WoW ;D That is one cool project...

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Thomas Fjellstrom
Member #476
June 2000
avatar

Ah. It was 'A' allegro 'HACK' entry ;)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Paul Pridham
Member #250
April 2000
avatar

Quote:

Ohhh yeah... You still working on 'Bleepy'?? What ever happened to that project Paul?

It's on my enormous to do list.

Thomas Fjellstrom
Member #476
June 2000
avatar

Oh, In case anyone had troubles compiling "Christian's virtual synthesizer" with Mingw32, you need to do a few things...

add #define M_LN2 0.69314718055994530942 to synth.h

and change a few of the C++ includes into real C++ includes...

chage:

#include <istream.h>
#include <strstream.h>
#include <string.h>

to:

#include <iostream>
#include <strstream>
#include <string>

Then It sould compile... Now before anyone asks WHY Id want to recompile it... It sounded like crap using XP's emulated SBPro in emulated DOS.. It sounds a bit better using the actual sound hardware :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

kazzmir
Member #1,786
December 2001
avatar

im trying to compile christians virtual synthesize for linux. i had to change a few things in the source, but now im getting the error that allegro redefines what fixed is. in iomanip, fixed is an std function in the form of
std::fixed(std::ios_base&)
how do i get around this? i tried #undef'ing fixed right after allegro.h is included, but i guess you cant #undef #typedef's

Thomas Fjellstrom
Member #476
June 2000
avatar

Im not sure... Hopefully someone else can comealong and help :)

In case you want to hear a sample of what it does... I ogg'ed the space01.txt file...

HERE

[edit]If allegro doesn't provide a #define to change the name... try #defining fixed to allegro_fixed BEFORE you include allegro?[/edit]

[edit2]w0w.. While trying to post the last edit.. The whole allegro.cc site was giving 500 errors[/edit2]

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Julien Cugniere
Member #947
February 2001

As a nasty hack you could try this (untested):

Quote:

#define ALLEGRO_FIXED_H
#define fixed long
#include <allegro.h>
#undef fixed

You might also need to put this piece of code before the c++ includes...

Dale M.A. Johnson
Member #1,103
March 2001
avatar

Apparently the answer to my question is "no." :)

------> SIG TIME!

"You know, I could be working on that battle engine... But NOOOO~, I'm too busy tweaking the title page." -Me

Bruce Perry
Member #270
April 2000

Michael: put all your tunes into a single MOD file, so they can share samples. DUMB v0.9.1 will contain the necessary API for you to choose which order to start on :)

In the distant future, the DUH file format will provide exactly what you want - but for now that's vapourware. ;D

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Dale M.A. Johnson
Member #1,103
March 2001
avatar

So, basically I just pack everything into one MOD file, then use DUMB to select where in the file to start playing? Hmm... Sounds simple enough... Only problem will be getting the repeats to work right, but that shouldn't be too hard.

------> SIG TIME!

"You know, I could be working on that battle engine... But NOOOO~, I'm too busy tweaking the title page." -Me

miran
Member #2,407
June 2002

You could use the "Jump to order" command (Bxx in Scream and Impulse Tracker) to setup several songs inside one file but as I just discovered today, DUMB doesn't support this (very basic and commonly used) command :(

--
sig used to be here

Bruce Perry
Member #270
April 2000

Actually, DUMB does support it. The S3M loader is buggy in that it doesn't convert the BCD value to binary (i.e. B12 is interpreted as 'jump to order 18' instead of 'jump to order 12' as it should be for S3M files); but this is fixed in CVS. (Go here to set up CVS, and here for instructions on getting DUMB's CVS version.) In the meantime, you could save your music as IT files.

Please, if you have any mods that DUMB plays incorrectly, send them to me so I can fix any bugs!

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

 1   2 


Go to: