Music 5000 in B-Em

discuss bbc micro and electron emulators (including mame) here!
Post Reply
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Music 5000 in B-Em

Post by hoglet »

Hi Guys,

For a bit of light relief from all the Raspberry Pi Co Pro tweaking (and at the behest of alex_farlie), today I had a go at adding Music 5000 support (from Beech) into B-Em.

The code now is in github, and seems to work.
https://github.com/hoglet67/b-em/commit ... a776d467cb

It's included in both the Windows and Linux builds, and there is a new item on the sound menu to enable it. Also, make sure to disable internal sound filter, as it clobbers all the bass.

Sound quality could possibly be improved, as I'm having to down-sample from Music 5000's 46.875KHz stereo to B-Em's 31.250KHz mono.

There a few other pieces still to add, like supporting save/load state, and persisting the configuration back to disk.

Here's a windows binary:
b-em.zip
(365.54 KiB) Downloaded 307 times
Dave

PS Steve (Coeus) I did try to merge your VDFS work back into my fork, but it seems it doesn't compile on Windows. Is that expected?
Last edited by hoglet on Sat Oct 15, 2016 5:54 pm, edited 2 times in total.
User avatar
Pernod
Posts: 3439
Joined: Fri Jun 08, 2012 11:01 pm
Location: Croydon, UK
Contact:

Re: Music 5000 in B-Em

Post by Pernod »

Nice, could you create a bundle with all the required dll's, alleg44, alut, zlib1, etc.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

Pernod wrote:Nice, could you create a bundle with all the required dll's, alleg44, alut, zlib1, etc.
Here you go:
https://www.dropbox.com/s/eukub3y8kloq8 ... e.zip?dl=0

To try the Music 5000 stuff:
- Start B-Em (and make sure you are in Master 128 mode)
- Settings/Sound enable "Music 5000"
- Settings/Sound disable "Internal Sound Filter" (should already be disabled)
- Disc/Load Drive 0/2 as Music5000.ssd (in the discs directory)
- Shift F12 (to load the ROMs)
- Shift F12 (to load AMPLE)
- scroll down to Load Program and hit return
- enter ppach as a filename and hit return
- hit return one more time tom Run Program

Dave
alex_farlie
Posts: 179
Joined: Sun Jul 07, 2013 10:46 pm
Contact:

Re: Music 5000 in B-Em

Post by alex_farlie »

hoglet wrote:
Pernod wrote:Nice, could you create a bundle with all the required dll's, alleg44, alut, zlib1, etc.
Here you go:
https://www.dropbox.com/s/eukub3y8kloq8 ... e.zip?dl=0

...

Dave
Working as designed. Although ideally someone should clear the M5000 disc with the relevant people :) Dropbox can get fussy sometimes :(
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

alex_farlie wrote: Although ideally someone should clear the M5000 disc with the relevant people :) Dropbox can get fussy sometimes :(
FYI, Chris Jordan, creator of the original Music 5000 and AMPLE has been very supportive of efforts to keep Music 5000 alive.

And he's also reasonably active on stardot (CHRISJJ):
http://www.stardot.org.uk/forums/search ... 9&sr=posts

Dave
alex_farlie
Posts: 179
Joined: Sun Jul 07, 2013 10:46 pm
Contact:

Re: Music 5000 in B-Em

Post by alex_farlie »

hoglet wrote:
alex_farlie wrote: Although ideally someone should clear the M5000 disc with the relevant people :) Dropbox can get fussy sometimes :(
FYI, Chris Jordan, creator of the original Music 5000 and AMPLE has been very supportive of efforts to keep Music 5000 alive.

And he's also reasonably active on stardot (CHRISJJ):
http://www.stardot.org.uk/forums/search ... 9&sr=posts

Dave
Well I've been testing stuff, and found some files in 8BS that won't necessarily play using the MUSIC 5000 disc supplied. Also trying to use AMPLE with a second processor locks up the emulator ( I have my suspicions it will do that on a real Beeb as well.). Perhaps C. Jordan can help figure out what's up with the iffy tunes.
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

alex_farlie wrote: Well I've been testing stuff, and found some files in 8BS that won't necessarily play using the MUSIC 5000 disc supplied. Also trying to use AMPLE with a second processor locks up the emulator ( I have my suspicions it will do that on a real Beeb as well.). Perhaps C. Jordan can help figure out what's up with the iffy tunes.
When you say "locks up the emulator", do you mean it hangs and doesn't even respond to Ctrl-Break (F12)?

One interesting aspect of the Music 5000 is that all of the registers it implements are write-only.

What that means (I think) is there is no way that any software on the Beeb can be influenced by it's presence, or for that matter even detect whether it's connected or not.

In B-Em you can untick "Music 5000" in the settings menu, and AMPLE will still run, and go through the motions of playing music.

I think any conflicts or crashes you see would likely be happening on an original Music 5000 system as well.

Dave
alex_farlie
Posts: 179
Joined: Sun Jul 07, 2013 10:46 pm
Contact:

Re: Music 5000 in B-Em

Post by alex_farlie »

hoglet wrote:
alex_farlie wrote: Well I've been testing stuff, and found some files in 8BS that won't necessarily play using the MUSIC 5000 disc supplied. Also trying to use AMPLE with a second processor locks up the emulator ( I have my suspicions it will do that on a real Beeb as well.). Perhaps C. Jordan can help figure out what's up with the iffy tunes.
When you say "locks up the emulator", do you mean it hangs and doesn't even respond to Ctrl-Break (F12)?
(Well I can use Ctrl F12 to recover, so it's locking up the emulated BEEB, and I think it does this on the original as well.)
hoglet wrote: One interesting aspect of the Music 5000 is that all of the registers it implements are write-only.

What that means (I think) is there is no way that any software on the Beeb can be influenced by it's presence, or for that matter even detect whether it's connected or not.

In B-Em you can untick "Music 5000" in the settings menu, and AMPLE will still run, and go through the motions of playing music.

I think any conflicts or crashes you see would likely be happening on an original Music 5000 system as well.

Dave
Coeus
Posts: 3557
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: Music 5000 in B-Em

Post by Coeus »

That's an interesting one. I had not heard of the Music 5000 prior to joining here. I do have a Music 500 somewhere but that definitely seems like a smaller unit and I am not sure where the software is. I assume the manufacturers did a range of these?
hoglet wrote:PS Steve (Coeus) I did try to merge your VDFS work back into my fork, but it seems it doesn't compile on Windows. Is that expected?
I suppose it shouldn't be a surprise as I don't have a Windows development environment so I haven't tried compiling it on Windows but it wasn't my intention to write Linux-only code. It's mostly ANSI C and the small bits of the POSIX interface it uses are ones I thought Windows C compilers typically implemented.

Which Windows compiler are you using to compile it?
User avatar
paulv
Posts: 3866
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: Music 5000 in B-Em

Post by paulv »

Coeus wrote:That's an interesting one. I had not heard of the Music 5000 prior to joining here. I do have a Music 500 somewhere but that definitely seems like a smaller unit and I am not sure where the software is. I assume the manufacturers did a range of these?
The Music 500 and Music 5000 are essentially the same device but the 5000 has a minor timing mod to the PCB allowing it to work reliably on a Master. The Music 500 can have this done essentially making it Master compatible and a 5000 all at the same time.

To see the entire range of Hybrid Music System hardware, take a look here... http://www.retro-kit.co.uk/Hybrid-Music-System/.

The Music 3000 is essentially a Music 5000 but sat at a different address on the 1MHz bus.

There's also the Peartree Computers Music 87 which is again a Music 500/5000 but licensed Peartree Computers and shipped with different software.

Paul
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

Coeus wrote: I suppose it shouldn't be a surprise as I don't have a Windows development environment so I haven't tried compiling it on Windows but it wasn't my intention to write Linux-only code. It's mostly ANSI C and the small bits of the POSIX interface it uses are ones I thought Windows C compilers typically implemented.

Which Windows compiler are you using to compile it?
I'm using the same MinGW based environment that I use for Atomulator (which is think is how it was originally built). It uses GCC 4.6.2

This came from Kees, who I think got it from Phill.

It's pretty big (~500MB) so too big to upload here. If you are interested, I can upload a copy to dropbox.

Dave
User avatar
pixelblip
Posts: 4051
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Music 5000 in B-Em

Post by pixelblip »

This is fantastic you got this working.


I think B-Em is a really nice emulator................

It would be cool if you could attach a midi keyboard and play into the 5000 like the 4000........that would be awesome.

Music 5000..........second time around it's even better :)
Hedge
Posts: 16
Joined: Thu Feb 23, 2012 11:00 am
Contact:

Re: Music 5000 in B-Em

Post by Hedge »

hoglet wrote:
Pernod wrote:Nice, could you create a bundle with all the required dll's, alleg44, alut, zlib1, etc.
Here you go:
https://www.dropbox.com/s/eukub3y8kloq8 ... e.zip?dl=0

To try the Music 5000 stuff:
- Start B-Em (and make sure you are in Master 128 mode)
- Settings/Sound enable "Music 5000"
- Settings/Sound disable "Internal Sound Filter" (should already be disabled)
- Disc/Load Drive 0/2 as Music5000.ssd (in the discs directory)
- Shift F12 (to load the ROMs)
- Shift F12 (to load AMPLE)
- scroll down to Load Program and hit return
- enter ppach as a filename and hit return
- hit return one more time tom Run Program

Dave
Hi Dave

Just a note to say thanks for all the work you did on this. =D>
I've always wanted an emulated Music 5000 but my software skills just weren't up to the task
of implementing it myself. Great job! :)

Now if only the evil downmix step could be removed without breaking the code and we could have the beautiful noises
of the music 5000 in all it's original glory and fidelity! (hint hint) :)

Regards
Hedge
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

Hedge wrote:Now if only the evil downmix step could be removed without breaking the code and we could have the beautiful noises
of the music 5000 in all it's original glory and fidelity! (hint hint) :)
Yes, this annoys me as well.

The problem is that currently B-Em shares an open OpenAL source, running at 31.25KHz, for internal, SID and Music5000.
https://github.com/hoglet67/b-em-ARCHIV ... enal.c#L73

Now, what I've only just spotted is that it uses a seperate source, running at 44.1KHz, for disk drive noise.
https://github.com/hoglet67/b-em-ARCHIV ... enal.c#L93

So in principle we could create a third source for Music5000 that runs at the correct rate of 46.875KHz (6MHz/128).

What I don't know is whether this would be any better, or whether it just moves the sound re-sampling into the sound card driver.

Might be worth a try though....

Dave
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

Hedge wrote: Now if only the evil downmix step could be removed without breaking the code and we could have the beautiful noises
of the music 5000 in all it's original glory and fidelity! (hint hint) :)
I've been experimenting a bit this afternoon. I've created a dedicated OpenAL source for Music 5000, and an feeding it proper stereo samples at 46.875KHz sampling rate. This avoids having to re-sample to 31.25KHz in the B-Em Music 5000 Code.

Now, I'm 99.9% sure that the sound card driver will re-sample this anyway, probably to 44.1KHz.

If you fancy being a guinea pig, then here's an experimental version you could try:
b-em.zip
(379.18 KiB) Downloaded 186 times
Just copy b-em.exe over the top of your existing version.

I'm interested if you thing this is better, worse or about the same as the previous build.

What is your preferred test track?

Do you have a real Music 5000 as a reference?

If it sounds OK with one or two voiced, and rubbish with many voices, then it's possible the arithmetic is overflowing. This is easily fixed.

Edit: I'm pretty sure "In Concert" of the included disk is overflowing.

Dave
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

I've just done a comparison between B-Em and BeebFpga, which is the nearest I have to real Music 5000 hardware.

As a test track I'm using A Pilgrim PachelBel (ppach) on Music5000.ssd

Frankly, B-Em sounds absolutely dreadful in comparison, with lots of noise.

This must be down to one of two things:
- the default linear resampling done by OpenAl
- a bug in the Music 5000 emulation in B-Em

The emulation code we are using came from Beech, and this in turn was based on BeebFpga, so they should in principle sound the same.

Dave
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

After a good debugging session with BigEd this afternoon, Music 5000 in B-Em is now sounding much much better.

It turns out there were a three bugs in the B-Em emulation of Music 5000 that were making it sound rubbish:

1. Each channel pair had two independent phase accumulators, which was causing glitches when modulating between channels.

You can clearly see that here:
cb772110-ff49-11e6-8903-b0aee1ea7491.JPG
Compared to the FPGA implementation here:
cb76a97e-ff49-11e6-8cfd-6b3030ff5c29.JPG
The original hardware definitely only has one phase accumulator per channel pair.

This in fact was the main cause of the rubbish sound.

2. The way amplitude was implemented was incorrect. It used a multiplication operator, where as in the log domain it should use addition.

3. One bit of dynamic range was being thrown away unnecessarily.

I'd like to get some feedback (if anyone is interested) before committing this code back upstream. So here's a test Windows build that includes it:
b-em.zip
(378.23 KiB) Downloaded 207 times
There's a bit more detail and discussion in the issue if anyone is interested:
https://github.com/stardot/b-em/issues/11

Fixes in github are here:
https://github.com/hoglet67/b-em/commits/db-music5000

Overall the volume is a bit quiet still, but that a generic B-Em/openal issue.

Dave
User avatar
ThomasAdam
Posts: 95
Joined: Tue Feb 07, 2017 9:35 am
Location: Southampton, England
Contact:

Re: Music 5000 in B-Em

Post by ThomasAdam »

Thanks, Hoglet. I look forward to a pull-request. :)
Hedge
Posts: 16
Joined: Thu Feb 23, 2012 11:00 am
Contact:

Re: Music 5000 in B-Em

Post by Hedge »

hoglet wrote:After a good debugging session with BigEd this afternoon, Music 5000 in B-Em is now sounding much much better.

It turns out there were a three bugs in the B-Em emulation of Music 5000 that were making it sound rubbish:

1. Each channel pair had two independent phase accumulators, which was causing glitches when modulating between channels.

You can clearly see that here:
cb772110-ff49-11e6-8903-b0aee1ea7491.JPG
Compared to the FPGA implementation here:
cb76a97e-ff49-11e6-8cfd-6b3030ff5c29.JPG

The original hardware definitely only has one phase accumulator per channel pair.

This in fact was the main cause of the rubbish sound.

2. The way amplitude was implemented was incorrect. It used a multiplication operator, where as in the log domain it should use addition.

3. One bit of dynamic range was being thrown away unnecessarily.

I'd like to get some feedback (if anyone is interested) before committing this code back upstream. So here's a test Windows build that includes it:
b-em.zip
There's a bit more detail and discussion in the issue if anyone is interested:
https://github.com/stardot/b-em/issues/11

Fixes in github are here:
https://github.com/hoglet67/b-em/commits/db-music5000

Overall the volume is a bit quiet still, but that a generic B-Em/openal issue.

Dave
Hi Dave

Yes, I gave that build a whirl and it is MUCH better now :D
More thanks are in order!

All the best
Hedge
User avatar
pixelblip
Posts: 4051
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: Music 5000 in B-Em

Post by pixelblip »

Brill work Hoglet. Thank you for your effort............you have really gone into detail........I can't wait to try it out in B-em soon.
User avatar
bakoulis
Posts: 371
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: Music 5000 in B-Em

Post by bakoulis »

I can't compiling on Linux Mint 17.3
I can't find even the Makefile.linux
Some help please?
:(
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

bakoulis wrote:I can't compiling on Linux Mint 17.3
I can't find even the Makefile.linux
Some help please?
:(
What source tree are you trying to compile (as this pull request hasn't actually been merged yet)?

You'll need to provide a few more details of the errors. Please can you post a complete build log of:

Code: Select all

cd b-em
./autogen.sh
./configure
make clean
make
Dave
User avatar
ThomasAdam
Posts: 95
Joined: Tue Feb 07, 2017 9:35 am
Location: Southampton, England
Contact:

Re: Music 5000 in B-Em

Post by ThomasAdam »

hoglet wrote:
bakoulis wrote:I can't compiling on Linux Mint 17.3
I can't find even the Makefile.linux
Some help please?
:(
What source tree are you trying to compile (as this pull request hasn't actually been merged yet)?

You'll need to provide a few more details of the errors. Please can you post a complete build log of:

Code: Select all

cd b-em
./autogen.sh
./configure
make clean
make
Dave
... and, should ./configure fail, a copy of config.log
User avatar
bakoulis
Posts: 371
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: Music 5000 in B-Em

Post by bakoulis »

Code: Select all

~/b-em-master ᐅ ./autogen.sh
fatal: Not a git repository (or any of the parent directories): .git
configure.ac:8: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.14/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:8: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
aclocal failed
I have already compiled and working an older version of b-em with M5000 support from your git repo.
This version was compiled and ready with only one command!
It needed make command from /src directory and was ready to go without errors!
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

I think the problem is you have somehow not checked out the git repository correctly.

Try starting afresh, and reclone:

Code: Select all

mkdir test
cd test
git clone -b db-music5000 https://github.com/hoglet67/b-em.git
cd b-em
./autogen.sh
./configure
make clean
make
Dave
User avatar
bakoulis
Posts: 371
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: Music 5000 in B-Em

Post by bakoulis »

Yes, this was the problem. I had download the git from my browser as usual.
Last time it had worked
:shock:
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

bakoulis wrote: Last time it had worked
:shock:
The build script is now smarter - it tries to construct a version string that include the git commit number, so when people get problems they can easily tell exactly what version they were running. So that does now need a proper clone from git to work.

By the way, I just (5 mins ago) fixed a small bug in the Music 5000 code that was causing a crash if the track ever clipped.

You might want to rebuild:

Code: Select all

cd b-em
git fetch
git rebase
make
Dave
User avatar
bakoulis
Posts: 371
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece
Contact:

Re: Music 5000 in B-Em

Post by bakoulis »

Thanks for the help and for the update!
:D
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.
Hedge
Posts: 16
Joined: Thu Feb 23, 2012 11:00 am
Contact:

Re: Music 5000 in B-Em

Post by Hedge »

hoglet wrote:
bakoulis wrote: Last time it had worked
:shock:
The build script is now smarter - it tries to construct a version string that include the git commit number, so when people get problems they can easily tell exactly what version they were running. So that does now need a proper clone from git to work.

By the way, I just (5 mins ago) fixed a small bug in the Music 5000 code that was causing a crash if the track ever clipped.

You might want to rebuild:

Code: Select all

cd b-em
git fetch
git rebase
make
Dave
Hey Dave could you post the windows exe with the clip bugfix here?
Many thanks!

-hedge
User avatar
hoglet
Posts: 12678
Joined: Sat Oct 13, 2012 7:21 pm
Location: Bristol
Contact:

Re: Music 5000 in B-Em

Post by hoglet »

Hedge wrote: Hey Dave could you post the windows exe with the clip bugfix here?
Many thanks!
This work has now been pushed back upstream into the stardot b-em respostory.

Edit: Replaced with later build a few posts down.

Dave
Last edited by hoglet on Mon Mar 06, 2017 5:14 pm, edited 1 time in total.
Post Reply

Return to “8-bit acorn emulators”