Screamer, 9.2.2 & Adventures with Sound

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

J. Gryphon
Student Driver
Posts: 19
Joined: Mon Jun 16, 2014 12:52 pm

Screamer, 9.2.2 & Adventures with Sound

Post by J. Gryphon »

After managing to get sound running well in 9.1, but noticing that NetBoot's version of 9.2.2 seemed faster and benchmarked better, and learning that 9.2.2 contains less/no 68k-native code (for less emulation), I figured I would try the upgrade out.

For the most part, it seemed to work fine, but it had the unfortunate side effect of breaking sound. There was still audio feedback, but it was unrecognizably choppy and cut in and out. I could narrow it down to the differences between versions of OS 9 since I was using config files that were identical past what hard drive they booted from, and the system folders was just an updated version of the other one.

Anyway, I reduced 9.1 to bare-bones configuration and found that "out of the box" with everything shut off, it has choppy sound too -- but with its audio extensions and QuickTime and its sound extensions enabled, it worked fine.

So I figured I'd try 9.2.2 with the same extensions (in their updated versions). Nothing doing.

After tinkering around with different extension configurations and failing to get anything done, I decided to take things up to the next level, and started to replace extensions and/or control panels with older versions. After this didn't work, I kept on until virtually every system component that I could fathom had or could have anything even remotely to do with sound or its playback -- everything that seems like it would make it 9.2, including the ROM, Finder, System suitcase, System Resources, Classic, Extensions, Internet Extensions, and Control Panels -- had been replaced with the 9.1 version, or removed altogether where it didn't exist before.

And after all that it *still* didn't work!

Finally I gave up, copied the contents of the working pure 9.1 system folder back onto the main previously 9.2.2 system folder. Sound works great.

Suffice it to say there's definitely a gremlin in the works somewhere, maybe hiding out in the Desktop Pictures! :wink:
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Did you have Quicktime 6 and iTunes 2 installed in 9.2?

Best,
Cat_7
J. Gryphon
Student Driver
Posts: 19
Joined: Mon Jun 16, 2014 12:52 pm

Re: Screamer, 9.2.2 & Adventures with Sound

Post by J. Gryphon »

I didn't at that time, just the stock stuff that came with 9.2.1/9.2.2, so QuickTime 5. However, I've installed both on another 9.2.2 system folder.

Sound in general does seem to work better with that setup. It's still a bit out of sorts for Star Patrol, though, which is a shame since that's currently my favorite Classic Mac OS game. I'm curious if this is a problem that actual machines from that time period had. I have both a G4, and a PowerBook that I recently got from the shed and hope to find a working power adapter for, so I'll probably try it out on one or both of those and see if that is expected behavior. If it is, then I can't fault Qemu emulation for something that the system software broke in real usage cases.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Screamer, 9.2.2 & Adventures with Sound

Post by adespoton »

This is a Qemu issue; the game works fine on my G4 running 9.2.2.

There's still a few bugs being worked out in the Qemu audio processing, but we've come a long way in the past 3 years.
User avatar
Nowhere Man
Student Driver
Posts: 19
Joined: Sun Sep 30, 2018 4:38 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Nowhere Man »

I have been trying to get this all running on Linux Mint 19 (on a Ryzen CPU). The repository QEMU is new enough to support running Mac OS, and I have Mac OS 9.2.2 up, but I am having an issue with silent audio output. I found my way to this thread in my quest to get it all worked out, but so far no luck. I'm going to include a screenshot to show you how my virtual system is configured.

Am I just going to have to wait for some kind of bug fix? I've got QuickTime 6 and iTunes installed, and it looks from the Sound control panel as if it should all be working (as it did before I installed QT and iTunes), but also as before, I just don't hear the audio. It acts like it is playing the sound. The alerts don't blink the menu bar when the volume isn't muted, for instance.

Almost forgot. My QEMU syntax is as follows:
/usr/bin/qemu-system-ppc \
-monitor stdio \
-M mac99 \
-machine accel=tcg \
-m 1024 \
-cdrom /dev/cdrom \
-hda /home/.../QEMU-MacOS9.vmdk \
-boot once=c,menu=on \
-net none \
-rtc base=localtime \
-name "Power Mac G4" \
-L pc-bios \
-cpu G4 \
-prom-env 'auto-boot?=true' \
-prom-env "vga-ndrv?=true" \
-netdev user,id=mynet0 \
-device sungem,netdev=mynet0 \
-g 1024x768x32 \
-sdl

Image
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Hi, welcome!

Qemu doesn't support sound by default. We provide some experimental builds with sound support, but not for Linux as there are so many different distributions.
So you will need to compile your own version to get sound. If you can, I can provide you with some assistance to get a build running.

Best,
Cat_7
User avatar
Nowhere Man
Student Driver
Posts: 19
Joined: Sun Sep 30, 2018 4:38 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Nowhere Man »

Greetings Cat! Thank you for your response. I could give that a whirl. I could also wait a while for a fix to make its way into the official QEMU builds, if that is in the works. Are there any plans to submit such code to the project? My distro is Ubuntu-based (Bionic, to be specific), so any change that affects Ubuntu should find its way to my Mint system as well.

If you want to help me build this thing, though, I have compiled code on Linux systems in the past, so I at least know the basics, i.e. how to install and use GCC, make, etc. In fact, I should be all set with that stuff now. Might be fun to give it a try!
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Ok,

We will use the terminal to build qemu. Some of the info below comes from this page:
https://wiki.qemu.org/Hosts/Linux

Start with making sure some requisite software is installed. Use the terminal:

Code: Select all

sudo apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev
Then download the required source code to some convenient folder. In the terminal:

Code: Select all

git clone -b screamer https://github.com/mcayland/qemu qemu-screamer
cd qemu-screamer
In the following step, you might see some errors related to missing packages. If so, use apt-get to install them. This can take several iterations before all required packages are installed.
I'm not sure which audio system your distribution uses, but for now I assume it uses pulse-audio.

Code: Select all

./configure --target-list="ppc-softmmu" --enable-gtk --with-gtkabi=3.0 --enable-sdl --with-sdlabi=2.0 --audio-drv-list="pa"
next, build the code and strip the executable of debug info:

Code: Select all

make
cd ppc-softmmu
strip qemu-system-ppc
Copy qemu-screamer/ppc-softmmu/qemu-system-ppc to e.g., a folder in your home folder. Also copy the whole qemu-screamer/pc-bios folder into that folder.

Create a script to start qemu in the folder to which you copied the qemu files. Make sure to change the name of the hard disk image. You can use the image of 9.22 you already have installed.

Code: Select all

export QEMU_AUDIO_DRV=pa

./qemu-system-ppc -L pc-bios -boot c -M mac99,via=pmu -prom-env "boot-args=-v" -prom-env "vga-ndrv?=true" -m 256 -netdev user,id=network01 -device sungem,netdev=network01 -drive file=/9.2.img,format=raw,media=disk  
See how far you get.
Best,
Cat_7
User avatar
Nowhere Man
Student Driver
Posts: 19
Joined: Sun Sep 30, 2018 4:38 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Nowhere Man »

I had to install some additional software to get through the configure process, namely:
sudo apt-get install libgtk-3-dev
sudo apt-get install libsdl2-dev

Following that, the build was a success! I copied the executable and the BIOS folder to a different directory and ran it with otherwise the same syntax. The result is it runs and, interestingly, shows a "SPATIALIZER AUDIO LABORATORIES" logo in the Sound control panel. It also shows a lot of resolution options in the Monitors control panel, something I don't think the system's QEMU build did, and indeed I had to use it because the system changed to a lower resolution as it booted.

However, the sound is still silent on the output, unfortunately. I think I also just caused a soft lock by changing the main volume. The cursor still moves, but I can't click now.

I force-quit the control panel and reopened it. Still no sound out. I've just noticed that there is a built-in microphone input option now as well, whereas the repo QEMU had only shown Internal CD as an option.

System shutdown from the menu works as always. I am retrying it with 256 MB of RAM instead of 1 GB. Aha! Now I do have sound output. Interesting! It is buggy, but in the same way as the output I get when emulating the Soundblaster 16 in an x86 VM - sound plays with a corrupted static and echo to it. I guess that is a Linux-specific QEMU bug that no one is able or willing to fix, as I have been experiencing that for a long time. I've got iTunes playing a song now. With any luck, the glitch will work itself out over time the way it does on x86 SB16 emulation. I'll see.

Edit to add: Playing through the song twice has not helped. Still sounds bad.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Hi,

I got best results with both Quicktime 6 and iTunes 2 installed.

Best,
Cat_7
User avatar
Nowhere Man
Student Driver
Posts: 19
Joined: Sun Sep 30, 2018 4:38 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Nowhere Man »

Cat_7 wrote:Hi,

I got best results with both Quicktime 6 and iTunes 2 installed.

Best,
Cat_7
Well, that is what I have, unless you mean my versions are too new. My screenshot shows that I have QuickTime 6.0.3 and iTunes 2.0.4. But again, QEMU seems to have a nasty audio latency issue on Linux hosts, and that seems to be the culprit. I wonder whether that will ever get fixed! Open source software can be frustratingly slow to improve at times.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

On an older 3.5 Ghz i7 with OSX/Windows/Linux I can play songs without a hitch, provided I run 9.1 or 9.2. Sound in OSX is not usable.

What is you command line? Do you use -device usb-mouse -device usb-kbd?
And the machine type? -mac99,via=pmu?

Best,
Cat_7
User avatar
Nowhere Man
Student Driver
Posts: 19
Joined: Sun Sep 30, 2018 4:38 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Nowhere Man »

Cat_7 wrote:On an older 3.5 Ghz i7 with OSX/Windows/Linux I can play songs without a hitch, provided I run 9.1 or 9.2. Sound in OSX is not usable.

What is you command line? Do you use -device usb-mouse -device usb-kbd?
And the machine type? -mac99,via=pmu?

Best,
Cat_7
I was just using -mac99 and not specifying USB devices. Trying that, it is behaving the same way. ... Or was at first, but now it has eventually cleared up after just over two minutes of playback. It does sound pretty good now, but with a little bit of static still making its way in. I happen to have a VirtualBox VM open simultaneously with it, though, and that shares the sound system. Maybe that also has an influence on this. I had Firefox open with a paused YouTube video up the last time around.

But, once again, that's more on QEMU in general on a Linux host than on the Mac-specific stuff, I'm quite sure. Maybe you'll notice the same issue if you have another sound playback application open, such as a media player or a VM. Want to try and see what you get? I always get at least temporary sound corruption with QEMU on a Linux system and SoundBlaster emulation, or now, Mac sound emulation.
DonDonKerabatsos
Space Cadet
Posts: 2
Joined: Thu Jan 02, 2020 2:12 pm

Re: Screamer, 9.2.2 & Adventures with Sound

Post by DonDonKerabatsos »

Hello everyone, I don't mean to jack this thread I just have a simple question. This thread helped me set up sound on QEMU-screamer on OS 9.2.2 and it works great! but I'm having trouble configuring this to run fullscreen at higher resolutions.

Is this not possible with this build? and I gonna have to rebuild from source using custom parameters? Thanks in advance.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Hi,

I 'm not sure I understand your question. Do you want to run at a resolution not available in the Monitors control panel?
What is your desired resolution and what is available in the control panel?

If not, and you need to know how to change to full screen, then switching back and forth between windowed and full screen modes is done with Ctrl-Alt-F.
You can set the desired resolution before and after switching to full-screen.

Best,
Cat_7
kcrmson
Space Cadet
Posts: 2
Joined: Sun Jan 12, 2020 5:26 pm

Re: Screamer, 9.2.2 & Adventures with Sound

Post by kcrmson »

Hey all,

Just wanted to add that I followed the aforementioned Linux instructions on Arch Linux (minus the gtk and sdl flags, those generated errors even though the libs were installed, ./configure still recognized them).

Audio so far is fine! Crystal clear, no obvious lag but I've only really checked system beeps so far. I had to toy with a duplicate script so the current qemu (4.2) can run if I choose to run it as the -audiodev options have changed. Still no sound in 4.2 but the changes in it don't affect us from what I've seen.

Do we know if this change will ever be upstreamed? I don't mind doing a quick compile when a new screamer build is out but it would be awesome to eventually use the upstream binary rather than keeping a compiled copy that's not in my package management hanging around.

OT, once the Q800 changes let us run something other than Linux (I may have to try MkLinux again, been decades!) then we'll really have some nice solutions instead of depending on so many emulators and configs.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Do we know if this change will ever be upstreamed?
Hi,

There is work being done on the screamer (both for device support in openbios and qemu). It might be the new audiodev is posing problems here.
Upstream will depend on fixing the remaining issues, particularly noticeable when running OSX guests with audio.

What did you mean when you said: "I had to toy with a duplicate script so the current qemu (4.2) can run if I choose to run it as the -audiodev options have changed." ?

How do you use audiodev on the command line?

Best,
Cat_7
kcrmson
Space Cadet
Posts: 2
Joined: Sun Jan 12, 2020 5:26 pm

Re: Screamer, 9.2.2 & Adventures with Sound

Post by kcrmson »

Cat_7 wrote:
What did you mean when you said: "I had to toy with a duplicate script so the current qemu (4.2) can run if I choose to run it as the -audiodev options have changed." ?

How do you use audiodev on the command line?
Hi Cat_7!

I meant that I now have two qemu scripts, one for screamer builds and one for the current upstream (e.g., what's available in my distro's repos, we tend to get the latest very quick). I was VERY tired when writing up my initial reply, I had changed the audiodev part so many times I for some reason thought my screamer one had it when I posted.

As for audiodev, I actually don't use it at all in my script for the screamer build. I only set the environment variables for QEMU (QEMU_AUDIO_DRV=pa and QEMU_PA_SERVER=/run/user/1000/pulse/native).

In the 4.2 script my audiodev is:
-audiodev pa,id=paout,server=/run/user/1000/pulse/native"

I don't get sound with 4.2 whether I have the audiodev defined or omit the line completely. Using the older syntax results in various errors including things like missing the Driver parameter (not needed, the first parameter defines the driver as pa for pulseaudio) or the oddball audiodev= parameter (which it says to use -audio-help but that doesn't work either). The above is what ended up letting QEMU boot. Other toying around earlier (don't recall the combination of audiodev parameters) that WOULD allow booting would actually soft-hang as soon as the OS probed for audio hardware (before the first Extensions can load so no boot icons). You would be at the Welcome to Macintosh screen but with a perpetual beachball pointer (still spinning) that eventually changes to a bomb pointer (not a regular crash dialog, this is the pointer only).

Either way, I run qemu using my screamer-specific script and it's been good so far. Some system beeps break up but some don't. I just played Bill the Demon and while the opening sound is a bit crackly playing the actual game didn't have break up (at least not the one minute I just played for).

As of the moment it really looks like I don't need the other script since the screamer build for all intents and purposes is more useful and functional to me than the latest. But for forward compatibility I wanted to have the audio device setup and that doesn't work with the pre-4.2 QEMU.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Hi,

Yes, audiodev has problems related to qemu-system-ppc ....when you do as asked (define -audiodev... on the command line) you get an error.

The current screamer is not yet compatible with audiodev. The screamer is dependent on both the qemu source and openbios source. If you build from mcaylands screamer source, the openbios included there is screamer-enabled. This source has not yet been rebased on the latest qemu source and a patch is waiting for review. I'm waiting for that to happen so we can submit some bug report.
There are some patches in the pipeline that re-implement the screamer device in openbios and for qemu, but these only work on older source and thusly work around recent audiodev code.

You will not get sound from the current qemu source (4.2) when compiling qemu-system-ppc.

Best,
Cat_7
exsystem
Space Cadet
Posts: 3
Joined: Wed Feb 05, 2020 3:37 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by exsystem »

Hello,

Mine MacOS 9.2.2 inside qemu-screamer on Catalina of my MacPro 2013 machine do show me the sound device via the Sound Control Panel > Output, but only very loud and crackling sound. Is that 'normal' for now? Is there any solution? :roll:
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Hi,

Yes, there are some patches created a few days ago, but one of them will get a new version soon.
If you build your own Qemu, you can apply these patches to get sound working again.

Apply in this order:
https://patchwork.ozlabs.org/patch/1232397/
https://patchwork.ozlabs.org/patch/1232428/

If you do not build your own Qemu and are using ours, you'll have to wait until the patches are applied to the Qemu source, the screamer code is updated and a new binary is provided.

Best,
Cat_7
exsystem
Space Cadet
Posts: 3
Joined: Wed Feb 05, 2020 3:37 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by exsystem »

Thanks! It works.

...Any I only patched the first one, when patching the second one after successfully patched the first one, it showed me some errors, as listed below:

Code: Select all

$ patch -p1 < RFC-audio-proper-support-for-float-samples-in-mixeng.diff
patching file qapi/audio.json
patching file audio/audio_int.h
patching file audio/audio_template.h
patching file audio/mixeng.h
patching file audio/alsaaudio.c
patching file audio/audio.c
Hunk #4 FAILED at 300.
Hunk #5 succeeded at 343 (offset -1 lines).
Hunk #6 succeeded at 357 (offset -1 lines).
Hunk #7 succeeded at 783 (offset -1 lines).
Hunk #8 succeeded at 1851 (offset -1 lines).
Hunk #9 succeeded at 2098 (offset -1 lines).
1 out of 9 hunks FAILED -- saving rejects to file audio/audio.c.rej
patching file audio/coreaudio.c
patching file audio/mixeng.c
patching file audio/paaudio.c
patching file audio/sdlaudio.c
So for my case, I made it working by patching only the first one. I am not sure what commit I cloned via the repo, but it must be the latest at that time.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Ah yes,

Could be one part of the second patch didn't apply for me too. I guess I fixed it manually.
However, you seem to have sound now. The patches have now been included in the current master source, so we only have to wait for an update of the screamer branch.

Best,
Cat_7
exsystem
Space Cadet
Posts: 3
Joined: Wed Feb 05, 2020 3:37 am

Re: Screamer, 9.2.2 & Adventures with Sound

Post by exsystem »

Today, I found it is not working. Maybe still the second patch is needed.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Screamer, 9.2.2 & Adventures with Sound

Post by Cat_7 »

Hi,

The current screamer branch has been updated a few days ago with all patches needed.
git clone -b screamer https://www.github.com/mcayland/qemu
If you create a new build, it should work.

Please note that running with 1024Mb of memory will make sound stop working in Mac OS 9.x. So run with less memory.
As will running without virtual memory.

Best,
Cat_7
Post Reply