More On Creating New Voice Generators
Angel Perez (2908) 84 posts |
After I got much needed support to get MusicMaker running in RISC OS Pi, I read a few documentations on sound and I found out that, as a part of creating your own custom sounds – and create a module inside your BASIC code, just the way it was done for MusicMaker, that you can access the sound channel control block memory offest addresses with the OS_ReadControlBlock (&4018B) command. But I need an example code or program to read the data of the generated sound though this command. It will be essential in order to create your very own generated sounds for your games just like the source code was provided for MusicMaker. Whatever I create with MusicMaker for a sound, when I build the sound module with it, I load the resulting module, look up the channels attached to the sound generator indices 1 to 32 and read that sound index control block with the &4018B SWI call. Typically, if I use this SWI call to read the control block, if UserLib-Bell is at index 10 (of the indices 1 to 32) and Voice 1 is attached to it, I would use 1 as the voice channel number and the numbers inside the offset addresses would match those I saw in the MusicMaker source code for the “Bell” sound. In the SWI call, the R0 parameter is the Voice channel, 1 to 8 and R1 is the offset memory address (from 0 to 255) to write to. 0 is the amplitude (I believe the loudness of the sound), 1, without a doubt, should be the table index between 1 and 32 while offset 2 likely is the same as what you specify in R0 in the SWI call, the channel from 1 to 8 this sound control block is attached to. The others deal with main sound control and status flags, phase accumulator pitch and timbre oscillators but the offsets 64 to 255, I believe, don’t do anything unless you provide the reason coding to use them. |
Neil Fazakerley (464) 124 posts |
Angel, have you seen the 106 new voices available for free on David Feugey’s website? |
Jon Abbott (1421) 2651 posts |
If I’m understanding your question correctly, you want to get the raw audio data from a Voice Generator? The SCCB isn’t designed to pass generated audio data, it’s meant for passing audio parameters from the Sound Channel Handler to a Voice Generator Essentially audio data is created by the Voice Generator on the fly and written directly to the current DMA buffer. If you want to modify this audio before it gets to the DMA buffer, you’d write it to a circular buffer in a Dynamic Area and have the Voice Generator copy that buffer to the DMA buffer with a suitable delay so the Voice Generator is always behind the generated audio. It might be worth explaining in more detail exactly what you’re trying to achieve. |
Angel Perez (2908) 84 posts |
Jon Abbott (1421): Not only we’re dealing with the SCCB, where you would sometimes change the pitch, volume and phase “on the fly,” with the OS_ReadControlBlock and OS_WriteControlBlock commands but MusicMaker also used OS_SoundLog and OS_LogScale commands as well. Sadly, I couldn’t access Dave Feugey’s websites earlier due to broken links in the web browsers but I believe those 106 voice generator modules you talk about are worth checking out. As I noted earlier, the simplest way to have your own set of sound generators in your game program is to create a sound module with MusicMaker, save a copy of the sound module to the root directory of RISC OS and load the sound module in the game program as a star (*) command… simply by typing the name of the sound module file. But the question that awaited in this topic was what if you wanted to include a set of new voice generators inside the program without depending on a sound module outside the program code, just the way MusicMaker was written. |
Jon Abbott (1421) 2651 posts |
A progrem wouldn’t normally modify the SCCB directly, the Channel Handler would do that. A program would normally use Sound_Control or Sound_ControlPacked to change the playing sound, or play a new one. Sound_LogScale will be used once, in the Instantiate code of the Voice Generator and points to a volume adjusted linear to log table, which the Voice Generator will use to convert a linear sample whilst in the Fill code.
This was deprecated back in the early days of RISCOS, Voice Generators should always be within Modules as they’re entered in IRQ mode and should be memory resident. That said, many games back in the day did have them in application space, but they weren’t designed to run under the desktop. |
David Feugey (2125) 2709 posts |
Broken links? |
Angel Perez (2908) 84 posts |
The broken link it was to David Saunder’s page that contained the download for WavGen32. |
Angel Perez (2908) 84 posts |
I have a copy of MusicMaker, written in BASIC, converted to produce 32-bit sound modules thanks to the help of other users who suggested me to fix up the source code for compatibility reasons. However, I want to go further beyond the scope of the frequency, envelope and phase speeds and depths. I need a program like MusicMaker, like the WavGen32 software I couldn’t download from David Saunders’ web site because of that broken link. I need a voice generator program like MusicMaker that lets me produce frequency pitch bending envelopes as well as the usual amplitude envelopes. |