ARM BASIC: SOUND extension?
Alex Farlie (3076) 16 posts |
Wishlist – Documentation on the Sound System and WaveSynth. Proposal (wishlist) 1. Treat parameter1 of SOUND as a 32bit vlaue with value above &8000 as being a reference to an internally defined WaveTable or VoiceGenerator? "The sound data to be played is mixed into the general output appropriately, possibly using a ‘free’ channel if one exists. If a string parameter is supplied, treat the string as the name of an installed VoiceGenerator, and play the sound using it. 2. Treat a “String” Parameter3 of a SOUND command as being a reference to a standard note name. i.e “B3” would produce a tone just below Middle C. Assume a default octave if there was none specifed. The interpreter would note the string parameter, translating it into an appropriate pitch value. 3. ENVELOPE support ? This has not listed in the PRM, but it would be nice to be able to port old BBC Micro listings over to the Pi. :) |
Robert Hampton (1923) 57 posts |
I think the RDSP module from AmCoG will handle point 3 for you. http://www.amcog-games.co.uk/rdsp.htm |
Rick Murray (539) 13840 posts |
What’s wrong with assigning the named voice to a sound channel first? I’m not at the computer but IIRC it’s *ChannelVoice ? Or some fancy SWI call that does the same thing.
I could see that could be useful, for those who think in terms of notation rather then amounts of hertz.
Envelope is fully supported. |
Alex Farlie (3076) 16 posts |
I’ll look into RDSP, So that potentially solve one part of the proposal.. On RISC OS the CHANNELVOICE is limited to 8(?) channels, and unlike MIDI, there isn’t any notion of polyphony. ( Of course having a SOUND command, that let you send MIDI commands directly from BASIC would be awesome as well. Granted given the space in the ROM, it would probably sound worse than an old PC sound card in terms of quality.) At one point someone had implemented a partial AMPLE on RISC OS 3.5, but it was incomplete, and so tied into the Risc PC’s internals that it wasn’t worth trying to 32bit (Someone active here tried….) |
Rick Murray (539) 13840 posts |
Yup. The eight channels provided by the default sound system.
Not to mention basic things like sustain (or not) and pitch bending (hey, do you remember when keyboards (of the musical variety) all seemed to feature a wobble knob because pitch bending was the in thing?). I think the best way of doing that would be to create sound samples in a virtual buffer and simply send that to the audio system, as if playing a wave file.
Oh, I don’t know. MuseScore on the PC uses SoundFont, and it sounds quite different to my Yamaha keyboard, which sounds quite different to a professional synth. I think, like pianos, different sounds help give character to a piece of music. If you want horror – try to imagine the original Acorn MIDI module. It appears to have had a way of playing MIDI data… To WaveSynth and StringLib with only eight voices and little concept of a lot of what MIDI is capable of. I’ve never heard it in action. That’s probably a good thing. |
Jeffrey Lee (213) 6048 posts |
I’ve written assorted sound mixers over the years, but no sound generators as such. Possibly this is what you’re thinking of? https://www.iconbar.com/Building_the_Dream_2_-_The_RISC_OS_Sound_System/news1209.html
If you want good sound output, you probably shouldn’t be using the 8-bit sound system (which is what *ChannelVoice, SOUND, etc. interacts with). The 16-bit sound system (SharedSound, RDSP, etc.) is where you want to be, because you can write your own mixer which can deal with as many voices or effects as you like (well, until you run out of CPU cycles), with proper stereo output. So from that perspective it would make more sense to just find or implement a module which does what you want, and then write a few PROCs which act as wrappers for the SWI calls. No need to extend BASIC itself if PROCs and SWIs and LIBRARYs can implement the required functionality.
I can’t help you much with WaveSynth (although there are some notes at the end of the sources for the ADSR descriptor format), but for the sound system as a whole it’s worth checking out that Icon Bar article above. There’s also this wiki page which goes into the nitty-gritty on how mixing and volume controls are applied. |
nemo (145) 2546 posts |
Does anyone want me to document how WaveSynth and the contents of its WaveTable files actually work (the multiple wave tables, thousands of descriptors and eight separate envelopes)? Or are we all “Oh 8bit darling? That’s so last century!” now? |
Steve Pampling (1551) 8170 posts |
If it has no documentation on the wiki and there is the remotest chance that a document is needed then anyone with the knowledge should contribute what they have in the form of a new wiki page or two. Please note that the comment applies all across the board and not to one specific item.
That’s pretty much a description of: |
nemo (145) 2546 posts |
If you cut me, do I not bleep? |
Steve Pampling (1551) 8170 posts |
Ah, I see where you’re headed: “I will execute, and it shall go hard but I will better the instruction.” Well volunteered that man. 1 If you prick me… ?? |
Chris Hall (132) 3554 posts |
Does anyone want me to document how WaveSynth and the contents of its WaveTable files actually work Yes please. Then I might understand what I didn’t quite get right in !SignalBox where I try to simulate the sounds of signal box block bells. |
nemo (145) 2546 posts |
Two things. 1. I’ve written a utility 2. I’ve addressed a major limitation of WaveSynth by changing (I think) six instructions, making envelopes work better. So I now have WaveSynth 2.00. Also, does anyone have any idea what file type F96 “Sound” is? I can find no usage of it, ever. I’m reusing it here as “WaveTbl”. Audit The WaveTable format is complicated because it is terribly flexible – the file can be up to 16MB long (which won’t fit in the RMA, though that’s an implementation detail), and a 512KB file may contain only a single 256 byte wave, entirely legally, and without padding (and there’s no way of guessing where in that half-megabyte the wave might be), and apart from the first 256 bytes, anything can be anywhere, in any order. Key points:
I’m designing a proper wavetable editor, because the major design limitation of WaveSynth does make creating instruments more difficult than it should be – the fact that it doesn’t separate timbre from volume. Wavetable synthesisers would normally navigate the wave set independently from pitch and amplitude… but this version of WaveSynth ties them together, unfortunately (it does look like an enhancement was intended… but “Good Enough” happened). So for the volume envelope, you either have pitch-invariant wave oscillation, or you have pitch-dependent sample playing. You can switch between them from moment to moment, but you can’t have pitch-independent sample playing or pitch-dependent oscillation (except for the choice of eight envelopes). I’ll document things more formally when I’ve finished coding. |
David Pitt (3386) 1248 posts |
Archive Magazine Volume 14 Issue 5 page 83 in a review of WSS’s Sound PlugIn has filetype &F96 as AIFF. It also has &FC2 as AIFF. That’s AIFF twice then. There may have been more than one AIFF version back then, or maybe it is a typo in the Archive article. |
Steve Pampling (1551) 8170 posts |
Or slight confusion because of the secret squirrel status of the list because a check of the updated File Types document in the wiki lists only the FC2 – and that as AIFF I’m not sure whether that’s answered Nemo’s question or confused things further, but it is documented – just not presented in an obvious publicly viewable location. |
David Pitt (3386) 1248 posts |
OS4.39 MimeMap, as found on VRPC. audio/* GenSound f96 .voc voc appears to be a compressed format.
A bit of a search shows there was a compressed AIFF variant, but that was identified as AIFC or AIFF-C. |
Rick Murray (539) 13840 posts |
“Back in the day” there were several types for JPEG, ditto HTML, and maybe half a dozen teletext. I don’t know if Acorn were asleep, or if people just made stuff up… |
Steve Pampling (1551) 8170 posts |
Back in the day that happened probably as per my comments below. We also had the joy of multiple MIME files dotted around confusing the hell out of everyone. That, I think, has mostly been stamped out but there’s no accounting for user behaviour.
I think it all stems from that “confidential” tag. Various third parties applied to Acorn/whoever was managing the file type allocation1 and it was all confidential because no one wanted competitors to know what they were developing. Unless someone or some group of someone’s spend a lot of time on co-ordinating then you get multiple types allocated for the same function. Since &F96 is allocated already (as evidenced by the CVS header) then I think the correct route is to work on the code with a user allocated type 000 – &0FF I think and apply to ROOL for a long term official type – but I think that Nemo is historically familiar with all that. 1 Wasn’t Mr. Glover doing a lot of the donkey work somewhere along the way? |
nemo (145) 2546 posts |
David wrote
Good heavens. I would never have though of looking there, and there’s so few filetypes in there too. An old SoundBlaster format! Thanks, chaps. Obvs I’ll allocate one.
There should have been a mandatory embargo end date, after which the allocation is automatically made public. If you don’t want your filetype public, use the 000-0FF range, as intended!
I have a cache of emails from Alan, disproportionately sent from airports, for some reason. Usually complaining about the things he couldn’t allocate, which I’d asked him to. Deserves a medal. |
Rick Murray (539) 13840 posts |
+1 Also – why would generic formats be allocated repeatedly “because confidential”? If this browser is allocated type &xxx for HTML, and that browser is also allocated type &xxx for HTML – then what’s the harm? Yes, there might be a clash of who thinks they own the type, but this is no different than text files with Edit, SrcEdit, StrongEd, and Zap – a situation remedied on my system by auto starting Zap, the running application can grab it before run actions need to be considered. ;-) |
nemo (145) 2546 posts |
I considered a Filer that intercepted SetVarVal in order to cache all versions of |
Steve Pampling (1551) 8170 posts |
Keyboard shortcut Ctrl-O for that then. |
nemo (145) 2546 posts |
Yeah… though I’m assuming you knew what I meant instead of what I typed. |
Dave Higton (1515) 3525 posts |
Debugging is the process of closing the gap between what we wrote and what we thought we wrote. |
Steve Pampling (1551) 8170 posts |
Hey, if you slipped it in like the ROOL style ^R no one would know about it either way :) |
nemo (145) 2546 posts |
Rick asked
I got stung with this when I registered “PPD” (PostScript Printer Description) for John Tytgat and I to use – it’s filetype AB7, officially allocated. But not to be confused with “PPD” (PS Printer Description) filetype FBA, registered by Acorn for exactly the same thing. Thanks, Acorn. |