Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PLAYMOD enhancements
Author | Message | ||||
psergiu Regular Member Joined: 09/02/2013 Location: United StatesPosts: 83 |
Hi Geoff, everyone, I'm proposing some enhancements to the PLAYMOD command. First, for the people not knowing how a MODule file is structured, a little explanation. There are three main components: - Instruments - those are raw PCM audio files (.wav like). Usually a sample recorded from an instrument playing the note C. By varying the playback speed, all other notes can be reproduced from this. A 4-channel module file can play 4 instruments at the same time, each on it's own channel; - Patterns - this is the equivalent of a piece of sheet music for four instruments. It's a 64x4 table containing the notes to be played or effects to be applied on/for each of the four channels; - Playlist order - a list specifying the order in which the patterns are played. You you have repeating sequences of music, you will specify the same pattern to be played multiple times. There's also "song end" marker so the player will know when to stop playing. AFAIK and i have seen from mod files used in Amiga games, there can be multiple "song end" markers so you can have multiple songs (using the same, or different patterns) in the same file if you are starting the playback from a specific index in the playlist. Simple to implement enhancements: 1) PLAYMOD "file" [index] - optional parameter specifying from where in the playlist order to start playback. Usefulness: In Donut Dilemma, multiple MOD files are used, each having a single pattern and instrument - with this enhancement, programs that use MOD files for sound effects can use a single MOD file containing all the instruments and patterns arranged as a series of different songs in the playlist order. - easier to manage, reusing instruments (played at different pitches), less space used on A: 2) MM.MOD read-only variable either an integer array or a string containing the following 6 values which should be easily read from the module player: - Current playlist order position (1-128). 0 when no module is playing - Current note in pattern (1-64) - Current playback volume on channel 1 - Current playback volume on channel 2 - Current playback volume on channel 3 - Current playback volume on channel 4 Usefulness: Having the interface react in sync with the music/sounds playing in the background. Examples: The volume info can be used for that "4-bar vu-meter" visuals that are common in all module players. Or sprites on screen can be changed according to the rhythm of one of the channels. Harder to implement enhancements: 3) Interrupts triggered when playing a specific instrument Usefulness: More fine-grained sync between the interface and music playing. One could use a empty instrument playing on one of the channels to trigger a interrupt which does SPRITE COPY commands or changes a variable. Very hard to implement enhancements: 4) Command to force playback of a specific instrument on a specific channel. This was used on some of the original Amiga games - the background music was playing on only 3 of the 4 channels and the 4th channel was used to play the in-game sound effects. Example: Soccer Kid Usefulness: this will allow background music and interface-triggered sound effects at the same time: Either sound effects in games with background music or keyboard "clicks" for menus with background music. Thanks |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
Great suggestions! Nick |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Wow, thanks for such an excellent explanation and suggestions. As it happens I know little about the internal workings of MOD files. The core of the MOD player was written by Pascal Piazzalunga from Italy and I will chase him up to see if it is feasible to implement your ideas. Regardless, any new features will not make it into 4.4 which has just about finished testing. Geoff Geoff Graham - http://geoffg.net |
||||
Nick Guru Joined: 09/06/2011 Location: AustraliaPosts: 512 |
From the games perspective, the ability to have 1 MOD file containing the sound samples required for the game as a different instrument, is tidier and pay be faster since MMBASIC won't need to keep opening a new MOD file each times it wants another sound. Nick |
||||
psergiu Regular Member Joined: 09/02/2013 Location: United StatesPosts: 83 |
MMBASIC 4.5 will be the Music and Dance release then :) Once the 4.5 Beta starts, i have some module files that the current code won't play correctly that i'll want to send to Pascal Thanks. |
||||
Print this page |