Jump to content
Xuel

FujiConvert 0.1

Recommended Posts

On 11/26/2019 at 3:56 PM, fox said:

Something's wrong with the RAM option. I convert a ~40 second MP3 changing just the frequency to 15kHz.
The!Cart plays fine, but RAM XEX is trimmed (just the beginning of the audio plays) and with high noises.
I'm testing on Altirra 3.20 XE PAL 320K Rambo and both files are ~230KB.

Thanks for the report! Looks like I need to read up on Rambo. It currently works with Compy up to 1088K.

Share this post


Link to post
Share on other sites

Probing the hardware some more -- I've confirmed that volume bit 3 is definitely slower than bits 0-2. The gates for bits 0-2 can pull down within half a cycle, bit 3 takes almost two cycles. The rising edges are more similar. The difference in fall rates and the asymmetrical edges is unnoticeable for most audio, but for PDM the truncated response to fine volume bit 3 shifts half of the levels. This effect is more pronounced than the jitter in high-pass timing, which can barely be seen in the second falling-edge image as the double curves to the same volume levels. Thus, removing some of the fine volume levels from the middle instead of the high end might be more effective.

 

POKEY-volbitfall.thumb.png.ec3bcddb67ab66c94e29a5dedb15d92c.pngPOKEY-volbitrise.thumb.png.82f03eaf4705d38da632875a4c01b45a.png

POKEY-vol015-fall.thumb.png.56190765ba1eda72dc1d7c8b9c6565d5.pngPOKEY-vol015-rise.thumb.png.3cceeffb13309301f61bfcdf202a6079.png

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

FujiConvert 0.3.1

 

https://lybrown.github.io/fujiconvert/

 

Changes

  • Added PDM Presets:
    • PDM16 - Original full dynamic range method
    • PDM8 - Hardware Bit 3 mitigation? Avoids flipping bit 3 of the fine channel
    • PDM14+bump - Sounds good with Altirra 3.20. Eliminates pops due to volume 0 on fine channel.
    • PDM8+bump - Maybe a way to simulate PDM8 in Altirra 3.20. Eliminates pops.
  • Added Bump setting. Fine channel is allowed to play levels X through X+Y where X is Bump and Y is Fine Levels.

I'm curious how PDM8 sounds on real hardware as it may avoid the bit 3 latency issue that phaeron describes. I really need to find time to pull my own hardware out of storage!

  • Like 5

Share this post


Link to post
Share on other sites

FujiConvert 0.3.2

 

https://lybrown.github.io/fujiconvert/

 

Changes

  • Added Coarse Levels setting
  • Changed presets to:
    • 16 16 0 - Full dynamic range
    • 8 8 0 - Hardware bit 3 mitigation
    • 16 14 1 - Good for Altirra
    • 8 8 1 - Simulation of 8 8 0 in Altirra

Ack! I realized after my last post that the bit 3 issue would affect both coarse and fine levels, so preset "8 8 0" should mitigate this at the cost of reducing the dynamic range to 6 bits instead of the original 8.

 

I remember several years ago reading about some folks who figured out a way to play 16-bit digital sound on an old game console (I can't remember which) which didn't have a proper DAC. I think they had to deal with similar timing issues. I think they ended up doing a brute force search through all possible bit pattern transitions to find the best sequence of register writes to reproduce a given sound waveform. Maybe we could do something similar here. For example, if we know that bit 3 is slow on falling transitions, then we should write an adjusted value to bits 0-2 to account for the latency.

  • Like 4

Share this post


Link to post
Share on other sites

Hmmm,

I now have one problem though: So many choices! I am sorry, but stupid as I am, I do not know what all of the configurations and selections mean, e.g.: Preset (4 selections), DC Offset (16 selections), Coarse Levels (16 selections),  Fine Levels (16 selections), Bump (4 selections),  Non-Linear Pulse (no clue what can be input there), Linear Pulse (again, no cue what can be input there). So all in all we have 4 x 16 x 16 x 16 x4 x X x Y available selections. I do not want to test all possibilities (more than 65,535) to get a good result, so can you suggest some selections for a good PDM result ?!?

 

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, CharlieChaplin said:

Hmmm,

I now have one problem though: So many choices! I am sorry, but stupid as I am, I do not know what all of the configurations and selections mean, e.g.: Preset (4 selections), DC Offset (16 selections), Coarse Levels (16 selections),  Fine Levels (16 selections), Bump (4 selections),  Non-Linear Pulse (no clue what can be input there), Linear Pulse (again, no cue what can be input there). So all in all we have 4 x 16 x 16 x 16 x4 x X x Y available selections. I do not want to test all possibilities (more than 65,535) to get a good result, so can you suggest some selections for a good PDM result ?!?

 

Heh. Yeah, it's getting pretty confusing. You can just choose one of the presets. Notice that when you choose a preset it sets all of the other PDM settings automatically.

 

For Altirra, I recommend "16 14 1". For real hardware, I don't know. Maybe "8 8 0" or "16 16 0", whichever sounds better to you. I have not personally tested any settings on real hardware unfortunately.

Share this post


Link to post
Share on other sites

...this is what it sounds like, when doves cry...

 

Errm no, this is what the real Atari sounds like when playing PDM soundfiles. Did a few recordings with my real A8, sound output was via monitor port (mono-only) connected via cinch-cables with my Hifi CD-Recorder. I always created four PDM versions using the given presets and therefore made four recordings.

 

Version 1: PDM 8 8 1, Altirra;  (named PDM8, Altirra)

Version 2: PDM 8 8 0; (named PDM8)

Version 3: PDM 16 14 1, Altirra; (named PDM14, Altirra)

Version 4: PDM 16 16 0; (named PDM16)

 

Note: I used a real Atari 800XL (PAL) for playback and NOT Altirra.

 

All recordings were made with the same volume/recording volume, but of course PDM 14 and 16 are much louder than PDM 8 (eight bit is simply louder than six bit). And to me, the non-Altirra versions always sound better than the Altirra versions. Furthermore I think, PDM8 sounds quite awful and not really worth doing any conversions, PDM14 sounds better and PDM16 sounds best on the real A8.

 

(Besides, I made the recordings via A8 monitor out, since my Lotharek stereo-enhancement seems to be buggy, it is approx. 2x louder but alas, it has 10x more noise and also an awful lot of distortion which makes it sound worse than the PDM8 recordings here. Why this only happens with PDM sounds and no other sounds is a mystery to me, especially, since the stereo enhancement is switched to mono and thus the same Pokey chip plays the sound via stereo enhancement / via monitor port...)

 

Anyways, here are two songs converted into various PDM formats: DitW (1977/1978) and CD (1965/1966), recorded on CD and then back-converted into WAV. I did not record the full songs, just a small excerpt (somewhere between 53 and 61 seconds), but this is enough to hear the differences.

 

And errm, just as an example, I also recorded a minute of sound of a 50fps video (I turned up the recording volume, so you should hear the awful whistling/buzzing noise there - this noise is present in all 50fps videos).

 

CD_PDM.zip DitW_PDM.zip Mfn_50fps_AVF.zip

Share this post


Link to post
Share on other sites

I would suggest trying 16 steps on coarse channel and 8 steps on fine channel. The ramp on/off speed for volume bit 3 shouldn't matter for the coarse channel due to the much longer pulse time. We should be able to recover fine steps as well, it just takes estimation for the effective amplitude at each level.

 

Latest Altirra test version has a fix for the volume 0 high-pass bug, btw, so recommend not trying to work around that.

 

  • Like 2

Share this post


Link to post
Share on other sites

FujiConvert 0.3.3

 

https://lybrown.github.io/fujiconvert/

 

Changes

  • Replaced "8 8 1" preset with "16 8 0" preset.

"16 8 0" will produce 16 coarse levels and 8 fine levels as phaeron suggests.

 

@CharlieChaplin It sounds like you might have a ground loop in your audio recording setup. So it's a bit hard to gauge the quality of the output with the distortion that adds. It sounds like the fine levels are working. The waveforms look OK. I don't hear much difference between "PDM16" and "PDM14" which is good. That means the fine channel is properly calibrated for each scenario. The Mfn video sound is quite nice but in addition to the ground hum, it has the 15KHz carrier which drowns out some noise you might otherwise hear. The PWM method probably has the most linear response curve out of PWM, PDM and PCM since it doesn't depend on POKEY's volume levels. It just alternates between the lowest and highest volumes at X kHz and varies the duty cycle. FujiConvert has special handling for PWM at 8kHz, 15kHz and 31kHz to sync to the scan line which should avoid jitter from RAM refresh cycles.

Share this post


Link to post
Share on other sites

If any audio recordings from an Atari would come in handy, I can provide them, from my dual-POKEY 800XE with Ultimate and SIDE2 cartridges, connected to my PC's sound card.

Edited by pseudografx

Share this post


Link to post
Share on other sites

Some more info about what's going on in POKEY:

  • Imperfect volume bit ratios cause glitches on the transition between coarse and fine channels. It's a bit hard to measure them precisely with the equipment I have and due to nonlinearity, but rough ratios of volume bits: 0.12V, 0.26V, 0.56V, 1.12V. The jump between bits 0-1 and 2-3 is mainly responsible for the gaps and clearly visible in the ramp.
  • Re-measured the nonlinear curve with the digital scope and the best fit I've been able to come up with is a linear region into an exponential curve. The linear region goes up to around total volume level 12 before the curve starts becoming visible, so it's not too bad for PDM. Have a model that fits the scope graph pretty well but need to double-check the slope at the transition point.
  • Channels 1 and 2 are delayed from channels 3 and 4 by about 100ns due to the high-pass XOR.
  • Very rough volume bit timings are 100ns for volume bits to turn off (1->0 internally, high signal out of POKEY), 200ns for v0/v1 to turn on (0->1 internally, low signal out of POKEY), 340ns for v2 to turn on, 600ns for v3 to turn on. Turn-on is a hockey stick shaped curve, so the signals have transitioned by about 90% in half this time. Turn-off is an S-shaped curve, more symmetrical, about 67% in the middle 50ns.
  • High-pass channels take different amounts of time to transition depending on whether the low channel (1/2) is transitioning 0->1 or 1->0. Going from 1->0 delays the transition starting by ~176ns. This is the primary reason for the even/odd instability on fine volume levels 8-15, because it alternates how much time and how far the signal for volume bit 3 can slew. Perhaps not coincidentally, this is just about the time for volume bits 0-2 to complete the fast portion of their transitions, which implies a possible connection to general gate propagation times.
  • High-pass turn off from ch3/4 is aligned with regular ch3/4 transitions. It's the ch1/2 transition that therefore results in the short pulse, as it gets delayed 100ns + 176ns = 276ns before getting turned off again at the end of the 560ns machine cycle.
  • When a volume bit is switched, any transition in progress on that bit is truncated and the signal for that bit begins reversing almost immediately.

Attached is a capture from the scope of a relatively quiet section of a song intro, encoded to 16/8/0 PDM at 31KHz. The original.wav is the relevant portion of the original WAV file, pre-downsampled to 31KHz; sampled.wav is the capture from the scope, with the left channel being POKEY's output and the right channel being the RCA output. It's a 500KHz WAV file, don't try to play it in a regular media player! I recommend bringing it into Audacity. You'll need to lower the project sampling rate to 100KHz or so for it to actually play. I can capture higher sampling rates with correspondingly shorter times, but sound editors don't seem to like 2MHz tracks much. Comparing the waveforms, I'd say that the high-pass effects in the amplifiers are still a problem -- they're overemphasizing the fine channel's output.

 

hicapture.7z

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...