Can I have my BBC in stereo?

on-topic Acorn-related news and discussions not covered by the other forums
Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Can I have my BBC in stereo?

Postby Commie_User » Fri Mar 10, 2017 9:51 pm

With a nice line-out mod. How would this conceivably work?

On the Commodore 64, you can piggyback two SID chips with a little tomfoolery. The Atari 2600 sound chip was actually designed for stereo in the prototype, with pins 12 and 13 shorted together for mono in the release models.

But the BBC? I rather fancy these beautiful envelopes coming at me in surround. Enveloping envelopes. Is this a pipe dream or can I have some kind of double decker? Or maybe someone somewhere has a circuit bend somewhere on EPROM. Or just one machine per independent channel together, which would also be no mean choice.

What's the judgement of the elders?

User avatar
simonm
Posts: 164
Joined: Mon May 09, 2016 2:40 pm
Contact:

Re: Can I have my BBC in stereo?

Postby simonm » Fri Mar 10, 2017 10:21 pm

There's only one very basic PSG in the Beeb, which has no concept of stereo whatsoever.
So at the very least, you'd need to macgyver an additional chip into the system somehow, which I would imagine is Quite Hard.
Then you'd need some music that's authored for stereo (otherwise whats the point?) and I do not know where you'd get such music.
I'm sure you could wire up a stereo jack to the speaker cables though, would still be mono tho.

Short version: Unfortunately not.

User avatar
tricky
Posts: 1811
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Can I have my BBC in stereo?

Postby tricky » Sat Mar 11, 2017 12:53 am

Only answering the where would you get music from bit:

There were several arcade machines with more than one SN76489 and their VGMs are around the web.

User avatar
1024MAK
Posts: 6666
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...

Re: Can I have my BBC in stereo?

Postby 1024MAK » Sat Mar 11, 2017 7:24 am

There is a further complication in that the SN76489 does not actually know anything about sound envelopes. On the Beeb, the sound envelope control is done by the system software. So if you wanted to use two SN76489 chips to give a two channel/stereo output, the machine code sound routines would need extensive rewriting.

Of course, this would not be a problem for machine code that has been coded to directly drive the existing SN76489 and an additional SN76489.

From a hardware perspective, it would not be that hard to add a second SN76489 sound chip.
But as there is no (known) existing software, only new software written with this in mind would make use of the second sound chip :(

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sat Mar 11, 2017 10:37 am

Commie_User wrote:I rather fancy these beautiful envelopes coming at me in surround. Enveloping envelopes.

I know this isn't what you are asking for, and you probably aren't interested in emulation, but can I just mention that my (free) SDL-based editions of BBC BASIC (for Windows, Linux, Mac OS-X, Android and Raspberry Pi) all support an almost complete emulation of the BBC Micro's SOUND and ENVELOPE statements plus the *STEREO command that allows you to place each of the four sound channels anywhere on the stereo 'stage'.

In addition, the *VOICE command allows you to assign each sound channel to one of ten preset 'voices' (very much like organ stops), giving tones from a sine-wave at one extreme to a very reedy sound at the other (the default is a BBC Micro-like square wave). If that isn't enough, the sound output is 16-bits at 44.1 kHz sampling so this is 'BBC Micro' sound in a higher fidelity than you've ever heard it before!

These editions of BBC BASIC also support reallocating SOUND channel zero from being a noise channel to a fourth 'tone' channel, which can be very useful when you would prefer 4-voice music and have no need for noise.

Richard.

User avatar
hoglet
Posts: 6352
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Can I have my BBC in stereo?

Postby hoglet » Sat Mar 11, 2017 10:39 am

The Hybrid Music 5000 is actually stereo, and you can now experience that in B-Em.

User avatar
simonm
Posts: 164
Joined: Mon May 09, 2016 2:40 pm
Contact:

Re: Can I have my BBC in stereo?

Postby simonm » Sat Mar 11, 2017 11:16 am

tricky wrote:There were several arcade machines with more than one SN76489 and their VGMs are around the web.


Good point! I forgot about that. I found a few of these when we were porting VGMs to Beeb, but my conversion script barfed because they contained data for 2x SN chips.

It kinda makes sense to have two, since you can allocate one for the left output and one for the right output. Stereo panning can then be easily done by playing the same tone on both chips but with respective volumes set to the stereo mix.
So you could have upto 6 tone generators and 2 noise channels in mono, or 4 stereo channels, or a mix of both.
It would certainly be cool, but I've no idea how feasible that is to do in hardware.

paulb
Posts: 761
Joined: Mon Jan 20, 2014 9:02 pm

Re: Can I have my BBC in stereo?

Postby paulb » Sat Mar 11, 2017 12:26 pm

Interesting link regarding the hardware: Experimenting with an Arduino and a SN76489. The stereo part is at the end.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Sun Mar 12, 2017 12:10 am

Richard Russell wrote:
Commie_User wrote:I rather fancy these beautiful envelopes coming at me in surround. Enveloping envelopes.

I know this isn't what you are asking for, and you probably aren't interested in emulation, but can I just mention that my (free) SDL-based editions of BBC BASIC (for Windows, Linux, Mac OS-X, Android and Raspberry Pi) all support an almost complete emulation of the BBC Micro's SOUND and ENVELOPE statements plus the *STEREO command that allows you to place each of the four sound channels anywhere on the stereo 'stage'.


Richard.



That's wonderful! I bought one of your BBC BASIC For Windows packages about eight years ago and so I had no idea of this kind of thing in the meantime.

This certainly falls into what I like.

User avatar
BigEd
Posts: 1387
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Can I have my BBC in stereo?

Postby BigEd » Sun Mar 12, 2017 6:35 am

Richard Russell wrote:... my (free) SDL-based editions of BBC BASIC (for Windows, Linux, Mac OS-X, Android and Raspberry Pi) all support an almost complete emulation of the BBC Micro's SOUND and ENVELOPE statements plus the *STEREO command that allows you to place each of the four sound channels anywhere on the stereo 'stage'.

I did spin up the OSX version the other day and ran through some of the (graphical) demos - great stuff! Thanks for making this port and making it available.

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sun Mar 12, 2017 10:25 am

Commie_User wrote:That's wonderful! I bought one of your BBC BASIC For Windows packages about eight years ago and so I had no idea of this kind of thing in the meantime.

There's an HQSOUND library available for BBC BASIC for Windows which provides a similar capability, but it's integrated in BBC BASIC for SDL 2.0 and therefore easier to use. Here's a demonstration of the *VOICE and *STEREO capabilities, in conjunction with the standard SOUND and ENVELOPE statements; the various 'organ stops' are spread across the stereo stage (best appreciated with headphones):

https://www.youtube.com/watch?v=9FtJ2D3gJtU

Richard.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Sun Mar 12, 2017 12:28 pm

That's magic. I'll get some of that when I have the readies.

I'm still enjoying that old package, with its very organy richness on my type-ins. I enjoy making chiptunes and I class it as an equal alongside my real BBCs, Commodore 64s and even Nintendo Entertainment System with its MIDI cartridge.

I mean that as a huge compliment.

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sun Mar 12, 2017 6:24 pm

Commie_User wrote:That's magic. I'll get some of that when I have the readies..

BBCSDL (for Windows, Linux, Mac OS-X, Android and Raspberry Pi) is entirely free. The only product I charge for is the full version of BBC BASIC for Windows, and since you already have a copy you are entitled to free updates anyway.

Richard.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Sun Mar 12, 2017 7:24 pm

Richard Russell wrote:
Commie_User wrote:That's magic. I'll get some of that when I have the readies..

BBCSDL is entirely free.


Cheers. I'm having a twiddle now. What's the syntax for the *STEREO command? I didn't see it in your help file. I'd like to start using my test listing first, though it sounds way different on the interpreter to how it does on a real Beeb, where it's actually musical:

10 FOR T=1TO95
20 SOUND 0,-15,T,2
30 SOUND 1,-15,T,1
40 IF T>60 THEN SOUND 2,-15,T*2,1
50 IF T>80 THEN SOUND 2,-15,T*3,1
60 CLS: PRINT T
70 NEXT T
80 RUN


BBC Micro clip:
MOV02680.MPG
(4.08 MiB) Downloaded 13 times

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sun Mar 12, 2017 9:13 pm

Commie_User wrote:What's the syntax for the *STEREO command?

*STEREO channel,pan

where channel = 0, 1, 2 or 3
pan = -127 (fully left) to 127 (fully right), 0 is centre

it sounds way different on the interpreter to how it does on a real Beeb, where it's actually musical:

SOUND channel 0 is white noise only. BB4W and BBCSDL make no attempt to emulate the strange 'pitched' noise feature of the Beeb (I thought you had BB4W already?). Set the third parameter only to 4, 5, 6 (it makes no difference).

Richard.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Sun Mar 12, 2017 9:39 pm

God, that's good. I'm going to enjoy sampling that with all these envelopes and programs I've collected up. And it will make layering samples for stereo quicker and fuller for mixing.

Thanks again. Real Beeb and this makes for a good rich mix.


Richard Russell wrote: BB4W and BBCSDL make no attempt to emulate the strange 'pitched' noise feature of the Beeb (I thought you had BB4W already?).


Pity, that's a nice easy way for interesting percussion. Though I never played with the noise channel 'til I got a real BBC of my own at last, as it didn't do much for me when using the software alone.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Sun Mar 12, 2017 10:10 pm

simonm wrote: It kinda makes sense to have two, since you can allocate one for the left output and one for the right output. Stereo panning can then be easily done by playing the same tone on both chips but with respective volumes set to the stereo mix.

I've no idea how feasible that is to do in hardware.


Well, two Beebs, the same program but with amended volume levels should do the job. A trip to Ebay for even a battered one can gain that extra gubbins, as I don't want to open my nice one for a line out mod.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Sun Mar 12, 2017 10:24 pm

Richard Russell wrote:I know this isn't what you are asking for, and you probably aren't interested in emulation, but can I just mention that my (free) SDL-based editions of BBC BASIC (for Windows, Linux, Mac OS-X, Android and Raspberry Pi) all support an almost complete emulation of the BBC Micro's SOUND and ENVELOPE statements plus the *STEREO command that allows you to place each of the four sound channels anywhere on the stereo 'stage'


OK, so my only last question is when will the full version come out? I notice the free version has greyed-out buttons, including Compile and I'd like to get my hands on it as soon as possible. (Especially if sound channel commands can be reallocated to MIDI output channels on directly assignable MIDI devices. That would be sooooo fantastic, if that was real!)

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sun Mar 12, 2017 11:30 pm

Commie_User wrote:I notice the free version has greyed-out buttons, including Compile

It's not a "free version" - BBCSDL will always be completely free. What you see is what you get!

As far as the 'Compile' facility is concerned it's not clear what exactly that would do in the context of a cross-platform product. For example in Windows you can create a standalone EXE file (like BB4W does) but there is no similar capability in Linux. And although Android and Mac OS-X do have 'standalone' apps (consisting of a 'bundle' of files in a container) it would be far from straightforward for BBC BASIC to build them automatically.

So for the time being, at least, you would have to use the standard tools available on the various platforms to build an application.

Since both IDEs supplied with BBCSDL (mine and Andy Parkes') are themselves written in BBC BASIC, with the source code provided, 'community contributions' are of course welcome. Perhaps somebody more knowledgeable than I am will submit code for the Compile button!

Richard.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Mon Mar 13, 2017 12:18 am

Richard Russell wrote:Perhaps somebody more knowledgeable than I am will submit code for the Compile button!


Whoa, I never expected that kind of language from an emperor! :lol:


It is a beautiful freebie, especially with your QBASIC to BBC BASIC converter I just found. So what do I want, jam on it? Well I just thought I'd ask.

I'm going to enjoy some great times on it. I've got the second part of my stereo, if absolutely nothing else!

Thanks to everybody, especially Richard!

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Mon Mar 13, 2017 9:26 am

Commie_User wrote:Whoa, I never expected that kind of language from an emperor!

SDL (Simple Directmedia Layer), on which BBCSDL is based, is an 'abstraction layer': it allows you to develop cross-platform applications without needing to understand the target platform in any detail. So although that has allowed me to develop versions of 'my' BBC BASIC for Linux, Mac OS and Android it doesn't mean that I have become an expert on those Operating Systems; quite the contrary!

Therefore, when it comes to creating standalone applications - or anything else that SDL doesn't provide an API for - I'm as much in the dark as you are. For example one major omission from BBCSDL is any support at all for hardcopy output (e.g. to a printer) because SDL provides no such facility.

So you shouldn't be surprised that I am reliant on contributions from others, particularly those who have experience of the inner workings of Linux, Mac OS and Android. I would encourage anybody with such experience, especially if they also know BBC BASIC, to help expand the capabilities of BBCSDL.

Richard.

Commie_User
Posts: 863
Joined: Wed Jan 27, 2016 12:50 am

Re: Can I have my BBC in stereo?

Postby Commie_User » Wed Mar 15, 2017 4:25 pm

So here's some stereo BBC, using my instant music program.

First, the straight recording of the master listing, shown below. Then the twin-pass stereo version, both channels of the recording a little different for a soundstage effect. It's as balanced as possible to sound normal in mono sum.

Electronic Beebery.mp3
(3.13 MiB) Downloaded 20 times


DSC02950.JPG



Someone surely has to build a twin-layer chip bay for the sound, as lining up two Beebs will certainly result in a phase effect - maybe unless you lock them together. Indeed, there was still unavoidable phase when making two identical recordings from the same BBC and lining them up in a sequencer.

So my old standby of using a mixture of wholly different micros for chiptuning will avoid clash again. So I'd like to thank Richard for making it so easy to tease out the BBC's hidden rhythm and have it jam. And present that liberated sound for us.



http://stardot.org.uk/mirrors/www.bbcdo ... _mm_02.htm

Coeus
Posts: 407
Joined: Mon Jul 25, 2016 11:05 am

Re: Can I have my BBC in stereo?

Postby Coeus » Fri Apr 14, 2017 4:27 pm

Richard Russell wrote:As far as the 'Compile' facility is concerned it's not clear what exactly that would do in the context of a cross-platform product. For example in Windows you can create a standalone EXE file (like BB4W does) but there is no similar capability in Linux...


I don't believe there is an API call so say "save the state of the current application as a new executable" on Linux, though emacs has historically done some trickery to do exactly that. If you can generate something (C, assembler etc.) that can go through the normal compile/link process to generate an executable then there is the option of static vs. dynamic linking so if all the support routines a compiled BASIC program relied on were in a static library (.a file) it would be possible to produce a standalone executable.

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Fri Apr 14, 2017 5:11 pm

Coeus wrote:if all the support routines a compiled BASIC program relied on were in a static library (.a file) it would be possible to produce a standalone executable.

I can easily provide the BBCSDL run-time engine as a .a file rather than a binary, if that's all it takes. If I do that, are you offering to write the BBC BASIC code for the Compile button? 8)

Richard.

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sat Apr 15, 2017 9:48 am

Coeus wrote:if all the support routines a compiled BASIC program relied on were in a static library (.a file) it would be possible to produce a standalone executable.

OK, your wish is my command! You can download the BBCSDL Runtime Engine (for x86 Linux) as a static library from here. It has exactly the same building blocks as the binary executable (bbcsdl) so of course needs to be linked with SDL2 and SDL2_ttf. I'm not entirely sure what you hope to do with it, but I will be very interested to see any results.

Richard.

Coeus
Posts: 407
Joined: Mon Jul 25, 2016 11:05 am

Re: Can I have my BBC in stereo?

Postby Coeus » Sat Apr 15, 2017 11:19 am

Richard Russell wrote:OK, your wish is my command! You can download the BBCSDL Runtime Engine (for x86 Linux) as a static library from here. It has exactly the same building blocks as the binary executable (bbcsdl) so of course needs to be linked with SDL2 and SDL2_ttf. I'm not entirely sure what you hope to do with it, but I will be very interested to see any results.


With undocumented object code I shan't be doing anything at all. I was merely saying that packaging the compiled basic program as a standalone executable once it has been compiled is solvable. To get to that point you have to have a compiled program in some form.

I did, however, download the Linux version of BBCSDL to try out. After installing the required 32bit libraries I got it to the point where a window entitled "Choose IDE" briefly appeared on screen and then it stopped with a segmentation fault. Running under gdb to get the stack trace gives:

Code: Select all

Thread 1 "bbcsdl" received signal SIGSEGV, Segmentation fault.
0xf652a527 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
(gdb) bt
#0  0xf652a527 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#1  0xf652d832 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#2  0xf6523c38 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#3  0xf650cfdb in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#4  0xf62dceed in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#5  0xf62c78b1 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#6  0xf62d9e75 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#7  0xf61c371f in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#8  0xf61c3c11 in ?? () from /usr/lib32/xorg/modules/dri/i965_dri.so
#9  0xf7ec497c in ?? () from /usr/lib32/libSDL2-2.0.so.0
#10 0x080561b3 in error ()
#11 0x08282ec0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Richard Russell
Posts: 163
Joined: Sun Feb 27, 2011 10:35 am

Re: Can I have my BBC in stereo?

Postby Richard Russell » Sat Apr 15, 2017 12:00 pm

Coeus wrote:I was merely saying that packaging the compiled basic program as a standalone executable once it has been compiled is solvable.

Bear in mind that no "compiled BASIC program" is involved - BBC BASIC is an interpreted language! What one has to do to make a standalone executable is to package the BASIC program and the Runtime Engine together in such a way that the latter automatically runs the former, just like BBC BASIC for Windows does. The issue with Linux is not that this is inherently any harder than it is in Windows, but that the multiple 'flavours' of Linux make it difficult to create a 'universal binary'.

a window entitled "Choose IDE" briefly appeared on screen and then it stopped with a segmentation fault.

Nothing to do with me - it's not crashing in my code (looks like it's in a driver of some sort?). The beauty of using an abstraction layer is that one can honestly say "it's alright leaving me" (my code is identical in WIndows, Linux, Mac OS and Android)! Do you happen to know which version of SDL2 is available from your repository? The current version is 2.0.5 but the repo version often seems to be lagging behind which could be a factor. If you're sufficiently motivated you could try reporting the crash at the SDL forum.

Richard.


Return to “general”

Who is online

Users browsing this forum: No registered users and 4 guests