got a working compile: http://erebor.db48x.net:8000/example_macplus.html
sound sounds pretty good
occasional buffer underrun messages, some popping
Wow, that IS nice
throw that sucker in
SketchCow: thrown
unsure if we can improve this buffer underrun trouble, on my PC I get a lot of them with this example
agreed
but I think we can fix the really bad pops at the beginning of sounds
I use headphones, and they are super bad
but overall it's an improvement
macplus use two 370 sample buffer, either the SDL port or the browser want only power of two buffer size, that prolly increase the number of underrun
Do you think it's good for 1.0 or do you want to do more tuning?
dunno what can I do now, as I work on Hampa code and it's very good on it
phe: I'm not sure the buffer size is so important
if I understand it correctly, SDL is calling our callback whenever it gets near to running out of data to play
in fact, a quick experiment with a smaller buffer size seems to have helped
I don't know how the emulator fill the buffer, we can run in sdl ask 512 sample, a buffer contain 370 samples but does the emulator flush the buffer sample by sample
we're less likely to be asked for 1024 samples when we only have 370*1.437 available
yeaj, I tried, and reversely increasing the buffer size add a lot of overrun
on the other side, decreasing the buff size increase the number of scratch at buffer boundary
I think the scratches are purely underruns
try erebor again; it's great
compare that with https://archive.org/details/mac_DarkCastle_1_2
erebor has the sdl buffer set to 256 samples
hmm, with chrome erebor give me around 50 buffer underruns per second
ff nightly look like flawless, I get an underrun at the end of each music cycle, I think it's sort of normal
disappointed by chrome webaudio support
hmm, I get more problems in chrome as well
well, we can always tell people not to use chrome
yeah, when I forced emscripten sdl port to accept 22255 as input freq, ff and chrome accepted it, but only ff resampled it
nice
phe: I was also looking at using SDL2, which has SDL_AudioCVT
I remember, why it didn't work?
looking at SDL2 the code, if you pass NULL as second parameter to openAudio, it should try to build a resampler filter
build trouble, errors at run time
heh
with SDL2 there is no need to build a filter, same for sdl1
that's exactly what the code used to do
but I'm unsure if sdl will be able to build a filter for 22255
I traced sdl1 code with Hampa code, it's not sdl1 which accepted that freq, but the underlined audio driver
phe: what do you meant?
the 22255 sample rate is from the original mac hardware
so it's naturally that it's exactly what PCE produces
yes, it's what Hampa emulator request to sdl, SDL first try if the box audio device driver accept that directly before doing trying a resampling
I see
yes, and so you think that the reason the sound wasn't right all along is that the SDL port fails to build a filter that can resample from 22255 to whatever the browser wants?
I'm saying that because I'm unsure if sdl1/2 if the device driver can't acecpt that freq will be able to do the conversion
yeah
well, that would explain why it wasn't just working
we should file a bug on SDL (or I guess the port) and see if we can get it fixed
I doubt it's fixable, if they do resampling by integer step
22255 = 4451*25, 4451 is prime, they'll need a temp buffer 4451 bigger than the initial buffer
https://github.com/emscripten-ports/SDL2/blob/778fe55bd884cf301a8bda51445f72b24816b648/src/audio/sdlgenaudiocvt.pl#L368
I was looking at https://github.com/emscripten-ports/SDL2/blob/master/src/audio/SDL_audiocvt.c#L937
and https://en.wikipedia.org/wiki/Upsampling#Upsampling_by_a_rational_fraction where L and M can only be integer
hmm, so emscripten look like to be able to do that
ah, but look at line 934
it does indeed bail on this conversion
but https://github.com/emscripten-ports/SDL2/blob/master/src/audio/SDL_audiocvt.c#L1048
all of this code look like voodoo
I'll be conceived it works when I'll see it working :)
convinced*
:)
I guess there must be a generated filter where multiple == 0
it would just copy directly, rather than doing any actual resampling
so what you tried is to use the pl script to build a filter, or emscripten automate that?
unsure to understand how that work
I'm assuming that the perl script is run when you build the port
ah, no. I am wrong
look at SDL_audiotypecvt.c
https://github.com/emscripten-ports/SDL2/blob/778fe55bd884cf301a8bda51445f72b24816b648/src/audio/SDL_audiotypecvt.c#L15702
specifically, it'll find this one: https://github.com/emscripten-ports/SDL2/blob/778fe55bd884cf301a8bda51445f72b24816b648/src/audio/SDL_audiotypecvt.c#L15726
so the upshot is that the SDL port doesn't have a resampler that can actually resample by an arbitrary amount, so we either have to fix the port or just do it ourselves
we've done the latter, aside from possibly a bug, so I guess we're good
nice: https://github.com/emscripten-ports/SDL2/issues/38
SketchCow: oh, I need to upload new config files for pce as well
I put them in the loaderlab
OK, I don't think it can happen until Monday
I can try
Depends on dev mood
heh
fair enough
bbiab
What are the differences in the newloader?
And is it just loader.js?
Or which files?
even if we rebuild audiocvt.c, the generated resampler doesn't look like good: https://github.com/emscripten-ports/SDL2/blob/778fe55bd884cf301a8bda51445f72b24816b648/src/audio/SDL_audiotypecvt.c#L3736
they replicate the same sample up to the fractional part then inject the new with half of the last
Some questions
- What is the difference in the new loader
- The sound sounds good except for that initial "crunch" as it engages - is there a way to mute that opening frame?
Many people worked very hard to bring this emulation system to bear: Hampa Hug created PCE (the original Macintosh emulator program). Experiments and work by James Friend (PCE.js) and Marcio T. (Retroweb) ported PCE to javascript via Emscripten. They all provided continued assistance as the Emularity team approached refining the emulator to work within the Archive's framework. Much work was done by
Daniel Brooks, Phil-el, James Baicoianu, and Vitorio Miliano, with Daniel Brooks putting in multiple weeks of refinement.
Let me know where I'm off
SketchCow: I haven't changed loader.js at all
SketchCow: just pce*.cfg
I can't uploade to emularity_config_v1, so I just stuck them in loaderlab for you to deal with
Ah hah
ah HAH
Well then
AH HAH
hhahhhhh
:)
I shoved them in
What did it do
set speed=1
which makes the emulator run at a constant rate, rather than trying to scale up and down
I had also forgotten to add foo.qed as possible disk images to look for
so it corrected that
Great
So, I do wonder about that slight grinding noise at the beginning of the sounds
I notice it's almost as part of the noise, like it's gearing up
Once it's "going", it's fine
with headphones I think it's more obvious
it's the kind of pop you get when the speaker is driven to maximum and held there
DC offset
yes, and my first thought was that we were doing the wrong signed/unsigned stuff
like treating 0 as silence in an unsigned buffer, instead of 0x8000
but we are resampling into a signed buffer, so that part seems right
https://www.youtube.com/watch?v=UndXYYosDk4
Maybe we announce this Monday if we find things humming right
I got Stephen Cole to begn uploads of new Mac things, which is great.
https://archive.org/details/MacintoshSharewareGames
Still working on blog entry
db48x: Question
Actually, phe too
Here's the questions:
- Do we think that buzz/offset at the beginning of each sound set can be eliminated? Should we wait for it?
- Do you think I can announce this today or this weekend or whatever without embarassment?
https://github.com/copy/v86 looks interesting
win98 runs smooth af
so i found out about this site: https://winworldpc.com/
nice
just archives or do they have some embedded emulator stuff going somewhere too?
just archives
its where that guy got the windows 98 from
ah cool
i still think we need to find unopen computers to grab a hard drive image of them
yeah I have a box of old hard drives going back to the 90s
I took backups of all the ones I could still interface with but there's some scsi and pata stuff which I'd have to dig into boxes to find controllers for
anways CAT
I love the idea that I could just image my old system and boot it right up
same here
we should throw it in
I imaged an OS9 system and brought it right up in QEMU a few weeks back
v86 is one of the things I need to make time to bring up a full Win95 instance with to test Unrealty with
sample0: 0, sample1: -32768, frac: 0.000000, sample: 0 pce-macplus.js:1:366844
sample0: 0, sample1: -32768, frac: 0.695469, sample: -22789 pce-macplus.js:1:366844
sample0: -32768, sample1: -32768, frac: 0.390937, sample: -32768 pce-macplus.js:1:366844
sample0: -32768, sample1: -32768, frac: 0.086406, sample: -32768 pce-macplus.js:1:366844
sample0: -32768, sample1: -32768, frac: 0.781875, sample: -32768 pce-macplus.js:1:366844
why the input contain only -32768?
btw db48x in the buffer underrun if (), there is a return at end, it must be a break so the part of the output buffer we get pass through the lowpass filter
phe: that's true
I'm running again in trouble with chrome, -O0 build work a lot of better than any -Ox, 3-4 buffer underrun vs 100-200 with -O2/-O3
that's promising
how does -O0 run in Firefox?
you might also try -Os
it works well in FF whatsoever the opt level
but we can't do non optimized build because he js is 1.3 MB vs. 4 MB
Initializing SDL audio threw an exception: "Invalid SDL audio format 16!"! Continuing without audio.
-Os doesn't help chrome
phe: the input must actually be unsigned
hmm, req.format = AUDIO_S16LSB;
I thought it's signed but most manipulation on it is done as unsigned, as it doesn't matter when you only copy
snd_iir2_filter use uint16_t * input but in the same time it get drv->sign which is 1 so it can handle data correctly
but you're right, I should handle that like the remaining of the code, as uint16_t, it'll change nothin to the result