UnicornConsole icon indicating copy to clipboard operation
UnicornConsole copied to clipboard

Audio support

Open hallucino opened this issue 8 years ago • 10 comments

Currently we don't have any audio support, let's add one !

hallucino avatar Jan 31 '17 20:01 hallucino

Could be possible to use something like Sunvox tracker to provide an music engine? It has a C interface and provides very powerful creation system. I think that it could be a easy way to let carts make their own music while reducing the work required to provide a music engine.

Of course, it might provide more features than needed, and could impact the performance of the system.

proman21 avatar Apr 24 '17 04:04 proman21

Well my idea is to support classic audio format (MIDI/WAV/etc) and not to have a built in modular synthesizer in the project, and so to use external one.

hallucino avatar Apr 24 '17 07:04 hallucino

Hi,

I want to thank you for PX8. I follow its development and it’s quite impressive. 8-bit + FOSS + programming the carts in Python = ♥

About this particular idea, IMHO it is not such a good idea, because:

  • It will be completely incompatible with Pico-8, resulting in making PX8 unable to run Pico-8 carts with sound. I don’t say PX8 has to be 100% compatible with Pico-8, but this is a major issue; just as PX8 supports different fonts and palettes (‘graphic cards’), I see no reason it shouldn’t support multiple ‘sound chips’, one of them imitating Pico-8’s.
  • Binary, opaque sound files are cumbersome, inelegant and huge. IMHO, it is preferable to go for neat, elegant and small solutions, which are transparent and can fit nicely in a plain text file (.dpx8).
  • It goes against the 8-bit aesthetics. 8-bit computers used sound chips, making their sound so uniquely and universally recognizable. Using WAV/MP3 files breaks this. I think PX8 should not be just an ‘SDL wrapper’ audio-wise. MIDI has a completely different sound, which will be ‘inharmonious’ with the 8-bit aesthetics; MIDI, with a Sound Blaster-ish sound, goes with a different, early 90’s IBM PC, aesthetics.
  • Having a ‘sound chip’ can enable carts access (RO or RW) the music data; an example.
  • Pico-8 and actual retro hardware make use of quite simple wave forms. I don’t think it will be a hell of effort to re-implement something along similar lines, especially when there are many FOSS tools which can be used for this purpose.

I hope you will reconsider the idea of playing WAV/MIDI files as audio support :-). I’m sorry I cannot offer actual code for implementing this.

Júda

rwmpelstilzchen avatar Jun 25 '17 02:06 rwmpelstilzchen

@rwmpelstilzchen yes sure I agree with you. I will add basic support like prototracker, mod/mml format. But I want to have also high level format too. Both are not incompatible 👍

hallucino avatar Jun 25 '17 06:06 hallucino

Thanks :-)

rwmpelstilzchen avatar Jun 25 '17 09:06 rwmpelstilzchen

My plan is the following:

  • [X] audio support via SDL
  • [X] Use libksnd to have the chiptune (here the ongoing binding: https://github.com/Gigoteur/chiptune-rs)
  • [X] load kt/ki files
  • [ ] Support to edit a music/instrument via the API
  • [ ] Support mod/xm format
  • [ ] Music/Instrument editor

hallucino avatar Aug 05 '17 13:08 hallucino

Support for libksnd is added via https://github.com/Gigoteur/chiptune-rs.

hallucino avatar Sep 05 '17 13:09 hallucino

Great news!

When I open it in Klystrack it plays much faster and in a higher pitch, though.

rwmpelstilzchen avatar Sep 05 '17 14:09 rwmpelstilzchen

@rwmpelstilzchen It is possible ! I will add the possibility to access all options via the API

hallucino avatar Sep 05 '17 18:09 hallucino

Audio support is working now. I kept only klystrack deps + sdl

hallucino avatar Oct 29 '17 05:10 hallucino