Journey sound sample in mame2003-plus, solved
-
ill test and report back
-
@arcadez2003
The sample is too large and crashes the mixer....3 minute song. If I cut it to 1:30, it works. Might need to figure out the size limit and expand it to except the whole songcould probably change the code to this too?
static WRITE_HANDLER( journey_sample_select_w ) { if ((data & 1) == 0) sample_stop(0); else sample_start(0, 0, 1); }
-
Hmm might it be a memory issue with the sample.?? certainly we had to use a sample shrinking program to reduce the Toaplan samples down from 160mb
to around 20mb or so for xbox use back in the day as the games could crash due to the 64mb memory limit , as for the handler whatever you think is best
i just grabbed it from FBN and reworked it for our codebase...........static void journey_op4_write(UINT8, UINT8 data)
{
if ((data & 1) == 0) {
BurnSampleStop(0);
}
else if (!BurnSampleGetStatus(0)) {
BurnSamplePlay(0);
}
}static WRITE_HANDLER( journey_sample_select_w )
{
if ((data & 1) == 0)
{
sample_stop(0);
}
else if (!sample_playing(0))
{
sample_start(0, 0, 1);
}
}I had it like this before but it seems cleaner the above way
/*
static int tape_off = 1;
int journey_sound_playing = 0;WRITE_HANDLER( journey_sample_select_w )
{
tape_off = ((~data & 1));if (tape_off) { if (journey_sound_playing == 1) { journey_sound_playing = 0; sample_stop(0); } } else { if (journey_sound_playing == 0) { journey_sound_playing = 1; sample_start(0,0,1); // tape sample } }
}
*/ -
@arcadez2003 yeah I like this way, short and sweet. I'll test the else if statement
static WRITE_HANDLER( journey_sample_select_w ) { if ((data & 1) == 0) sample_stop(0); else sample_start(0, 0, 1); }
The full sample is 15.4MB, cut in half it works. So it's a memory issue. Need to figure that out. Worse case we can link multiple smaller samples
It would be cool to get the pause feature added so it's correct though. Plus it would get old always hearing the intro lol.
Great step in the right direction π
-
Just tested the smaller sample and there's an issue. The sample starts just before going to the bonus scene then it restarts in the beginning of the bonus scene. I'm guessing this is where the pause feature would need to be working so you don't notice the change. Or maybe it's the else if I removed π I'll test again. Man this game is hard.
-
@mahoneyt944 said in Journey sound sample in mame:
Just tested the smaller sample and there's an issue. The sample starts just before going to the bonus scene then it restarts in the beginning of the bonus scene. I'm guessing this is where the pause feature would need to be working so you don't notice the change.
Try it again with the original handler before you changed it to see if that smooths it out, listen with regards to the sample pause feature apart from not having the time
to work on adding support for it now, due to the massive rewrite of every sound core circa MAME93 i dont see any easy way to backport the code for this from MAME98.In a nutshell in MAME2003 our sample handlng is split between samples.c and mixer.c where as in later MAME both of these were combined into one file and the code
totally rewritten, it's like chalk and cheese the code is not compatible with our older core, and i dont mind telling ya it might be above my level to create the sample
pause code myself totally from scratch, but at least we have the sample playing now which although there are a few niggles here and there is better than no sample at all :)Feel free to study the code and try and add support for the sample pausing yourself if you fancy taking a stab at it sometime.............
-
@arcadez2003
Very valid points... ... Hmmmmm
I have an idea, what if we leave the song playing on loop and just mute it instead of stopping it? That way the bonus scene will always have a random sound clip playing. This would be much better than always listening to the same intro on every bonus scene. Our start option will unmute and then play. Stop will just mute but continue playing. If it's already playing just unmute. A pause workaround.Maybe
static WRITE_HANDLER( journey_sample_select_w ) { if ((data & 1) == 0) sample_set_volume(0,0); else if (!sample_playing(0)) { sample_set_volume(0, 100); sample_start(0, 0, 1); } else sample_set_volume(0, 100); }
I'll have to test the volume values.
Update this works!, Though it's a little quieter than it should be at 100, this is rock-'n'-roll so it needs to be loud :)
Now to fit the whole song :)
-
I'm pushing 1:50 with some compression audio tricks. Still 1:13 shy. We need to figure out how to expand the memory here like they did in mame2010 or get really good at compressing this sample. I dropped it from 32 float to 16 bit and it's still not enough but saved space for sure. If the memory can't be expanded maybe we can link multiple samples somehow. If that were possible you could have a whole journey album playing at random, which would be pretty awesome.
What is default value of "sample_set_volume"? This is basically a pre-mixer amplifier from what I can tell. It doesn't seem to have a cap, well it does technically when you get clipping . I'm using "1500" and it sounds pretty good. "100" just sounds flat to me. I'm guessing "1000" might be default but not sure.
-
I used audacity to shrink the Toaplan samples it was so long ago i cant mind the settings i used, but im sure i set it to mono and 8-bit the sample went from
160mb down to 20mb or so, what are you using here an Rpi.?? the sample does not crash for me on the xbox and we only have 64mb of memory all in
im sure the rpi has more, although it doesn't make sense it would crash in MAME2003 but not MAME2010.With regards to sample set volume default values i dunno much about it really having only set the volume in the main interface
btw 25 is the standard volume setting for this game...............struct Samplesinterface journey_samples_interface =
{
1,
25,
journey_sample_names
}; -
@arcadez2003 I'm using a rpi3b+, the sample works in 2010 fully. I had to use audacity to cut the sample from 3:03 to 1:50 for it to work in 2003plus. Then saved it as 16 bit mono. It started as 32 float mono. Cutting it down makes it work. If not I get a screech that crashes the emulator.
The volume thing is tricky because you have mixer volumes and levels and the sample volume. I'm not sure exactly why but if set to 100, I can hear it but the other game sounds are much louder. If I set it to 10,000 it hits clipping. If I set it to 5000 I get clipping. 2000 is too loud, 1500 is slightly too loud, 1000 is probably just right.
-
this mame wont use stereo samples only mono you need to save each channel
-
@grant2258 Im pretty sure it's right. I got it from here http://www.progettosnaps.net/samples then I used audacity to cut it down more. The sample won't work in 2003plus if it's 3 minutes long. But it does works at 1:50 just fine (audacity- export wav 16 bit). So it's a space issue I think. 1:55 crashes.
-
aarg ive done it now i cant even check the size of the ost samples i forgot to back them up when i updated retropie. I have no idea where to download them now to check the sizes its using
-
To much quarantine-time...or something...
I was messing with the sepways.wav sample and you can get it pretty small and still keep it sounding decent. It's a mono channel sample. I used Foobar with SoX to resample. I tried it 4 ways.
Samples 2 and 3 I've always struggled to hear the difference depending on the source audio. You're basically trading off the sample rate (44100 Hz) for bits per channel (8/16-bit) as both sound pretty decent but a higher sample rate will have a larger frequency range but less samples which basically translates to more background "noise".
So even though you have a larger frequency range to hit the highs/lows it might sound slightly "muddy". Both sound good but I prefer the 44100Hz/8-bit between the two. Someone with better equipment or ears might hear a difference! =/
Number 4 at under 4MB actually sounds pretty decent but with an ever slight distortion but not bad at all. I can upload them if you want to try a smaller file.
Depending your speakers and hearing frequency range it could make a difference (or none) to what you hear as highs and lows usually go first and we're mainly cutting out the higher frequencies. I'm sure I've done some damage in my early years at concerts but at some point in there I started wearing plugs! ;)
- 44100 Hz, 16-bit, 1 channel - 15.4MB (Original WAV)
- 44100 Hz, 8-bit, 1 channel - 7.73MB
- 22050 Hz, 16-bit, 1 channel - 7.73MB
- 22050 Hz, 8-bit, 1 channel - 3.86MB
-
i managed to find the ost samples moonwalker has a 24 meg sample and works fine
-
@grant2258 - Then size doesn't matter...the samples! ;)
I think some of these OST's are much larger than they should be and look to have been up-converted. It could be the actual OST CD's were a poor quality source. You just never know these days. Some of these commercial sites sell up-converted low quality FLAC's as lossless.
Looking at the Moonwalker samples. Bad-01.wav (49.6MB) shows as 44100 Hz 16-bit. Basically CD quality audio but when you look at the spectrogram below it's more like a 128kbps MP3 even though it's the size of a lossless audio WAV.
-
Here's a spectrogram of the original song Bad from his Number Ones CD which looks like a victim of the loudness wars and a low dynamic range. The original album has a much larger dynamic range. Looking at the graph basically the whole song is one volume level from beginning to end but does reach 22kHz.
The size is 41.5MB (smaller than the OST) but it is a true 44100 Hz 16-bit rip. I don't know the size of each channel once you break them out. I would guess the OST file which is almost 10 minutes should be around 100MB in true CD quality stereo, the size they are now.
The OST samples have a lot of wasted space and are much larger than need to be. I think they could be easily resampled at a lower sample rate (the actual rate) without loosing any quality but reducing the size if they cause any issues in the core.
-
Looking through a bunch of the OST samples. They are mostly larger like what you would expect from a true CD rip but the quality looks to be around 15 or 16 kHz which would be more equivalent to a 128kbps MP3.
Here's some spectrograph screenshots below from Double Dragon, Final Fight and Outrun. You can see a line around 15/16 kHz that goes straight through the graph. Which is probably the actual quality. Everything above that line is pretty much garbage, white noise or static from ripping/upconverting.
They definitely could be smaller samples or if they were stay the same size the quality should be better depending on the original source. It's not a big deal but mostly just wasted space in the WAV/FLAC files and the file properties will reflect higher quality audio than they actually are.
Double Dragon:
Final Fight:
Outrun:
-
Problems is there are so many samples kicking about and being changed you dont know what your going to get would be best to rip from a cd for moonwalker!
-
@grant2258
So why is it that this journey sample works in 2010 but not 2003plus? It's a mono track? Journey . The only thing I see is that it opens as 32 float in audacity. If I cut the time to 1:50 then export it as wav 16 bit it works in 2003plus but at the cost of not having the whole song.Are you guys testing a sample that fully fits? Or are you just cutting it to 8 bit to fit? If you have a working version what file size is it?
@Riverstorm you can link your 8 bit version, I'll try it. But this seems like something we need to update like mame2010 did since it works with it. It seems like it needs allotted more memory to fit larger files, journey is probably one of the largest samples mame uses or close to it. So if that works mostly everything else should too.
From what I could tell, the samples are all read into memory then are able to be called at any time. I think that journey sample just over loads the memory and eventually crashes the system.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.