Forum > Third party

QBasic-style music to MIDI file

(1/1)

Roland57:
Hello!

Here is a little tool which creates a MIDI file from a QBasic-style string for the Play command. It's a literal translation of a FreeBASIC program.

Example:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---(* sarabande.pas *) uses  SysUtils, Play2Mid; (*======================================================================== Johann Sebastian Bach Sarabande from C Minor Cello Suite (BWV 1011) FreeBASIC version 20.09.2020========================================================================*) const  A = 'O4 L8MLGE-<BMN>CL4<A- L8ML>>C<A-EMNFL4<B L8ML>>D<A-EMNFML<GMN>G MLFE-<BMN>CL4<C';  B = 'O4 L8MLCE-A-MNGML>D-MNC ML<DFB-MNA-ML>CMN<B- MLA-GDMNE-ML<B-MN>D L2ML<E-.';  C = 'O4 L8MLB-GDMNE-L4<D- L8ML>B-GEMNFL4<G L8ML>>D-<B-EMNFML<CMN>>C ML<B-A-EMNFL4<F';  D = 'O3 L8MLE->CFMNE-MLB-MNA ML<D>DGMNFML>CMN<B ML>C<A-F+MNGML<BMN>C ML<G>DGMNF+ML>CMN<B';  E = 'O5 MLE-C<F+MNGML<AMN>>E- MLL64DE-L16D.L8<A-EMNFML<BMN>G MLFE-<BMN>CML<GMN>B ML<CG>FMNE-L4ML>C'; begin  midiFileName := 'sarabande.mid';  Play('T48' + A + B + A + B + C + D + E + C + D + E + 'P2.');end. 
QBasic music to MIDI file

Mastropiero:
Excellent.

I used to make great tunes with this language (not only used on Qbasic, it is the most popular way to create music on 8bit/16bit computers in Japan during the 80s and early 90s).  Most Sega Mastersystem and Genesis musics were composed by using this kind strings. They are commonly known as MML (Macro Music Language) and you can still find tons of emulators and tools to compose and listen to music written in this way.

More info here: http://www.vgmpf.com/Wiki/index.php/Music_Macro_Language

It would be very nice to have not only the MML parser, but a whole sound engine for it written in Freepascal. Most common chips used for this kind of music were AY-3-8910, YM2203, YM2151, YM2608...  What about emulating those chips? There already are tons of implementations in C or C++ so they could be easily translated to Pascal.

shyub:
For some reason, the execution of the procedure "Play('T48'....);" gives me an error.

Roland57:

--- Quote from: Mastropiero on August 23, 2022, 04:21:30 pm ---I used to make great tunes with this language (not only used on Qbasic, it is the most popular way to create music on 8bit/16bit computers in Japan during the 80s and early 90s).  Most Sega Mastersystem and Genesis musics were composed by using this kind strings. They are commonly known as MML (Macro Music Language) and you can still find tons of emulators and tools to compose and listen to music written in this way.

--- End quote ---

Thank you for the informations.

Roland57:

--- Quote from: shyub on August 24, 2022, 11:04:55 am ---For some reason, the execution of the procedure "Play('T48'....);" gives me an error.

--- End quote ---

Which error please?

Navigation

[0] Message Index

Go to full version