GithubHelp home page GithubHelp logo

Comments (10)

MaKiPL avatar MaKiPL commented on May 14, 2024

NAudio which we use is capable to forge a Midi messages and is capable of supporting all important messages. Therefore it may be possible to actually convert SGT segments to real buffered Mdi event collections. That may require digging up the deprecated documentation of segments. Question is if it's really worth the probably huge amount of time to introduce DirectMusic converter

EDIT:
Looks like someone already made DirectMusic> Soundfont2 converter:
https://github.com/frabert/libdmusic

from openviii-monogame.

Sebanisu avatar Sebanisu commented on May 14, 2024

cool :)

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

Got the music working without using DirectMusic by parsing SGT file into sequence and translating to MIDI messages. See example state at:
b3a7785
the all tempo and things like that are constant, I just wanted to play the notes, not caring for the tempo, speed and instruments. Playback would be probably provided with FluidSynth or NAudio for both Linux and Windows just to delete use of the deprecated directmusic at all

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

some notes so I don't forget:

  1. seqt[n].mTime is sorted - that's good, no need for Linq every note as in prototype.
  2. seqt[n].mDuration should be put on a list for a note and channel and then noteoff'd
  3. seqt[n].dwPChannel has already a channel pointer- that's very good
  4. seqt[n].bByte1 is note
  5. seqt[n].bByte2 is velocity
  6. seqt[n].bStatus is MID event, but it's always 144=noteOn

Tempo is double but it reports weird values. Maybe it's not double or something?

Thread:

  • init_debugger_audio on init should create Thread. The thread should get messages from the engine.
  • Every PlayMusic should clear the sequence and stop the internal MIDIEvents.
  • The thread should also GC pin the unmanaged variables.

Performance:
The segment reading is faster than vanilla DxMusic

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

segh::mTime

0: 62208
1: 44544
4: 154368
5: 185856
79:329024 (demo)
93:467712 (lasboss)

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

I wonder if creating a MIDI itself wouldn't be faster and more stable than handling the operations on my own. Currently I have to implement a thread with tempo, curves and all that stuff, but on the other hand I can create a .mid in memory and whole synth will do it on it's own 'their way' (which I'm more than sure is way faster). Afair NAudio has whole MIDI creation class.

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

DMUS_IO_TIMESIGNATURE may be wrong. The structure sizeof=8, but the algorithm reads actually (sectionLength-4) / 2 where it should be divide by 8. I just got a lot of rubbish in tims and noticed this error. Finally we lack the formulas for converting the time signature events to MIDI like- worth to follow libdmusic code to find out how the tempo and timing is parsed

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

TEMPO notes:
DMUS_PPQ is const 768
Calcs: 60 000 000 (BPM
PPQ)?
Current example: 1202000 = 240 000
QuarterNote is set to 360 for now
Let N= 2000 in (120
2000)

N - slower
<N - faster

60 000 000 / BPM = mill->
so setTempo((60000000/BPM) - needs testing

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

OpenVIII now uses custom NAudio library with my extension: naudio/NAudio#499
to write Midi to memory instead of HDD for fluid_player_add_mem

from openviii-monogame.

MaKiPL avatar MaKiPL commented on May 14, 2024

DirectMusic segments are now played in X64 and linux. It's still WIP, I'm making new issue

from openviii-monogame.

Related Issues (20)

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.