Code Monkey home page Code Monkey logo

libpsg-64's Introduction

LIBPSG FOR QB64-PE

This is a QB64-PE library for playing MML music and sounds using Macrotune PSG. Macrotune is a Music Macro Language (MML) editor to easily create “retro” style music for an app, game or just for fun!

Screenshot

FEATURES

  • Easy plug-&-play API optimized for demos & games
  • Works on Windows and macOS (no Linux support yet)
  • Demo player that shows how to use the library

MUSIC MACRO LANGUAGE (MML)

R        rest (if number follows, rest length)
CDEFGAB  note names (if number follows, note length)
+ or #   sharp
-        flat
.        increase note length by half
<        octave - 1
>        octave + 1
O        octave (0 - 8)
K        transpose (-24 - +24)
L        note length (1 - 32)
T        tempo (0 - 15)
V        volume (0 - 63)
V+       increase volume
V-       decrease volume
W        waveform (0 = triangle, 1 = sawtooth, 2 = complex a, 3 = complex b, 4 = square, 5 = noise on channel1)
\        decay speed (0 = no decay) or volume envelope (0-9) (read below)
:        loop
*        post event (number can be retrieved in PureBasic with EventData() )

Volume Envelope & Decay

The volume envelope uses the same "\" character as decay. This is because the decay doesn't work when using
a volume envelope. If you want to use the "\" as a decay, just type a backslash followed by a number. Such as,
"\2". If you want to use the "\" as a volume envelope, just type the backslash with multiple numbers that are
separated by commas. Such as, "\1,9,2,5". If you don't want the volume envelope to have interpolation, then
type a period after the backslash. Such as, "\.1,9,2,5".

Tempo = BPM

T0  =  40 BPM
T6  =  60 BPM
T9  =  80 BPM
T10 =  90 BPM
T11 = 103 BPM
T12 = 120 BPM
T13 = 144 BPM
T14 = 180 BPM
T15 = 240 BPM

API

Function PSG_IsPlayingMML%%
Sub PSG_PlayMML (Channel0 As String, Channel1 As String, Channel2 As String, Channel3 As String)
Sub PSG_SetMasterVolume (ByVal Volume As Single)
Sub PSG_Sound (ByVal Channel As Unsigned Long, Byval Frequency As Single, Byval Volume As Unsigned Long, Byval Waveform As Unsigned Long)
Sub PSG_Terminate

libpsg-64's People

Contributors

a740g avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.