Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - High-quality PCM with pcmenc - feedback requested

Reply to topic Goto page Previous  1, 2
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14750
  • Location: London
Reply with quote
Post Posted: Fri Apr 05, 2024 8:53 am
Attaching a few example ROMs for people to try. If your flashcart can only support 1MB, just cut the file and watch out for noise when it loops.
Knight Rider.zip (1.39 MB)

  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 672
  • Location: London, UK
Reply with quote
Post Posted: Mon Apr 08, 2024 4:45 pm
These are cool samples.

I'm constrained to 507904 bytes on hardware at the moment, so can't quite enjoy the whole thing, but the beginning of both sound great, arguably better than on the emulator.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 624
Reply with quote
Post Posted: Tue Apr 09, 2024 6:55 am
willbritton wrote
These are cool samples.

I'm constrained to 507904 bytes on hardware at the moment, so can't quite enjoy the whole thing, but the beginning of both sound great, arguably better than on the emulator.

I suppose it assumes Master System 1 volume levels and that you are running it on hardware with Master System 1 volume levels while you are emulating it with Master System 2 volume levels.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 672
  • Location: London, UK
Reply with quote
Post Posted: Tue Apr 09, 2024 8:21 am
Last edited by willbritton on Tue Apr 09, 2024 8:42 am; edited 1 time in total
Calindro wrote
willbritton wrote
These are cool samples.

I'm constrained to 507904 bytes on hardware at the moment, so can't quite enjoy the whole thing, but the beginning of both sound great, arguably better than on the emulator.

I suppose it assumes Master System 1 volume levels and that you are running it on hardware with Master System 1 volume levels while you are emulating it with Master System 2 volume levels.

You know I didn't realise there were two sets of volume levels...will have to look into it!

(EDIT: I had assumed the slight qualitative difference I perceived was simply the difference between directly driving the display audio vs. a potentially jittery emulation, then through an OS and who knows what the OS might doing to the audio stream)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14750
  • Location: London
Reply with quote
Post Posted: Tue Apr 09, 2024 8:30 am
The algorithm sort of tries to avoid those volume levels - but I didn’t add a variant that blocks them yet. I may try that next.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 672
  • Location: London, UK
Reply with quote
Post Posted: Tue Apr 09, 2024 8:59 am
Ah, think I've found the relevant discussions, so basically (some, or all?) SMS2s have a flattened response compared with the SMS1 and MD, which is particularly apparent on the highest volume levels, is that about right?

I implemented strictly based on a 2dB formula, although I've only got a 14 bit resolution (out of a possible 24 bit PCM) so it's not as "perfect" as it could possibly be, but yes it shouldn't suffer from that particular problem.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14750
  • Location: London
Reply with quote
Post Posted: Tue Apr 09, 2024 9:25 am
In the linked thread it says the problem is a current source resistor with too high a value, which can be replaced to fix it. Sadly no more details than that.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 672
  • Location: London, UK
Reply with quote
Post Posted: Tue Apr 09, 2024 9:46 am
Maxim wrote
In the linked thread it says the problem is a current source resistor with too high a value, which can be replaced to fix it. Sadly no more details than that.

From a very quick comparison of both the SMS1 and SMS2 service manuals, I'd guess the difference is the 1k5 R19 which is near top left on the SMS2 schematic.

As far as I can tell, there is no equivalent component on the SMS1 schematic. If I had an SMS2 to muck around with I'd be tempted to just remove that resistor and see what happens, and / or play with some different values.

EDIT: the discussion would suggest that the output of the VDP (in the SMS2) can't source current, whereas I guess the SMS1 VDP was able to, and if true then removing R19 would give a terrible sounding result, so the idea would presumably be to replace it with a somewhat smaller value.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3831
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Apr 09, 2024 9:57 am
I think somewhere in the forum there was a discussion about it with somebody suggesting a better resistance value - no idea where it is now.
  View user's profile Send private message Visit poster's website
  • Joined: 30 Mar 2009
  • Posts: 296
Reply with quote
Post Posted: Wed Apr 17, 2024 12:46 pm
hello, i'm trying to use pcmenc, but it simply quits, without giving me an error message.


C:\smsdev\test-pcm>pcmenc -rto 1 -dt1 12 -dt2 12 -dt3 423 go.wav
Encoding PSG samples at 8007Hz
Loading go.wav...
C:\smsdev\test-pcm>


this is what i see, and i get no converted file.
i tried creating the wave file as 16bit signed pcc and 8bit unsigned pcm always at 8000hz (my idea was to use kusfo's fxsample).
i tried exporting the wave both from audacity and reaper, with the same result, i did managed to generate other errors, by trying other formats with the wave, but those were pretty much saying "invalid format".

vlc shows no metadata on the wave file.

i'm probably generating the wave file wrong, i'd imagine?

i attached the file i'm using to test it, exported from audacity, as 8bit unsigned, 8000hz sample rate.

thanks in advance.
go.wav (5.91 KB)
8bit unsigned - 8000hz

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14750
  • Location: London
Reply with quote
Post Posted: Fri Apr 19, 2024 7:47 am
It just works for me...

Encoding PSG samples at 8007Hz
Loading go.wav...done; 6011 samples
Viterbi SNR optimization:
   1 input samples per PSG triplet output
   dt1 = 12  (Normalized: 0.027)
   dt2 = 12  (Normalized: 0.027)
   dt3 = 423  (Normalized: 0.946)
   Using 4 bytes data precision
   Resampling using Lagrange interpolation on 11 points... done (18033 output points)
   Using cost function: L2
Processing 0.00%
Processing 22.71%
Processing 45.43%
Processing 68.14%
Processing 90.86%
Processing 100.00%
The cost metric in Viterbi is about 0.174
SNR is about 26.65
Converted 6011 samples to 18033 outputs in 0.19s = 32317 samples per second
RLE encoding with no split
- Encoded 18033 volume commands (9016 bytes) to 7942 bytes of data,
  effective compression ratio 11.92%
Saving 7942 bytes to go.wav.pcmenc...done

It is defaulting to the RLE packing, which saves a little space here, but you may want to check if -p 4 saves space for you. I also find that for speech, ratio 3 works pretty well for a third of the space used, 3008 bytes for your sample.

Your sample is also quite quiet, peaking at about half the wave height, and with a bit of silence at the beginning. I suggest you should try amplify and compress effects in a wave editor like Audacity to make it as loud as you can without too much distortion.
  View user's profile Send private message Visit poster's website
  • Joined: 30 Mar 2009
  • Posts: 296
Reply with quote
Post Posted: Fri Apr 19, 2024 2:41 pm
thanks for testing. since it isn't a problem on the wave file, i tried other options and it turns out, running cmd as admin solved it?
my main user has admin rights on the computer, so no idea why it doesn't work loading a regular cmd.

I'll try the suggested optimizations and play around with the options.
thanks!
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3831
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Apr 19, 2024 2:45 pm
Running as administrator or being an user with administrative rights is pretty different. I suspect your problem then it's that you have wrong rights on the wave file - or more likely on the folder where that file is.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14750
  • Location: London
Reply with quote
Post Posted: Fri Apr 19, 2024 3:34 pm
It seems to get stuck reading the WAV file so maybe my code is not handling some sort of error opening it.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3831
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Apr 19, 2024 7:15 pm
I can't really read C++ but I suspect the encoder silently exits if fopen fails...
  View user's profile Send private message Visit poster's website
Reply to topic Goto page Previous  1, 2



Back to the top of this page

Back to SMS Power!