Jump to content
IGNORED

Procedural music in bB


bjbest60

Recommended Posts

Well, "music" might be a strong term. "Sufficiently harmonious tones" might be better.

 

Attached is a .bin and .bas file of a program that generates, well, sufficiently harmonious tones in the key of A major. It's fairly compact and efficient. I've tried to include a lot of comments. I thought I might use it in a game, but it doesn't really suit the project. I'm posting it here in case it might benefit someone else.

 

Basically it picks a random bass note and a random melody note and plays them. It keeps track of note length and plays things in correct time. (The bass moves in quarter notes, the melody moves in eighth notes, with some variations possible.) It's very basic but could be built out for more interesting (and perhaps musical) results.

 

I'm happy to answer any questions. Enjoy!

songtestprocedural.bas

songtestprocedural.bas.bin

  • Like 6
Link to comment
Share on other sites

Is it possible to make something similar for a single channel so the other channel can be used for sound effects? If so, I could make an adapted example program for the bB page.

 

I'm not quite sure how a single channel would work ... you need two separate notes to create a harmony. You might be able to "flicker" the music on one channel (one frame is bass, the next is melody, the next is bass, etc.) though I imagine that might sound choppy. A better strategy might be to always have both channels doing what they're currently doing and then have a sound effect override a particular channel for a set period of time. I'll experiment a bit when I have some time.

 

EDIT: I tried the "flicker" effect just to hear what it sounds like. To me, it sounds like a very insistent ringing telephone, but maybe it would be useful for the right project? Both one-frame (that is, the sound changes every frame; this uses one bit of a variable) and two-frame (which requires a variable that can count to three) examples are attached.

songtestproceduralflicker1frame.bas.bin

songtestproceduralflicker2frame.bas.bin

Edited by bjbest60
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...