User Tools

Site Tools


Playing an MP3 file

by Richard Russell, May 2015

This is a very simple, no-frills, way of playing an MP3 music file:

        mp3file% = OPENIN("*.mp3")
        IF mp3file% = 0 THEN QUIT
        CLOSE #mp3file%
        mp3file$ = $$!420
        PROCmci("open """ + mp3file$ + """ type mpegvideo alias music")
        PROCmci("play music")
        DEF PROCmci(cmd$)
        LOCAL R%, S%
        DIM R% LOCAL 128
        SYS "mciSendString", cmd$, R%, 128, 0 TO S%
        IF S% ERROR 100, "mciSendString failed: " + STR$(S%)

If you want the MP3 file to be played repeatedly you can change the play command to:

        PROCmci("play music repeat")
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
playing_20an_20mp3_20file.txt · Last modified: 2018/04/15 13:36 by richardrussell