Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ok, sound experts need a couple of answers
#1
First off _sndplayfile doesn't wait for completion before moving on to next program line.  Or did I miss something ? ie: two plays directs only plays the second sound.
Must use open, play handle, do/loop until sndplaying isn't.

Second with all the sound bugs fixed and a flurry of forum message about it.  (didn't follow all the threads)  Is there a way to compile sound (wav) files into the program EXE result?  Much like ICON ico files can being included inside exe.

Third is it possible to pre-load wav files into a memory array (different files at different indexes) and run from the array instead of playing files on disk?

Four  converting all the wav files to mp3 would make them smaller.  But would than be better for playing them ?  IMHO no difference.

Thanks
There is a method and purpose to my madness.
Reply
#2
Hi. For the first question - that delay will be caused by audio decoding to RAM. So I recommend that you first record all the sounds in the memory to the field via SndOpen and then start them as needed.

To the second question - of course yes, but it will be a gigantic increase in the size of the source code. For this purpose, use Base64, it is somewhere on the forum. That's one possibility. But why on earth do you want to use WAV for this purpose? Use MP3 or another compression format. After decoding with SndOpen, it can be run directly without intermediate saving to disk with the SndOpen command with the "memory" parameter (I read it somewhere, better check it), I haven't tried it. Just encode a track in MP3 format as a string in Base64 format, you can then insert it as a string into the source code without any problems, because Base64 uses 6-bit encoding - so the characters you normally write in the IDE, so it's compatible. Subsequently, you load this string, decode it from a string in Base64 format into a normal string in binary format, and pass this string to the SndOpen function.
Regarding the third question - of course it is possible. Would you like an example of how to write a loader?
On the last question - currently there is no tool in QB64 that can convert WAV format to MP3 format. I've dabbled with it a bit in the past - and it's pretty crazy. Converting it, that is the true pinnacle of programming art. I can't even think about that.

Hey, bet there's going to be a post in a moment, from someone who writes: Convert WAV to MP3? I wrote this years ago...and here is it... Smile


Reply
#3
Quote:First off _sndplayfile doesn't wait for completion before moving on to next program line.  Or did I miss something ? ie: two plays directs only plays the second sound.
Must use open, play handle, do/loop until sndplaying isn't.
This is by design. The playback happens asynchronously on a separate audio thread. If you need to wait for the playback to complete before moving to another file then you'll be better off using _SNDOPEN, _SNDPLAY and _SNDPLAYING.

Quote:Second with all the sound bugs fixed and a flurry of forum message about it.  (didn't follow all the threads)  Is there a way to compile sound (wav) files into the program EXE result?  Much like ICON ico files can being included inside exe.
Use $EMBED & _EMBEDDED$ for this. You can then pass the string to _SNDOPEN using the "memory" feature.

Quote:Third is it possible to pre-load wav files into a memory array (different files at different indexes) and run from the array instead of playing files on disk?
Certainly. You can store the sound file contents in an array of STRINGs and then pass the string array with the needed index to _SNDOPEN. Then, use the "memory" feature to load the sound from memory.

Quote:Four  converting all the wav files to mp3 would make them smaller.  But would than be better for playing them ?  IMHO no difference.
Usually, one would not notice the difference at good MP3 bit rates. However, converting to MP3 certainly benefits memory and disk space.
Reply
#4
$embed is prob, the way to go.  Audacity is the way to mass convert wavs to mp3.  I intend to write a neat little program using about 70 very short audio feedbacks.  The feedbacks are essential, too make it work professionally.  I also intend first post the program here.  I intend to use dropbox for version tracking updates and program updates.

I never found a truly free phone app to do what I want.  Money grubbers let you have a taste of what makes there app great.  Then charge $20/year for unlimited feature use.  Well then money grubbers meet your worst Bête noire.  A moocher who knows how to write code.
Reply




Users browsing this thread: 2 Guest(s)