October 18, 2021, 23:45:00

Author Topic: Any more info on PLAY command?  (Read 292 times)

Offline lettersquash

  • Jr. Member
  • **
  • Posts: 96
    • Lettersquash Blog
Any more info on PLAY command?
« on: May 05, 2021, 20:52:08 »
Hi, I was trying the PLAY command today and I wondered if you can direct me to any more details on this notation, please? Where does the syntax originate, and are there any more detailed instructions on using it than on the website? https://smallbasic.github.io/reference/534.html

Also, is there a way to play music such as a MIDI file, or any plans to add something like that.

I'm wondering about the possibility of using sB for a music editor program, and while simple tones (using PLAY or SOUND) would be ok for an audible prompt of the note in the editor, I hoped it might be possible to play the music back with something more sophisticated.

Thanks
¬~
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

Offline chrisws

  • Full Member
  • ***
  • Posts: 117
    • SmallBASIC
Re: Any more info on PLAY command?
« Reply #1 on: May 06, 2021, 09:03:57 »
Take a look at this for a more complete example: https://github.com/smallbasic/SmallBASIC/blob/master/samples/distro-examples/sound/Songs.bas

SmallBASIC uses the miniaudio library to play tones as well as wave files.

MIDI could be added as an extension module. This would need to be built around some other c library for example https://github.com/schellingb/TinySoundFont

There is support for a few more formats via the raylib module. You'd need to poke around here https://www.raylib.com/ to find something. Many but not all raylib APIs are implemented in the SB module.

Cheers,
Chris

Offline lettersquash

  • Jr. Member
  • **
  • Posts: 96
    • Lettersquash Blog
Re: Any more info on PLAY command?
« Reply #2 on: May 10, 2021, 00:09:37 »
Thanks Chris, I'll look into those.
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal