incorporate sound files in code
#4
https://staging.qb64phoenix.com/showthread.php?tid=217

It could be easily adapted to work with sound files. Include the BASIC code that it creates into your program.

There is one drawback, however. At the moment QB64PE doesn't have a counterpart to "_NEWIMAGE" that is related to sound. It is one of the biggest requests.

https://github.com/QB64-Phoenix-Edition/...issues/232

https://github.com/QB64-Phoenix-Edition/...issues/166

What could be done at the moment is a suggestion, a messy one that I haven't tried. A string could be created which is the result of "_INFLATE$". Create a "_MEM" variable to point to the beginning of that string. Then an "empty" buffer which is as big (in sample frames) as the biggest sound file to be included has to be loaded in with "_SNDOPEN". Use "_MEMSOUND" to set the destination "_MEM" variable, then do a memory copy, keeping note of the length of the file that was loaded into the string. It might be playable with "_SNDPLAY", or in the least, could be worked on with "_SNDRAW".

It's slow and messy. It wouldn't work if the files are different sampling rates and/or bit rates. It's better to wait and see if there's a QB64PE v3.5 that could give us a "_SNDCREATEBUFFER" or something like that.

I have done a routine only in 44100Hz 16-bit mono wave files which is rather easy to program, loaded from a string and could be played back with "_SNDRAW". But the sound file support in QB64PE supports theoretically any sampling rate and bit rate, and stereo sound in addition.
Reply


Messages In This Thread
incorporate sound files in code - by mdijkens - 12-29-2022, 10:50 AM
RE: incorporate sound files in code - by mdijkens - 12-29-2022, 11:31 AM
RE: incorporate sound files in code - by mnrvovrfc - 12-29-2022, 12:02 PM
RE: incorporate sound files in code - by Dav - 12-29-2022, 01:55 PM
RE: incorporate sound files in code - by mdijkens - 12-29-2022, 03:21 PM
RE: incorporate sound files in code - by a740g - 01-02-2023, 11:24 AM



Users browsing this thread: 3 Guest(s)