![]() |
HOWTO: Put BeepFX Sound into ZXB code - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: How-To & Tutorials (https://www.boriel.com/forum/forumdisplay.php?fid=13) +---- Thread: HOWTO: Put BeepFX Sound into ZXB code (/showthread.php?tid=466) |
HOWTO: Put BeepFX Sound into ZXB code - britlion - 06-02-2012 Shiru's Beepfx (http://shiru.untergrund.net/files/beepfx.zip) is quite an interesting tool for sound effects. He doesn't believe it can be used for tunes - but it can do different pitched "tones" and include pauses, and that spells tune to me. Beepola is probably a better choice for real tune making, though. Anyway - the asm it produces is not compatible with zxb's assembler. So I did the working out of how to tweak it to work. So the sound calling routine would look like this: Code: SUB sound(soundNum as uByte) And BeepFXPlayer would always be the same tweaks, so I present my version here: Code: playBasic: Finally, you need to run beepfx, and compile just the sound data to asm. You'll get something like this: Code: soundEffectsData This needs some massaging to work. Change "soundEffectsData" to "soundEffectsData:" Change "." to "soundEffectsData" And make labels have a : on the end. Search and replace "db" with "defb" Search and replace "dw" with "defw" Replace # with $ All done! Worked example: Code: soundEffectsData: you can then save this as something lime soundata.asm and #'include this file into the sound routine listed above. Call with sound (n) for the sound number. Re: HOWTO: Put BeepFX Sound into ZXB code - boriel - 06-02-2012 Britlion, seriously, this is FANTASTIC! :o BTW: I've finally integrated the SPPixel routines within ZX Basic (Draw already uses them). I'm porting SPFill into the library as #include <SP/fill.bas>. Once it's done, I could try to include this one. Re: HOWTO: Put BeepFX Sound into ZXB code - LCD - 06-02-2012 Thank you! this will be great! By the way, DB and DW is supported by ZXBC too, so no need to change them. Re: HOWTO: Put BeepFX Sound into ZXB code - britlion - 06-02-2012 boriel Wrote:Britlion, seriously, this is FANTASTIC! :o Way to go! This will be harder to import, since it needs a chunk of extra data.... Re: HOWTO: Put BeepFX Sound into ZXB code - britlion - 06-02-2012 LCD Wrote:Thank you! this will be great! By the way, DB and DW is supported by ZXBC too, so no need to change them. Hmm. I was sure that failed to compile when I tried it. I'll have a look next time. Re: HOWTO: Put BeepFX Sound into ZXB code - britlion - 06-02-2012 Oh, the latest uploaded version of pacman now has sound, thanks to this! ![]() |