• R/O
  • SSH

Zusammenfassung des Repository

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

VGM playback library for Common Lisp


Neueste Commits RSS

Rev. Zeit Autor Nachricht
7d8ca9425b41 2023-08-20 16:47:44 Remilia Scarlet tip Add a note that the repo has moved to https://chiselapp.c...
102459d057a9 2023-08-19 22:51:56 Remilia Scarlet Fix a few typos, clean up some lines
223b236c1baa 2023-08-19 22:51:32 Remilia Scarlet DATA should always be 8-bit
6cc221fe7d63 2023-08-19 22:51:14 Remilia Scarlet Change fill-buffers so that it matches YunoSynth's behavior
1c7f18f23b9c 2023-08-19 22:50:50 Remilia Scarlet Quit playing when the VGM has ended
8c1a80832907 2023-08-18 19:06:44 Remilia Scarlet Add a very simple example player.
fa90ff7c6cda 2023-08-18 19:06:35 Remilia Scarlet Add missing exports
399f3002950f 2023-08-18 19:06:13 Remilia Scarlet Add T/CHIP->NAME, T/CHIP->LONG-NAME, SUPPORTED-CHIPS, and...
bbcf16770da5 2023-08-18 19:05:08 Remilia Scarlet Render to float32
7e2489948f56 2023-08-18 19:04:52 Remilia Scarlet Export some more thing

Kürzlich bearbeitete Tags

Name Rev. Zeit Autor
tip 7d8ca9425b41 2023-08-20 16:47:44 Remilia Scarlet

Zweige

Name Rev. Zeit Autor Nachricht
default 7d8ca9425b41 2023-08-20 16:47:44 Remilia Scarlet Add a note that the repo ha...

README.md

SatouSynth

NOTE: Moved to https://chiselapp.com/user/MistressRemilia/repository/satou/

SatouSynth is a high-performance VGM playback library written entirely in Common Lisp. The goal is to provide native VGM playback in Common Lisp without bindings, a cleaned-up version of VGMPlay's code, and performance on par with my YunoSynth library.

Wanna support me? Buy me a coffee on Ko-Fi, or support me through Liberapay.

Buy Me a Coffee at ko-fi.com Donate using Liberapay

Example videos

Comming soon.

Features

  • Rendering of VGM files to PCM.
  • High quality resampling.
  • Compressed (gzip) VGM loading, as well as a mechanism to extend this with additional compression methods. New methods include:
    • BZip2 compressed VGMs
    • ZStandard compressed VGMs.
  • Full GD3 tag support.
  • DAC support.

Implemented Chips

More chips will be added as time goes on.

  • Hudson HuC6280 (two different cores)
  • Namco C352
  • Sega SegaPCM
  • Sega MultiPCM
  • Yamaha YM2151

Known Issues

  • The DAC code is not yet completely ported and, right now, does nothing.

Usage

This currently only supports SBCL.

Most dependencies can be installed using QuickLisp (though this hasn't been tested). The exception is the CL-SDM library, which can be obtained here.

Place this library (and the CL-SDM dependency) somewhere where ASDF can find them, then run this in your REPL:

(asdf:load-system :satou)

Example Player

This uses the CL-PortAudio for playback.

(defun play-vgm (filename)
  (let* ((buf-l (cl-sdm:new-array 1024 cl-sdm:t/int16))
         (buf-r (cl-sdm:new-array 1024 cl-sdm:t/int16))
         (buf (cl-sdm:new-array 2048 single-float 0.0))

         ;; Read VGM, then make a player.
         (vgm (satou:read-vgm-file filename))
         (player (satou:make-vgm-player vgm)))

    ;; Start PortAudio
    (pa:with-audio
      (pa:with-default-audio-stream (out 0 2 :sample-rate 44100.0d0
                                             :sample-format :float
                                             :frames-per-buffer 1024)
        ;; Start playback
        (satou:vgm-player-play player)
        (sdm:gc t)

        ;; Render loop
        (loop until (or (satou:vgm-player-at-end-p player)
                        (>= (satou:vgm-player-times-played player) 2))
              do ;; Render
                 (satou:vgm-player-render player buf-l buf-r)

                 ;; Interleave the buffers and convert to float32 for PortAudio
                 (loop for i fixnum from 0 below 1024
                       for j fixnum from 0 by 2
                       do (setf (aref buf j) (/ (aref buf-l i) 32768.0)
                                (aref buf (1+ j)) (/ (aref buf-r i) 32768.0)))

                 ;; Write to putput
                 (pa:write-stream out buf))))))

(play-vgm #P"/path/to/your/song.vgm")

Development

Flags for *FEATURES*

SatouSynth supports a few flags that can be put into *FEATURES* prior to compiling it.

  • :SATOU-DEBUG: Print various debug information to the console.
  • :SATOU-SUPER-DEBUG: Print even more debug information to the console.
  • :SATOU-WD40: Enable various micro-optimizations that may possibly do unsafe things in exchange for some small speed boosts.

File Names

In the chips folder, all files should follow this scheme:

  • chip-[CHIPNAME].lisp: This is the public interface for the chip. Replace [CHIPNAME] with the name of the chip (e.g. chip-ym2151.lisp).
  • emu-[CHIPNAME]-[BASE].lisp: This is the private emulator for the chip. Replace [CHIPNAME] with the name of the chip, and [BASE] with the code that the emulator is based on (e.g. emu-ym2151-mame.lisp).

Style info

I use a slightly unorthodox style for my code. Aside from these differences, please use normal Lisp formatting.

  • Keep lines 118 characters or shorter. Obviously sometimes you can't, but please try. Use 115 characters for Markdown files, though.
  • I mark types using the form T/..... For example, T/SOME-NEAT-TYPE. For predicates on these, use SOME-NEAT-TYPE-P.
  • No tabs. Only spaces.

How do I contribute?

  1. Go to https://osdn.net/users/yukiraven/pf/satousynth/ and clone the Mercurial repository.
  2. Create a new branch for your feature.
  3. Push locally to the new branch
  4. Create a ticket.

Contributors

Links and Licenses

SatouSynth itself is under the GNU Affero General Public License version 3.

The emulation cores, which were all ported by hand to Common Lisp, have various other licenses, which can be found in the docs/licenses folder in this repository. Most of them are from the MAME project.

Much of the playback code is indirectly based on heavily modified code from VGMPlay by Valley Bell, et al. via my YunoSynth library.