Hyper Voice: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 4: Line 4:


{{Anchor|Hyper Voice Output}}
{{Anchor|Hyper Voice Output}}
=== Hyper Voice Left Output ($64, $65) ===
=== Hyper Voice Left Output ($64, $65 write) ===


=== Hyper Voice Right Output ($66, $67) ===
=== Hyper Voice Right Output ($66, $67 write) ===


<pre>
<pre>
Line 12: Line 12:
  ---- ----  ---- ----
  ---- ----  ---- ----
  ssss ssss  ssss ssss
  ssss ssss  ssss ssss
|||| ||||  |||| ||||
  ++++-++++--++++-++++- Signed 16-bit sample.
  ++++-++++--++++-++++- Signed 16-bit sample.
</pre>
</pre>
Line 18: Line 19:


{{Anchor|Hyper Voice Input}}
{{Anchor|Hyper Voice Input}}
=== Hyper Voice Left Input ($68) ===
=== Hyper Voice Input ($69 write) ===
 
=== Hyper Voice Right Input ($69) ===


<pre>
<pre>
Line 26: Line 25:
---- ----
---- ----
ssss ssss
ssss ssss
++++-++++- 8-bit sample.
|||| ||||
++++-++++- Signed 8-bit sample.
</pre>
</pre>


These are typically written to by [[DMA|Sound DMA]], but can also be written to manually by the user.
Hyper Voice samples are typically written by [[DMA|Sound DMA]], but can also be written manually by the user. In the latter case, the "channel mode" setting is ignored - it always behaves as if it were in "stereo" mode, writing one channel after the other in sequence.


{{Anchor|Hyper Voice Control}}
{{Anchor|Hyper Voice Control}}
Line 37: Line 37:
15  bit  8  7  bit  0
15  bit  8  7  bit  0
  ---- ----  ---- ----
  ---- ----  ---- ----
  .mmc .... errr ffss
  .mmc ???? errr ffss
  |||      |||| ||||
   |||      |||| ||++- Shift/Volume:
   |||      |||| ||++- Shift/Volume:
   |||      |||| ||      0 = 100%  1 = 50%
   |||      |||| ||      0 = 100%  1 = 50%
   |||      |||| ||      2 = 25%    3 = 12.5%
   |||      |||| ||      2 = 25%    3 = 12.5%
   |||      |||| ++--- Input sample mode:
   |||      |||| ++--- Sample scaling mode:
   |||      ||||        0 = Unsigned
   |||      ||||        0 = Unsigned
   |||      ||||        1 = Unsigned, negate
   |||      ||||        1 = Unsigned, negated
   |||      ||||        2 = Signed
   |||      ||||        2 = Signed
   |||      ||||        3 = Signed, ignore Shift/Volume
   |||      ||||        3 = Ignored
   |||      |+++------ Update sample rate/Divisor:
   |||      |+++------ Update sample rate/Divisor:
   |||      |            0 = 24000/1  = 24000 Hz
   |||      |            0 = 24000/1  = 24000 Hz
Line 56: Line 57:
   |||      |            7 = 24000/12 =  2000 Hz
   |||      |            7 = 24000/12 =  2000 Hz
   |||      +--------- Enable: 0 = off, 1 = on
   |||      +--------- Enable: 0 = off, 1 = on
   ||+----------------- Input channel: 0 = left, 1 = right
   ||+----------------- Reset: When 1 is written, the following DMA sample
  ||                          will be used for the left channel.
   ++------------------ Channel mode:
   ++------------------ Channel mode:
                         0 = Stereo
                         0 = Stereo
Line 63: Line 65:
                         3 = Mono, both channels
                         3 = Mono, both channels
</pre>
</pre>
Internally, 8-bit values of the form <tt style="white-space: nowrap">Vvvv vvvv</tt> are transformed to signed 16-bit samples based on the scaling mode as follows, where <code>V</code> represents the highest, 7th bit of the input value:
{| class="wikitable"
! Sample scaling mode
! Bit representation
|-
| Unsigned
| <tt style="white-space: nowrap">000 Vvvv vvvv 0000 0000</tt>
|-
| Unsigned, negated
| <tt style="white-space: nowrap">111 Vvvv vvvv 0000 0000</tt>
|-
| Signed
| <tt style="white-space: nowrap">VVV Vvvv vvvv 0000 0000</tt>
|-
| Ignored
| <tt style="white-space: nowrap">___ Vvvv vvvv 0000 0000</tt>
|}
With the exception of the Ignored mode, the resulting value is shifted right by <code>Shift</code> bits, and the result's bottom 16 bits are used as the sample.

Latest revision as of 14:53, 29 March 2024

Hyper Voice is a headphone-only sample output channel introduced with the WonderSwan Color. It allows converting 8-bit signed and unsigned, mono and stereo samples into 16-bit signed PCM sent directly to the headphone output, after mixing with the traditional four channels.

I/O Ports

Hyper Voice Left Output ($64, $65 write)

Hyper Voice Right Output ($66, $67 write)

15  bit  8  7  bit  0
 ---- ----  ---- ----
 ssss ssss  ssss ssss
 |||| ||||  |||| ||||
 ++++-++++--++++-++++- Signed 16-bit sample.

Unlike the Sound sample output registers, these can be written to - allowing for direct 16-bit sample output.

Hyper Voice Input ($69 write)

7  bit  0
---- ----
ssss ssss
|||| ||||
++++-++++- Signed 8-bit sample.

Hyper Voice samples are typically written by Sound DMA, but can also be written manually by the user. In the latter case, the "channel mode" setting is ignored - it always behaves as if it were in "stereo" mode, writing one channel after the other in sequence.

Hyper Voice Control ($6A, $6B)

15  bit  8  7  bit  0
 ---- ----  ---- ----
 .mmc ????  errr ffss
  |||       |||| ||||
  |||       |||| ||++- Shift/Volume:
  |||       |||| ||      0 = 100%   1 = 50%
  |||       |||| ||      2 = 25%    3 = 12.5%
  |||       |||| ++--- Sample scaling mode:
  |||       ||||         0 = Unsigned
  |||       ||||         1 = Unsigned, negated
  |||       ||||         2 = Signed
  |||       ||||         3 = Ignored
  |||       |+++------ Update sample rate/Divisor:
  |||       |            0 = 24000/1  = 24000 Hz
  |||       |            1 = 24000/2  = 12000 Hz
  |||       |            2 = 24000/3  =  8000 Hz
  |||       |            3 = 24000/4  =  6000 Hz
  |||       |            4 = 24000/5  =  4800 Hz
  |||       |            5 = 24000/6  =  4000 Hz
  |||       |            6 = 24000/8  =  3000 Hz
  |||       |            7 = 24000/12 =  2000 Hz
  |||       +--------- Enable: 0 = off, 1 = on
  ||+----------------- Reset: When 1 is written, the following DMA sample
  ||                          will be used for the left channel.
  ++------------------ Channel mode:
                         0 = Stereo
                         1 = Mono, left channel only
                         2 = Mono, right channel only
                         3 = Mono, both channels

Internally, 8-bit values of the form Vvvv vvvv are transformed to signed 16-bit samples based on the scaling mode as follows, where V represents the highest, 7th bit of the input value:

Sample scaling mode Bit representation
Unsigned 000 Vvvv vvvv 0000 0000
Unsigned, negated 111 Vvvv vvvv 0000 0000
Signed VVV Vvvv vvvv 0000 0000
Ignored ___ Vvvv vvvv 0000 0000

With the exception of the Ignored mode, the resulting value is shifted right by Shift bits, and the result's bottom 16 bits are used as the sample.