Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I7 Random Background Music (Damusix powered)

25 views
Skip to first unread message

Eliuk Blau

unread,
Oct 19, 2008, 7:05:11 PM10/19/08
to
[This message was originally written in Spanish in the forum of CAAD
(http://www.caad.es/foro/viewtopic.php?p=30440#30440). I translated
into English with the Google translator to share it with the English-
speaking community. Sorry for the bad english...]

Hello. Let me share with you an experiment I did recently with Damusix
for I7. The idea came to me of a conversation with Mel Hython, where a
misinterpretation of his ideas, and good, anyway I thought that was
pretty good to not let pass.

I publish the experiment here to show that the extension Damusix is
currently functional, although in a state of testing, and therefore it
is complete enough to make programming "a little more complex than
usual" with the audio in I7.

Is in principle pseudo-random background music. It's a musical piece,
split into several pieces (6), which are played at random, without any
order (except when at the beginning of the adventure, where he played
the first piece of music).

This experiment plays with features not fully implemented in some
interpreters Glulx. But work properly with Windows Glulxe (best
performance), Gargoyle (Windows, Linux; I recommend downloading the
updated version from ifarchive [http://www.ifarchive.org/indexes/if-
archiveXinterpreters-multiXgargoyle.html]) and Spatterlight (MacOS).
In these three interpreters should work correctly. The experiment
makes use of Glk Timer to synchronize the sounds ... but it is also
possible a version that uses "Sound-notify" to achieve the same effect
(although in this way does not work very well, for example, Gargoyle).

This public demonstration to prove that Damusix I7 is fully functional
for both programs as a basic level of programming for very advanced.
The working framework implemented by Damusix used to all these
conditions.

The experiment can be downloaded here:
http://www.caad.es/eliukblau/temp/Random_BGM.gblorb

[For English-speaking users: use "TALK" to hear a little joke and an
example of the use of virtual reproduction (virtual channels) of
DamusixI7.]

And although DamusixI7 is not yet published, copy the code here in
this experiment, so you can see how to implement the random effect
using Damusix, of course.

This is the code for those interested:

-------------------------------------------------------------------

"Random BGM (with Damusix)" by Eliuk Blau

The story headline is "An Interactive... uuh... naah!, a Sound
Experiment".

[Include Spanish by Sebastian Arg.]
Include Basic Screen Effects by Emily Short.
Include Damusix by Eliuk Blau.

Sound of Cool Beat 1 is the file "bgm1.ogg".
Sound of Cool Beat 2 is the file "bgm2.ogg".
Sound of Cool Beat 3 is the file "bgm3.ogg".
Sound of Cool Beat 4 is the file "bgm4.ogg".
Sound of Cool Beat 5 is the file "bgm5.ogg".
Sound of Cool Beat 6 is the file "bgm6.ogg".
Sound of Dwight is the file "dwight.ogg".

Previous-BGM is a sound-name that varies.
Current-BGM is a sound-name that varies.
The current-bgm is the sound of Cool Beat 1.

To start timer: [for timer mode (run in Gargoyle, Spatterlight and
Windows Glulxe! =D]
(- glk_request_timer_events(9404); -) [cada trozo dura 9,404s.]

To Draw-Status-Line:
(- DrawStatusLine(); -)

Rule for constructing the status line:
center "Damusix is now playing: [Current-BGM]" at row 1;
rule succeeds.

To assign all bgm channels: [solo por estetica, para evitar chasquido
si el tick es demasiado prematuro]
assign the Sound of Cool Beat 1 to channel 1 with volume 100%;
assign the Sound of Cool Beat 2 to channel 2 with volume 100%;
assign the Sound of Cool Beat 3 to channel 3 with volume 100%;
assign the Sound of Cool Beat 4 to channel 4 with volume 100%;
assign the Sound of Cool Beat 5 to channel 5 with volume 100%;
assign the Sound of Cool Beat 6 to channel 6 with volume 100%;

To automatic bgm play (bgm - sound-name): [for not repeat code and
easy use, nothing more =P]
now previous-bgm is bgm;
[assign the bgm to channel 0 with volume 100%;] [for sound-notify
mode (not run in Gargoyle!)]
[dplay the bgm, notifying when finished.] [for sound-notify mode (not
run in Gargoyle!)]
dplay the bgm.

[A glulx sound notification rule:] [for sound-notify mode (not run in
Gargoyle!)]
A glulx timed activity: [for timer mode (run in Gargoyle, Spatterlight
and Windows Glulxe! =D]
while current-bgm is previous-bgm or current-bgm is Sound of Dwight:
now the current-bgm is a random sound-name; [don't repeat previous
sound and don't play Dwight!]
automatic bgm play the current-bgm;
Draw-Status-Line.

Understand "talk" or "hablar" as talking.
Talking is an action applying to nothing.

Carry out talking:
vplay the Sound of Dwight; [a little joke and a test for the virtual
playing functionality =P]
say "'Yo eso lo usé mucho en... Randolph Dwight.'[line break]".

When play begins:
assign all bgm channels; [for timer mode (run in Gargoyle,
Spatterlight and Windows Glulxe! =D]
automatic bgm play the current-bgm;
start timer. [for timer mode (run in Gargoyle, Spatterlight and
Windows Glulxe! =D]

Musical Zone is a room. "Random BGM es un Test para Damusix. Relájate
y escucha la música aleatoria...[line break](En la línea de estado se
muestra el trozo musical que está sonando actualmente.)[line break]
[line break]Oh!, y escribe TALK para oír un efecto de sonido lanzado
en los canales virtuales :-)[line break][line break]Versión de
Damusix: [damusix-version]."

-------------------------------------------------------------------

Well, that is. Ah, I want to make clear that the audio files are
"taken" from the game Peggle Nights by PopCap Games (www.popcap.com).
The music was in a directory accessible, not encrypted, so it could be
taken from there. In any case, to avoid demands =P, my experiment used
only a few "pieces" of that same music and also a very inferior sound
quality.

Thanks for trying out the demonstration and for his comments.
Greetings!

Eliuk Blau.

PS: I had forgotten: a thousand apologies to Urbatain for using his
voice and his appointment without having asked before! (It is a small
joke). That sentence of yours is of worship, my friend. =D (again, a
thousand apologies).

George Oliver

unread,
Oct 19, 2008, 7:33:01 PM10/19/08
to
On Oct 19, 4:05 pm, Eliuk Blau <eliukb...@gmail.com> wrote:

> Hello. Let me share with you an experiment I did recently with Damusix
> for I7.


OK, that was hells cool. Sorry I have nothing constructive to add.
Thank you for working on this!

Emily Short

unread,
Oct 19, 2008, 8:02:32 PM10/19/08
to
On Oct 19, 6:05 pm, Eliuk Blau <eliukb...@gmail.com> wrote:
> Thanks for trying out the demonstration and for his comments.
> Greetings!

Really nice, Eliuk -- I am looking forward to this being available!
Thanks for your hard work.

Sarah

unread,
Oct 19, 2008, 11:50:59 PM10/19/08
to
> Hello. Let me share with you an experiment I did recently with Damusix
> for I7.

Wow. Very nice!

I was wondering - what sort of support does Damusix have for real-
time? I notice you're doing some things with the glulx timer.

Eliuk Blau

unread,
Oct 20, 2008, 9:46:17 AM10/20/08
to

Thanks for your comment, Sarah. The Damusix's real-time support is
limited only to the Fadings and the playlist that the extension
implement. For these two features Damusix use the Glk Timer.

However, in this "experiment", the support of real-time that
reproduces every sound "at the right time" is implemented by the
wonderful extension Glulx Entry Points by Emily Short. This extension
brings the magic of the functionality with the Glk Timer and the
capture of the events of time ("ticks"). And in this experiment
Damusix only serves as the engine of audio, to play each sound.

I want thanks to George Oliver and Emily Short for your first
comments. And especially to Emily, who has been one of the people has
been continually interested in Damusix's developing. (And thanks to
Aaron Reed, of course, who has been my "sensei" with the English
language, hehehe!)

Greetings!

Jerome West

unread,
Oct 20, 2008, 1:54:20 PM10/20/08
to
Hi Eliuk,

I have to say this is very impressive indeed! Any idea when this
extension will be released? And if not soon, do you need another beta
tester? ;)

I have been looking forward to trying out Damusix ever since the first
announcement, I have many ideas that I wish to try with the combination
of Inform 7 and music!

Jerome

Eliuk Blau

unread,
Oct 21, 2008, 11:59:34 PM10/21/08
to


Do not worry, Jerome. I have scored as a "beta-tester" a lot even
before you knew yourself.

When Damusix be published (1 or 2 weeks), you'll have to ask for help
to Aaron Reed, because all the "documentation provisional" I write in
Spanish.

Greetings!

PS: Email me with the address to which you want to send you a copy of
Damusix when it is released. Only testers will receive a copy. Then,
when the testing is complete, will be release the extension for the
entire community. =)

Eliuk Blau

unread,
Oct 22, 2008, 12:20:24 AM10/22/08
to
I've made improvements to the code of the experiment. The I copied it
here, someone is interested to consider it.

It happens that when you UNDO / LOAD, the music stopped playing until
a new "tick" of Timer GLK occurred (that is every 9.404s) ...

... again, using the magical extension "Glulx Entry Points" by Emily
Short, I've corrected the mistake and now it works perfectly when you
UNDO or load a game.

You can download a binary corrected since:
http://www.caad.es/eliukblau/temp/Random_BGM.gblorb

To make the correction, you just have to add to the original code as
follows:

------------------------------------------------------------------------------------------------------------

First-Run is a truth state that varies. First-Run is true. [trick for
"UNDO/LOAD" bugfix =P]

[fix the "UNDO/LOAD bug" -> re-launch the random music]
A glulx object-updating rule (this is the Undo-Load-BGM-Bugfix rule):
if the First-Run is true: [very important: execute this rule in the
first-run produces a CRASH in WinGlulxe]
[... because start timer and launch music in that point of the game
execution (first run and in the Glk Initialization Stage) is too early
and probably a generic programing error... I don't know.]
now the First-Run is false;
stop;


automatic bgm play the current-bgm;
start timer. [for timer mode (run in Gargoyle, Spatterlight and
Windows Glulxe! =D]

[This not function!!! Probably because object-updating is too early
(in the Glk Initialization Stage) for a procedural rule. I don't know
the causes... buf! Probably is relationated with the internal order of
the I7 generated code... =P]
[A procedural rule: [trick for "UNDO/LOAD" bugfix =P]
if the First-Run is true:
now the First-Run is false;
ignore the Undo-Load-BGM-Bugfix rule.]

------------------------------------------------------------------------------------------------------------


That's it.
Greetings! =D

Eliuk Blau.

0 new messages