Creating New Voice Generators In BASIC
Angel Perez (2908) 84 posts |
I was studying the workings of the sound modules in RISC OS and I discovered that you can create new voice generators added to the usual ones listed (indices 1 to 9, WaveSynth-Beep, StringLib-Soft, all the way to Percussion-Noise.) I was searching for a way I can add pieces of code to my game developments and I found a source code for Music Maker: http://www.riscos.com/support/developers/agrm/chap06.htm This is a voice generator utility. It is part of the Archimedes Gamemakers Manual, Chapter 6.2.3. Based on this, I need more comprehensive information on adding new voice generators, with commands such as Sound_InstallVoice and Sound_Configure. But I prefer to enter much of the source in BASIC as part of the codes for the development for my games. I need to be able to better understand parts of the creation of new voice generators (for example, for indices 10 to 32, also known as “slots”,) such as amplitude envelope, frequency envelope and wave tables. I am especially interested in creating voice generators to produce classic arcade sounds like simple square-wave beeps, noise waveform generation for sound effects such as explosions and user sounds such as “UserLib-Bell”, for example. I don’t want to overwrite the voice generators at indices 1 to 9. Instead, I want to add my own. But I need a better understanding of the bytes in the code allocated for the respective functions in the voice generators. The source code I found here is much too complicated at this time and I need a simplified way to perform the same task for my games. Note: The MusicMaker BASIC program doesn’t work in RISC OS Pi. (It is likely designed for an earlier Archimedes computer operating system or BBCWIN.) |
Steve Pampling (1551) 8170 posts |
I think you will find that the formatting of the text of the code has broken various lines, particularly the long ones in the PROCenvelope section. |
Steve Pampling (1551) 8170 posts |
oh, and where items are bracketed { and }the software they used to import the code didn’t protect it and so portions of the assembler are missing. |
Steve Pampling (1551) 8170 posts |
Now I’ve actually woken up, the download link works, the file inside the zip work (tested on RPCEmu running 5.23 02 Feb 2016), the output files may be of the right format. It dumps the output to the currently selected directory |
Angel Perez (2908) 84 posts |
Must I ask, though, if line numbers are really all that necessary (unless you are using statements such as GOSUB or GOTO) when entering your code or cutting and pasting a source code from a web page? However, unless I am transforming a Raspberry Pi 2 into a workstation synthesizer, I don’t think I need all that source code which I noticed has symbols that the current BBC BASIC interpreter in the RISC OS Pi operating system can’t use. All I want is to learn “back-to-the-basics” of creating and installing a new voice (but not from an external device, though.) But aside from a basic source code, I need to know what parts of the hexadecimal values input belong to the envelope registration. I noticed that for the waveform registry, the BASIC code contains a trigonometric equation in a FOR…NEXT loop. That would be to generate a sine waveform but I am wondering if for a square wave I would enter, for example, values of &FF within the bytes data for the wave table for the first half and zeros for the second half of what is described as a 256-byte parameter block. A sawtooth wave table would comprise of typically upward increments from 0 to 255, through the use of increments by 1 in a loop. For a sine wave, both COS and SIN functions would be needed but using only a single SIN function would give a triangular waveform. This is based on a simpler source code I found in the RISC OS Programmer’s Reference Manual. http://www.riscos.com/support/developers/prm/sound.html See the Example program there. It should give you a clue to what I am talking about. |
Angel Perez (2908) 84 posts |
“I think you will find that the formatting of the text of the code has broken various lines, particularly the long ones in the PROCenvelope section.” “Now I’ve actually woken up, the download link works, the file inside the zip work (tested on RPCEmu running 5.23 02 Feb 2016), the output files may be of the right format. It dumps the output to the currently selected directory,” I was using StrongED. But since the sound SWI commands can be called in BASIC via the SYS statement, I figure that there could be a way around assembly code. I would need to change the voice generator indices at 1 to 9 if I must. And that last source code I mentioned in the link, the Example program, is one example that demonstrates it. But it too didn’t work due to the way the lines of code were written and posted at the web pages. The “[” and “]” characters are supposed to mark the beginning and the end of the BBC BASIC assembler code but I doubt that the same special symbols could be used as part of the indexing and addressing in the assembly code and I have doubts over the usage of the braces { } in the assembly code lines. Either I need a separate compiler or a converter from one language to another. |