Limitations with MSX-Music

Страница 3/5
1 | 2 | | 4 | 5

By Grauw

Ascended (9071)

Аватар пользователя Grauw

25-12-2019, 23:32

AuroraMSX wrote:
sd_snatcher wrote:
AuroraMSX wrote:
msd wrote:

3: It can? Did anybody use this?

Of course it can - just like the PSG can play samples...

Hummm, not quite. When in test mode, you can get direct access to the YM2413 DAC.

Ah, test mode... I just thought of setting one of the channels to a low frequency and then play the sample through the volume setting of that channel. That would be 4-bit though...

Volume control is on a logarithmic scale (like the PSG) so it’s not as usable.

But Okazaki tried that as well. He did a write-up here.

By Grauw

Ascended (9071)

Аватар пользователя Grauw

28-12-2019, 23:08

I’ve achieved 7½-bit PCM playback on YM2413!

Demo: http://www.grauw.nl/etc/msx/joou-fm2.rom (15.7 kHz 7.64-bit PCM, 2640K, ASCII16)

Note that in this demo I don’t nicely enable the original FM-PAC yet, so it only works with internal MSX-MUSIC and clone cartridges with an original YM2413 chip. Emulations also don’t work at the moment, that includes FPGA.

In theory you could play up to 9 channels of 9-bit PCM data, with volume control. Simultaneous use with FM synthesis is not possible.

It’s based on the PG hold function (test register bit 2), which uses the increment specified by f-num, block and multiplier directly instead of adding it to the previous value. Block number and multiplier are pre-configured such that the f-num LSB exactly covers the first quarter sine, and then after a lookup to convert sample amplitude to sine index, I simply output it while syncing to the VDP’s HR timing flag.

Register settings to index the quarter sine table with the f-num LSB, r0-7: 00 24 3F 00 FF FF 0F 0F, r48: 00, r32: 1E, r15: 04. Then output to r16 after inverse sine table lookup:

db 85, 86, 87, 88, 88, 89, 90, 91, 91, 92, 93, 93, 94, 95, 96, 97
db 97, 98, 99, 100, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 108, 109
db 110, 111, 112, 113, 113, 114, 115, 116, 117, 118, 118, 119, 120, 121, 122, 123
db 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138
db 139, 140, 141, 142, 143, 143, 144, 145, 147, 148, 149, 150, 151, 152, 153, 154
db 155, 156, 157, 158, 158, 160, 162, 163, 163, 165, 167, 168, 169, 170, 172, 173
db 174, 176, 177, 178, 180, 181, 183, 184, 186, 188, 189, 191, 192, 194, 195, 197
db 200, 201, 204, 205, 208, 209, 212, 214, 217, 219, 223, 226, 231, 234, 241, 248
db 0, 0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9
db 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 19
db 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30
db 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40
db 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51
db 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62
db 63, 63, 64, 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 73
db 74, 74, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84

By Grauw

Ascended (9071)

Аватар пользователя Grauw

28-12-2019, 23:07

The above settings use MULT 4 to make the f-num LSB index into a quarter-sine, which has good resolution but half amplitude and +0.5 DC offset. By setting MULT to 12 (three-quarter sine) you increase the range to include the negative part of the sine as well, giving full amplitude and no DC offset, at the cost of some bit depth (down from 2^7.64 to 2^7.60).

New a lookup table:

db 0, 170, 1, 169, 2, 168, 3, 3, 167, 4, 166, 5, 165, 6, 6, 164
db 7, 163, 8, 162, 9, 9, 161, 10, 160, 11, 159, 12, 12, 158, 13, 157
db 14, 156, 15, 155, 16, 16, 154, 17, 153, 18, 152, 19, 151, 20, 20, 150
db 21, 149, 22, 148, 23, 147, 24, 146, 25, 145, 26, 144, 27, 143, 28, 28
db 142, 141, 30, 140, 31, 31, 139, 138, 33, 137, 34, 136, 35, 135, 36, 134
db 37, 133, 38, 132, 131, 40, 130, 41, 129, 42, 128, 127, 44, 126, 125, 46
db 124, 123, 48, 122, 121, 50, 120, 119, 52, 53, 117, 116, 55, 56, 57, 113
db 58, 111, 110, 109, 62, 63, 64, 66, 67, 69, 70, 72, 73, 76, 78, 83
db 254, 249, 246, 244, 242, 241, 239, 238, 237, 235, 234, 233, 232, 231, 230, 229
db 228, 227, 227, 226, 225, 224, 223, 223, 222, 221, 221, 220, 219, 218, 218, 217
db 217, 216, 215, 215, 214, 213, 213, 212, 212, 211, 210, 210, 209, 209, 208, 208
db 207, 206, 206, 205, 205, 204, 204, 203, 203, 202, 202, 201, 201, 200, 200, 199
db 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 193, 193, 192, 192
db 191, 191, 190, 190, 189, 189, 189, 188, 188, 187, 187, 186, 186, 185, 185, 185
db 184, 184, 183, 183, 182, 182, 181, 181, 181, 180, 180, 179, 179, 178, 178, 178
db 177, 177, 176, 176, 175, 175, 175, 174, 174, 173, 173, 172, 172, 172, 171, 171

Demo: http://www.grauw.nl/etc/msx/joou-fm3.rom (15.7 kHz 7.6-bit PCM, 2640K, ASCII16)

Too bad we don’t have a multiplier setting of 16, but I figure maybe by using MULT 15 and/or involving the modulator the bit depth could be increased a bit. Would have to write a little script to scan through the settings and find the optimum.

By Grauw

Ascended (9071)

Аватар пользователя Grauw

25-12-2019, 14:22

D.S.A. (Okazaki) wrote an excellent article about it here:

https://github.com/digital-sound-antiques/emu2413/wiki/DAC-i...

I recommend all to read to fully understand the technique :).

By ToriHino

Hero (528)

Аватар пользователя ToriHino

25-12-2019, 14:29

That sounds very good indeed! At least on a real YM2413, the emulator just produces a lot of noise as you already mentioned Tongue

By Pentarou

Champion (258)

Аватар пользователя Pentarou

25-12-2019, 19:03

Any chance the demo ROM size could be made smaller, so that it can fit into a 2M ROM/RAM?

By Grauw

Ascended (9071)

Аватар пользователя Grauw

25-12-2019, 23:46

Here’s two other songs that are a bit shorter;

http://www.grauw.nl/etc/msx/so3-fm3.rom (15.7 kHz 7.2-bit PCM, 1840K, ASCII16)
http://www.grauw.nl/etc/msx/puff-fm3.rom (15.7 kHz 7.2-bit PCM, 576K, ASCII16)

You can also trim the other demos to be 2 MB in size, they will play for about 132 seconds :).

I play at 15.7 kHz because that’s the VDP HR frequency which I use for timing. That’s 920K / minute. I could play at half the rate to reduce the size, but it muffles the sound so it doesn’t sound as good.

By Manuel

Ascended (16639)

Аватар пользователя Manuel

26-12-2019, 00:00

Can you also make some videos of these examples playing on real hardware?

By Pentarou

Champion (258)

Аватар пользователя Pentarou

26-12-2019, 01:09

Thanks! On my setup the sound is a bit quiet, but very good!

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

26-12-2019, 01:21

Good finding! This is also good chance to improve openmsx

Страница 3/5
1 | 2 | | 4 | 5