Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TexZK committed Jun 12, 2020
1 parent 0ae553b commit 887e97d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ actual bootleneck of the emulation.
Also, sample rate conversions add delays to their outputs, which are not
welcome to realtime processing.


### Libraries

This library does not provide sample rate conversion itself, because proper
Expand Down Expand Up @@ -143,7 +142,6 @@ Suitable for realtime, and with small footprint.
A nice modern C++ library, licensed as *GPL3*.
Suitable for realtime, and with small footprint.


### Analog filtering

The datasheet suggests some input and output analog filtering, to reduce
Expand All @@ -169,7 +167,6 @@ _______________________________________________________________________________
Here you can find some descriptions and discussions about implementation
details.


### Language

I chose *C89* with a bit of *C99*. I was going to use *C++20* for my own
Expand All @@ -178,7 +175,6 @@ tiny library. C is also easier to integrate with other languages, and the
mighty features of a colossal language like C++ are more of a burden than for
actual use in such case.


### Cross-platform support

The code itself should be cross-platform and clean enough not to give
Expand All @@ -188,7 +184,6 @@ Currently the library is developed and tested under *Windows* with *MSVC++ 14*.
Of course, I will at least provide support for *gcc* and *clang* under *Linux*.
I do not have access to *macOS*, but I guess the *Linux* support should fit.


### Code style

I chose the path of verbosity for variable declaration, to help debugging fixed
Expand All @@ -201,7 +196,6 @@ at this stage of development. Actually I am not satisfied about how the
code for vectoring should improve the performance by some margin, especially
the parts for parallel 8-tap delay and output oversampling.


### Sample format

The datasheet claims 14-bit *floating point* sampling for both input and
Expand All @@ -223,7 +217,6 @@ am emulating the system right now.
Tests with 16-bit sample emulation sound less worse, so I am wondering whether
signals are actually processed as 14-bit or more.


### Multiplication

Being a DSP, one of the most common operations is multiplication. Since this
Expand Down Expand Up @@ -276,7 +269,6 @@ I guess the negative coefficients are actually loaded as the one-complement
(bit flip) instead of the two-complement, as often seen in Yamaha's
synthesizers of the same age, to save silicon area despite a tiny gain error.


### Digital delay line

The digital delay line allows up to 100 ms of delay at the nominal input rate.
Expand All @@ -286,7 +278,6 @@ Such buffer should be a shifting FIFO with 32 pre-determined tap positions.
The delay line emulation is actually implemented as a random-access ring
buffer, as shifting the whole buffer at each input sample is a waste of time.


### Oversampler

The chip includes a 2x oversampling interpolator at the output stage, to help
Expand All @@ -308,7 +299,23 @@ I also think that the kernel is not *minimum-phase*, to save further silicon
area, thanks to the mirrored coefficient values.
I am no expert, but it looks like minimum-phase is also not welcome to audio,
because of phase-incoherence among frequencies, despite having shorter delays.
I left the possibility to choose the minimum-phase feature by configuration.
I left the possibility to choose the minimum-phase feature by configuring the
`YM7128B_USE_MINPHASE` preprocessor symbol.

### Floating-point

It is possible to configure the floating point data type used for processing,
via the `YM7128B_FLOAT` preprocessor symbol. It defaults to `double`
(*double precision*).

Please note that, contrary to common beliefs, the `double` data type is
actually very fast on machines with hardware support for it.

I think that you should switch to `float` (*single precision*) only if:

- the hardware is limited to it, or
- if machine code vectorization gets faster, or
- conversion from/to buffer data to/from double precision is slower.

_______________________________________________________________________________

Expand Down
4 changes: 2 additions & 2 deletions src/YM7128B_emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ YM7128B_Tap const YM7128B_Tap_Table[YM7128B_Tap_Value_Count] =

YM7128B_Fixed const YM7128B_OversamplerFixed_Kernel[YM7128B_Oversampler_Length] =
{
#if YM7128B_MINPHASE
#if YM7128B_USE_MINPHASE
// minimum phase
KERNEL(+0.073585247514714749),
KERNEL(+0.269340051166713890),
Expand Down Expand Up @@ -448,7 +448,7 @@ YM7128B_Fixed YM7128B_OversamplerFixed_Process(

YM7128B_Float const YM7128B_OversamplerFloat_Kernel[YM7128B_Oversampler_Length] =
{
#if YM7128B_MINPHASE
#if YM7128B_USE_MINPHASE
// minimum phase
KERNEL(+0.073585247514714749),
KERNEL(+0.269340051166713890),
Expand Down
4 changes: 2 additions & 2 deletions src/YM7128B_emu.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ extern "C" {
#define YM7128B_Float_Max (+1) //!< Minimum floating point value
#endif

#ifndef YM7128B_MINPHASE
#define YM7128B_MINPHASE 0 //!< Enables minimum-phase oversampler kernel
#ifndef YM7128B_USE_MINPHASE
#define YM7128B_USE_MINPHASE 0 //!< Enables minimum-phase oversampler kernel
#endif

// ============================================================================
Expand Down

0 comments on commit 887e97d

Please sign in to comment.