Solved

Dynamically Generating Music

Posted on 2003-11-28
8
259 Views
Last Modified: 2011-09-20
Hi,

I have a requirement to have some "sort of" music in a flash swf file,

Now the fun part: in total I have about 2k filesize to play with!

My suggested solution is to have 8 notes saved as midi (total about 1k)
These are played through javascript in the web page, called from the flash file,
the flash will need to generate an appropriate sequence to call the notes to sound like some sort of music.

*Ideally* the music would be able to speed up and slow down depending on other factors in the flash...

Obviously I can compromise on some of the factors with this ;-)
(number of notes, speed variations etc, but not on the filesize available!)

Thoughts?

Cheers,
Mal
0
Comment
Question by:malcx
  • 4
8 Comments
 
LVL 3

Expert Comment

by:mastallama
ID: 9881279
why only 2k?
0
 
LVL 3

Author Comment

by:malcx
ID: 9903465
The whole app I'm writting has to fit in 5k (www.the5k.org) and I want 3k for pretty graphics - woo!
0
 
LVL 3

Author Comment

by:malcx
ID: 10120255
delete then please!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Accepted Solution

by:
AntonySmales earned 250 total points
ID: 10127402
Before you delete it, think about this...

Rather than store 8 note samples (of which only 1 can be played at any time in most embedded java implementations), store 5 chord samples arranged as per the pentatonic scale (type "pentatonic scale" into google if you've got no idea what I'm on about.)

Then, store several progression patterns as embedded arrays

byte segment_01[] = { 1,3,3,4,1,5,1 };
byte segment_02[] = { 3,1,5,5,1,3,2,2,2,2 };
...
byte segment_0x[] = { 1,1,1,1,3,3,3,1,2,3,1,2,3};

As I presume you are going to have a fixed event timer for performing your basic game loop - and if you put the "music" (loosely defined) at the start of the loop, you should get a reasonable consistent timeframe.

this would give you the ability to have "randomish" "music" that is guaranteed to sound at least half decent.

You don't need to use the pentatonic scale, but unless you have a music background whereby you understand the concepts of progression, major and minor scales etc etc, then it's a lot easier to use the pentatonic system.

Cheers

your main loop could randomly pick a segment to play to completion
0
 
LVL 3

Author Comment

by:malcx
ID: 10145151
Ok - dont delete then!

Thanks for that - I'll take a look at it (but it may be a while I'm off for a week starting tomorrow) But it certainly looks promising!
0
 
LVL 3

Author Comment

by:malcx
ID: 10380073
Sorry for the complete lack of response for ages on this - work unfortunatly has called me away from this for the time being - but the answer seems to make sense and looks like it'll work so here you are!

cheers,

Mal
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Game Center error 5 642
Will Java Webstart launch my game? 6 130
factorial example challenge 10 92
triangle challenge 4 121
What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now