Log In  


UPDATED 09-03-18

Cart #56132 | 2018-09-03 | Code ▽ | Embed ▽ | No License
4

WHAT'S NEW ??

WHAT'S COMING UP ?
I think I'm done here. I have what I need to make music for my game in progress. If there are some features you want, feel free to mention them here. There's a good chance I'll do a toto rewrite of this and allow 4-notes simulataneously in addition to other goodies - after I finish writing the game.

(09-03-18)

  • fixed drum error
  • added "hex" method of saving your song
  • fixed scrolling for meter, expanded to 250.
  • wrote bare "bones," ready for code !

(09-02-18)

  • autoplay uses a real timer now, should be perfectly accurate
  • changed sound of drums, not so much white noise now as an Indian drum
  • added # meter above to track the sheet if it goes past the initial screen
  • added "stealth" note skipping, no need to listen to notes just to move cursor

(09-01-18)

  • Added drums
  • Press LEFT and RIGHT to choose piano keys
  • Press down on white keys to change note duration
  • Press UP and DOWN again to choose black keys to white
  • On keyboard, press (O) to add note, (X) to backspace
  • Press (O) and (X) on keyboard to change instrument between piano and drums
  • Hold (O) for a moment to autoplay your song
  • Press (X) during autoplay to abort
  • Press up on black keys to enter selection
  • in selection, press (O) to insert, (X) to delete, right arrow key to play that note
  • press up on selection to enter file box
  • File box has Load/Save SRAM, convert to clipboard sourcecode, or Clear (run program again)
  • Moved editor notes to starting at 51, so notes 0-50 are free for user

I'm putting "Monster Hunt" on the backburner till I finish this. I want to have music in my game so this tool will cover that.

Been working on this all day. It's not done yet. You can't save or load music yet, but you can experiment with it and test your songs out by pressing UP twice and far left, then right to play each note.

When complete it'll load/save to SRAM and string and clipboard sourcecode. Then you can:

T="(coded music string)"
PLAYMUSIC (T)

And, this program is using the standard _INIT(), DRAW(), and UPDATE() so, once complete, it should work well for any of your projects and run your song neatly in the background of UPDATE().

BARE BONES CODE FOUND BELOW

4


Suggestion: Pressing down while on the keyboard autoplays the tune from the start, stopping after it wraps once.

Pressing up while on the tracker part up top, allows you to move up to the text above and maybe change settings such as tempo, swing etc.. or to reach options about saving and loading.


Hi CD. Good morning. It's first draft. I caught an error in it too. The miniature piano to the left is not showing the correct key. It is now.

Yes, I was thinking of doing the AB, that is, if you press (O) and (X) simultaneously, you get a menu or effect.

I should be able to finish this today. The tempo should be adjustable by pressing DOWN when on the white keys. Will get more work done today.

Thanks for your suggestions ! Will try to implement them all. :)


Updated version (see first post)

Press UP from piano to enter editor.
Press (O) to insert, (X) to delete, up again for file options.

Change line # 53 to your own song or REM it out to start with a blank slate, you can get sourcecode of your song as a single string when you choose "TO-CLIP." (only works in PICO editor, apparently clipboard load/save does not work when Online in Lexaloffle). :(

Press down at piano to choose new note duration.

At piano, hold down (O) to auto-play, thanks to CableDragon for suggestion.

What's next ?

I want to be able to scroll the notes beyond the basic 60 so you can load/save up to 250 notes (I'll use 6-bytes for song info).

I want drum so that's coming up.

Also need to set it so it can go beyond 250 if you just want to save it as a single long sourcecode string, work in progress.

Any questions or problems ? Let me know.

That's all the work on this for today.


Only other suggestion would be chords of course, but I understand that's where the data gets a bit more unmanageable.


Yeah, it would be awesome for 4-channel polyphonic real playing, Cabledragon. The keyboard is a bit limited though. It needs to either scroll or be smaller and have more keys, and - the music would take 4- 5-bytes per note instead of 1 as it is now.

Here is the current byte layout:

EMPTY: 0
Note : 1-24
Duration (8th, 4th, half, full, double) x 25
Instrument, Piano, + 128 = Drum

I'm satisfied with this to make music for my monster hunt game, but yes, a more robust music editor afterwards would be in order.

Scrolling piano keyboard (select 3x as many notes), Enter up to 4-tones at a time per note, can mix all instrument types, duration method, fastest 1/8th, slowest double, option to extend past 250 notes. But later.

Getting ready to post this update.


BARE BONES CODE

Cart #56133 | 2018-09-03 | Code ▽ | Embed ▽ | No License

-- bones, bare bones playback -
-- by dw817 -------------------

-- song written in "piano+"
-- cart # 56023

-- all sprites free for use.
-- all mapper is free for use.

-- sfx #56-63 in use by player.
-- remaining sfx 0-55 are free
-- for use.

-- main program ---------------

function _init() --------------

tonepos,tonetimer=0,0

songhex="292420292724202726221d0e0d24201d292c29242c2e2b27131229241d42"
-- ^ put your hex song here

end--_init() ------------------

function _draw() --------------

cls()
print(tonepos,60,62)

end--_draw() ------------------

function _update() ------------

playmusic()

end--_update() ----------------

function playmusic()
local p=tonum("0x"..sub(songhex.."00",tonepos*2+1,tonepos*2+2))
local i,a=flr(p/128),12
  if tonetimer==0 then
    if p==0 then
      tonepos=0
    else
      tonetimer=flr(2+((p%128)/25))^2
      if (i==1) a=0
      poke(12800+68*(56+i*4+tonepos%4),a+(p-1)%25)
      sfx(tonepos%4+56+i*4)
      tonepos+=1
    end
  else
    tonetimer-=1
  end
end--playmusic()

Pretty small coding at that !

  • Initialize two global variables
  • Put your hex song in single "songhex" string, sample I wrote included

  • In _UPDATE(), include PLAYMUSIC() any where you want your song to play in the background

That's all you need. Your song will play and repeat when done.

To see and hear this music player, load cart # 56133.

Hope This Helps !



[Please log in to post a comment]