QB64 Phoenix Edition
_SndPlayFile not starting sound file - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10)
+---- Thread: _SndPlayFile not starting sound file (/showthread.php?tid=1853)

Pages: 1 2


_SndPlayFile not starting sound file - eoredson - 07-20-2023

Hi,

I have been looking at converting a .mp3 to .m4a to reduce the sound file by 50% for distribution purposes but the .m4a won't play.

Is there any other sound file less than an .mp3 that I could convert to? I have also tried a .wav file but it is bigger than the .mp3

I am using _SndPlayFile <filename>

Erik.


RE: _SndPlayFile not starting sound file - eoredson - 07-20-2023

I recently found a site at:

https://www.xconvert.com/downloads

that reduced my .mp3 file size to 80K in 7 seconds.

Erik.


RE: _SndPlayFile not starting sound file - mnrvovrfc - 07-20-2023

MP3 is really not a very good music format for sound quality. We're being cheated by the sites offering entire albums at 320kbps variable bit-rate of the things... better are the sites offering the songs in FLAC but that's only smaller than WAV although all quality is preserved.

What bit rate do you use with MP3? Do you use constant bit-rate (CBR) or variable bit-rate (VBR)? These are crucial factors.

CBR gives larger file sizes because the whole music file is set to the same bitrate. Meanwhile VBR tries to maximize things in parts that are almost quiet, when compared with parts that could have a large frequency range.

Start with 128kbps within the range offered by a converter such as the one in Audacity, which is barely acceptable for music played through a Chinese rechargeable portable speaker, but not acceptable for playing back from a boom box which is not audiophile quality. Audiophile quality is marginal at 256kbps or better. Any better and use OGG Vorbis instead, or FLAC.

OGG files consistently play at better quality than MP3 at the same bitrates but with slightly larger file sizes. Note there is another file format from the creators of OGG Vorbis, which is called Opus, which I haven't found better or worse than the other two. But more encoders are supporting that.

One thing to watch out for with OGG files: must use "quality" setting as suggested by "oggenc" tool from the OGG Vorbis utilities. Because CBR mode is very slow, wherever it is offered. My first OGG Vorbis encoder was from an early version of MAGIX Music Maker but it only encoded in CBR, it sucked. It might have been faster to play back the song than to have it exported to OGG. There used to be devices that supported OGG format like a Sandisk portable player that had bad battery life unfortunately. But MP3 and WMA are still more widely supported. Some of those Chinese speakers only support WAV and WMA besides MP3.

The WMA on the first iteration of Windows Media Player on WindowsXP was pretty good too, and it had lossy and lossless modes but of course M$ could change the format of it. M4A is also proprietary, it's surprising those could be created away from iTunes program.


RE: _SndPlayFile not starting sound file - SMcNeill - 07-20-2023

The literal or variable STRING sound fileName$ can be WAV, AIFF, AIFC, FLAC, OGG, MP3, MID, IT, XM, S3M, MOD, RAD (v1 & v2), AHX & HVL file types.

Ogg are usually much smaller than mp3, in my experience.


RE: _SndPlayFile not starting sound file - TerryRitchie - 07-20-2023

(07-20-2023, 05:06 AM)SMcNeill Wrote: The literal or variable STRING sound fileName$ can be WAV, AIFF, AIFC, FLAC, OGG, MP3, MID, IT, XM, S3M, MOD, RAD (v1 & v2), AHX & HVL file types.

Ogg are usually much smaller than mp3, in my experience.

I've had best results with .OGG as well. I use Audacity ( https://www.audacityteam.org/ ) to convert and export all sound files to .OGG for QB64 use.


RE: _SndPlayFile not starting sound file - SpriggsySpriggs - 07-20-2023

I like FLAC


RE: _SndPlayFile not starting sound file - TerryRitchie - 07-20-2023

(07-20-2023, 12:10 PM)SpriggsySpriggs Wrote: I like FLAC
Oh I do too but they are HUGE Smile


RE: _SndPlayFile not starting sound file - Dav - 07-20-2023

+1 for using .OGG files over MP3 for QB64 playback.  When making my music apps in QB64 I did extensive testing to decide which format to use.  OGG had the better quailty to size factor to my ears.  Also, some MP3's wouldn't always play correctly.  The free program Audacity, like Terry mentioned, does a good job spitting out low size .OGG files that still sound decent.  I sometimes use the PortableApps Audacity version found here.  I also use a program called 'Acustica Premium' which make better sounding .OGG files at lower file sizes (I think at least).

Another thing cool with using .OGG in QB64 is that you could attach data to the end of the .OGG if wanted without having any sound playback problems. QB64 will ignore that extra data when playing the OGG sound. That's how I did the .QBV video maker - the .QBV files were just .OGG+Video Data, with a footer marking were in the file the added data begins. 

- Dav


RE: _SndPlayFile not starting sound file - mnrvovrfc - 07-20-2023

(07-20-2023, 12:38 PM)Dav Wrote: ....  When making my music apps in QB64 I did extensive testing to decide which format to use.  OGG had the better quailty to size factor to my ears.  Also, some MP3's wouldn't always play correctly.

Ohh you just reminded me about something! I created two games, and sets of music for them, while I got deep into Freebasic almost ten years back. Yes for a few months I got deep into a broken version of Freebasic. Windows10 (before 20H2) wouldn't play properly any of the MP3 files created from that collection. This was whether through QB64 v0.98 or into Groove Music, made me hate that program. Then I plug in Ubuntu Studio 32-bit and fire up Audacious in there and those same exact MP3 files played back just fine. I couldn't just convert them to OGG because Freebasic never had "built-in" routines for music playback, not even wave and I had to borrow code for Win32 API MCI which only supported MP3 playback. Although the commands to MCI suggested it was able to handle OGG Vorbis as well.

I wanted to clarify that M4A and WMA aren't supported by QB64 because they are proprietary. In the very least it requires FFMPEG, the "ffplay" program it comes with which requires "SHELL" to be used and is clunky.


RE: _SndPlayFile not starting sound file - Dimster - 07-20-2023

I have a stupid question regarding an MP3 sound file...if sound is in waves and the waves repeat in identical frequency, amplitude etc, to reduce the size of the file could you not remove those waves which repeat an identical pattern. You could then load into your program the essences of the MP3 sound and have your program play that sound over and over again to the time of the original MP3 sound file??? or this pretty well impossible to do.