{"id":17965166,"url":"https://github.com/tokenrove/ymamoto","last_synced_at":"2025-08-16T12:31:24.132Z","repository":{"id":11580002,"uuid":"14069391","full_name":"tokenrove/ymamoto","owner":"tokenrove","description":"A replay routine for the Atari ST, using the YM2149 chip.","archived":false,"fork":false,"pushed_at":"2013-11-02T16:27:12.000Z","size":128,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T13:01:32.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tokenrove.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-02T16:26:54.000Z","updated_at":"2021-02-27T22:07:08.000Z","dependencies_parsed_at":"2022-09-02T03:23:02.372Z","dependency_job_id":null,"html_url":"https://github.com/tokenrove/ymamoto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenrove%2Fymamoto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenrove%2Fymamoto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenrove%2Fymamoto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenrove%2Fymamoto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tokenrove","download_url":"https://codeload.github.com/tokenrove/ymamoto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230036699,"owners_count":18163047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T12:10:21.646Z","updated_at":"2024-12-16T22:41:49.973Z","avatar_url":"https://github.com/tokenrove.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\t\t\t  YMamoto Alpha Zero\n\t\t Julian Squires \u003ctek@wiw.org\u003e / 2004\n\n\t\t\t    ABOUT YMAMOTO\n\nYMamoto is my first attempt at a reasonable music playroutine for the\nAtari ST.  The design goal is to allow the production of interesting\nmusic; I considered adding efficiency of {memory usage, song size,\ncycles per frame} to the set of goals, but I decided that aiming at\nany of these things directly would just cripple the main goal, until I\nam more familiar with the ST and the YM.\n\nSo, YMamoto, when finished, should be suitable at least for music\ndisks and parts of demos where cycles aren't too scarce.\n\n\n\t\t   USING YMAMOTO IN ANOTHER PROGRAM\n\nCall ymamoto_init with A0 pointing to the song data, and D0 set to the\ntrack index to play.  Note that the first track index is 1, not 0.\n\nCall ymamoto_update once per frame until it returns $FFFF in D0.\n\nFIXME: Eventually there will be a way to use trigger events to allow\nyou to sync your effects to the music.\n\n\n\t\t\t YMAMOTO DATA FORMAT\n\nAll relative pointers are to long aligned addresses, and hence the\npointers are stored as shorts, and shifted left two bits to get the\nactual address.  These pointers are relative to the beginning of the\nsong data, not their current position, and are always forward\nreferences, so they don't get sign extended when loaded from words.\n\nSONG\n\npointer to arpeggio table (word, relative, \u003e\u003e2)\npointer to volume envelope table (word, relative, \u003e\u003e2)\npointer to vibrato table (word, relative, \u003e\u003e2)\nnumber of tracks (byte)\n\tShould always be \u003e=1.\noffset to track 0 (word, relative, \u003e\u003e2)\noffset to track ...\n\n\nTRACK (long aligned)\n\nchannel A start point (word, relative, \u003e\u003e2)\nchannel B start point (word, relative, \u003e\u003e2)\nchannel C start point (word, relative, \u003e\u003e2)\n\n\nCHANNEL DATA STREAM (long aligned)\n\nThe two kinds of values possible in the channel data stream are notes\nand commands.  They can be determined by the value of their MSB, which\nis 0 for notes, and 1 for commands.\n\nNotes are stored in the following inefficient way:\n\t0ddd dddd rnnn nnnn\n\t\td =\u003e duration, in frames-1, from 0 (1/50th of a second)\n\t\t     to 127 (2.56 seconds).\n\t\tr =\u003e reserved (0).\n\t\tn =\u003e tone, value from 0 = C0, 95 = B7.\n\t             126 = wait, 127 = rest (wait, silence channel).\n\t\t     Other values might be used for special purposes.\n\nGlobal commands: (can occur in any channel; need only occur once)\n\t10rr rccc  xxxx xxxx\n\t\tr =\u003e reserved.\n\t\tc =\u003e\nevery track must end  \\\t000 =\u003e track end (not followed by any data)\nwith one of these.    / 001 =\u003e track loop\n                        010 =\u003e trigger external event\n\t\tx =\u003e command data\n\nChannel commands:\n\t11cc cccc xxxx xxxx\n\n\t1100 0001 aaaa aaaa\n\t\tarpeggio.  0 = disable arpeggio.\n\t1100 0010 xxxx xxxx\n\t\tset detune\n\t1100 0011 xxxx vvvv\n\t\tset fixed volume\n\t1100 0100 eeee eeee\n\t\tset software volume envelope.\n\t\t0 = disable soft envelope.\n\t1100 0101 nnnn nnnn\n\t\tenable/disable noise.\n\t\tn = noise frequency, 0 to disable.\n\t1100 0110 xxxx xxxx\n\t\tAM sample playback [reserved.]\n\t1100 0111 \u003cenvelope bytes would follow\u003e\n\t\tset hardware envelope [reserved.]\n\t1100 1000 xxxx xxoe\n\t\tenvelope-follow mode.\n\t\te = enable/disable;\n\t\to = one octave lower/same pitch.\n\t1100 1001 pppp pppp\n\t\tpitch envelope.  0 = disable pitch envelope.\n\t1100 1010 ssss ssss\n\t\tportamento.  s = speed.\n\t1100 1011 vvvv vvvv\n\t\tvibrato.  0 = disable vibrato.\n\n\nArpeggio and venv tables: (long aligned)\n\nnumber of entries in table (byte)\nentry 1 length (byte)\nentry 1 loop point (byte)\nentry 1 data (length*byte)\n...\n\nVibrato table: (long aligned)\n\nnumber of entries in table (byte)\nentry 1 \"length\" (byte, always 3)\nentry 1 delay (byte)\nentry 1 depth (byte, 0 through 8)\nentry 1 speed (byte, 0 through 4)\nentry 1 oscillator mask (byte, 1\u003c\u003cspeed)\n\n\n\n\t\t      NOTES ON IMPROVING YMAMOTO\n\nENVELOPES\n\nIt might be nice to provide a means for sweeping the envelope, perhaps\nby a table driven method like arpeggios and vibratos.  Also, changing\nthe shape on the fly, perhaps even with a separation timer.\n\nSTORAGE\n\nI think I'm going to rewrite this as a byte-oriented format.  Word\norientation seems to waste more than it gains (marginal theoretical\nspeed improvements).  Also, I've been reading Rob Hubbard's replays\nlately, as well as various others, and I like some of his approaches a\nlot.\n\nNotes could be stored as being relative to a base octave (set with\nseparate commands), just as their duration could be stored as being\nrelative to a base duration.  This would probably allow encoding most\nnote data as single bytes.  (Tone value would need no more than five\nbits, to encode +15/-16 tones; duration could be just two bits,\nallowing access to the four most common durations.)\n\nObviously, a system for encoding loops and repeats would be good;\nespecially something that took alternate endings into account, because\nthat would seriously improve the value of repeats for a lot of my\nmusic.  Also, possibly a system based on windows (rather than\n\"patterns\" in the tracker sense) might be really handy for\nriff-oriented music.\n\nBeing able to define ``instruments'' that allowed voices to rapidly\nswitch a variety of characteristics at once, might save some time and\nspace.  (An instrument might define a base range, default staccato,\ndefault volume envelope, default vibrato, et cetera.)\n\nWe may need to increase the size of the relative offsets, though ``64k\nshould be enough for anybody''; time will tell, as I write longer\ntunes.\n\nArpeggios (and other tables) could be stored aligned on 8 byte\nboundries, to make seeking into the arp table very quick.  For\narpeggios longer than 8 bytes, you could just have ``double wide''\narpeggios that take up 16 bytes.\n\nDURATIONS\n\nAn alternate approach to duration is to fix the atomic duration (one\nframe), and have the music creation tool do all the duration\ncalculations.  This is good for some kinds of music, but it means that\none cannot switch a song between 50 and 60 Hz replay without\nrecompiling it.  This is what we have now; the notes below apply to\nthe previous system, which was replay-speed independant.\n\nDuration modifiers are probably very rarely used together (tied,\ndouble dotted triplets for example); they can probably turn into\nsomething state based (which would allow us to accomidate stranger\ntimings, like quintuplets).\n\nThis is the old duration format\n\t\tT =\u003e 1 = tied with next note\n\t\tD =\u003e duration modifier:\n\t\t\t000 =\u003e normal\n\t\t\t001 =\u003e dotted\n\t\t\t010 =\u003e double dotted\n\t\t\t100 =\u003e triplet time\n\t\t\t(quintuplet time?  duplet time?)\n\t\t     NB that these may change from independant flags\n\t             into a single, 8 state value.\n\t\td =\u003e duration, value from 0 (whole note) to 7 (128th note).\n\nAnother thing is that, if we find we're already doing full divisions\nsomewhere (because of quintuplets or whatever), we might as well just\nstart representing durations as arbitrary fractions; this allows much\nmore flexibility in some ways.\n\nMISC.\n\nIt could be interesting to provide a sort of voice scheduling system,\nwhich tried to fit ``optional'' voices in on channels when the regular\nvoice was silent (due to rests or staccato).  Maybe this is better\nplaced in the music composition tool, though.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokenrove%2Fymamoto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftokenrove%2Fymamoto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokenrove%2Fymamoto/lists"}