Git Product home page Git Product logo

emu2413's People

Contributors

carmiker avatar okaxaki avatar orbea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emu2413's Issues

Problem when switching AR=0 tone

emu2413 v1.5.7 can not correctly perform ar0test.vgm.zip.

  • emu2413: The tone is changed into pure sine from the 3rd note.
  • real chip: The tone is changed into pure sine from the 4th note.

ar0test.vgm.zip is genarated from the following MGSDRV MML.

#opll_mode 1
#tempo 150

@v15 = { ;
;       TL FB
        63, 7,
; AR DR SL RR KL MT AM VB EG KR DT
  15, 0, 0,10, 0,15, 0, 0, 1, 0, 0,
  15, 0, 0,10, 0, 1, 0, 0, 1, 0, 0 }

@v16 = { ;
;       TL FB
        63, 7,
; AR DR SL RR KL MT AM VB EG KR DT
   0, 0, 0,10, 0,15, 0, 0, 1, 0, 0,
  15, 0, 0,10, 0, 1, 0, 0, 1, 0, 0 }

9 v15
9 @15 o4 c4 r4 c4 r4 @16 c4 r4 c4 r4

The intention of the MML above is to change the tone from the 3rd note.
The behavior of the real chip is counter-intuitive, but this should be emulated for accuracy.

Does quality>0 result in no resampling and bad aliasing/imaging?

I'm not too familiar with emu2413, but am working on developing a new tracker which will support VRC7 FM in the future. 0CC-FamiTracker includes a copy of emu2413 from 2004, but I found this repo which seems to be updated.

emu2413/emu2413.c

Lines 1371 to 1388 in a0b0c61

int16_t
OPLL_calc (OPLL * opll)
{
if (!opll->quality)
{
update_output(opll);
return mix_output(opll);
}
while (opll->realstep > opll->oplltime)
{
opll->oplltime += opll->opllstep;
update_output(opll);
}
opll->oplltime -= opll->realstep;
return mix_output(opll);
}

Looking at master OPLL_calc(), it seems like if opll->quality != 0, you run an unknown number of OPLL cycles (varies with sampling rate), then return the latest sample. Because you do not perform resampling, this will drop synthesized samples (or duplicate them if the speaker sampling rate is over 49716 Hz). Is this right?

Dropping/duplicating audio samples will seriously degrade audio quality. As a resampling method, it converts each discrete-time sample into a continuous-time rectangular non-bandlimited pulse (creating frequency imaging), then samples from that rectangle train (turning the images into aliases). This process generates many unwanted frequencies in the outputted audio.

emu2413/emu2413.c

Lines 1456 to 1472 in 3226177

OPLL_calc (OPLL * opll)
{
if (!opll->quality)
return calc (opll);
while (opll->realstep > opll->oplltime)
{
opll->oplltime += opll->opllstep;
opll->prev = opll->next;
opll->next = calc (opll);
}
opll->oplltime -= opll->realstep;
opll->out = (e_int16) (((double) opll->next * (opll->opllstep - opll->oplltime)
+ (double) opll->prev * opll->oplltime) / opll->opllstep);
return (e_int16) opll->out;

By comparison, the 2004 version of the library (related to that found in 0CC-FamiTracker) appears to perform linear interpolation, which is less bad for audio quality.

(I think 0CC runs the synth at quality=0, which runs emu2413 at the PC sampling rate, rather than the chip's original rate.)


Also I may use https://www.vogons.org/viewtopic.php?f=9&t=37782 instead. Is that code fast enough for real-time usage?

Can't build with Visual Studio

Degraded from #6. min/max function conflicts with Visual Studio's min/max definition.
These confliction possibly occurs on other platform that defines min/max as macro.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.