TPT Audio Library for Lua

  • Draco712
    22nd Jun 2018 Member 0 Permalink

    Yes, it's a real audio library for TPT, within TPT itself! This is my second attempt at implementing audio in TPT, and now it seems to work, using LuaJIT's built-in FFI library (which allows you to load libraries, e.g. those .dll/.so/.framework files). (My first attempt was used in a NOTE element, found here: http://tpt.io/.301332, which didn't seem appealing.)

     

    You only need this audio library (link below), get some libraries for your system, and some files to play, then you're good to go!

     

     

    To install, read the installation instructions here and follow the instructions for your system.

     

    Afterwards, place a WAV file on your TPT directory, and do the following, either in your autorun.lua, or directly in the TPT console (line-by-line):

    audio = require("audio.audio") -- Load the library
    audio.init() --Initialize the library, should return true if loading succeeded.
    fwee = audio.load("Fwee.wav") -- Fwee.wav or whatever WAV file you want to play
    chan = audio.play(fwee) -- Play it.
    audio.setVolume(chan,64) -- Halve the volume (maximum is 128)

     

    P.S.: This library is still in development, and bugs/issues are always present. Tell us of any issues you might encounter while using this.
    (For those that use `yum` for their Linux, I am not able to find SDL2 libraries for those systems, sorry. If you happen to find an alternative, please let me know!)

    P.S.2: NOTE Element coming soon! Comes with different instruments and a GUI for easier use.

    Links:

    Edited 3 times by Draco712. Last: 22nd Jun 2018