2018-10-05 10:52:13

Hello
I recently used sound_lib in a python project of mine in order to play sounds.
It works perfectly fine, with no errors, when it is in its raw, .py form. When I use pyinstaller on it though, and copy in the folder sound_lib, or even when it is just run on its own with no --onefile attached, I get the following error:
Error: the sample buffer was lost.

My code for doing this is below:
    handle=stream.FileStream(file=full)
    lastplayed=full
    handle.looping=False
    global volume
    handle.set_volume(volume/100)
    handle.play()

Thanks for any help you can provide

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!

2018-11-10 16:56:39

Speaking of soundlib. I can find 0 documentation about how the thing actually works. Anyone know if there's like a simple function reference?

2018-11-10 18:15:11

@2 actually you could use dir() in the classes that you will need that are FileStream, output, and channel for the basic stuff. Or you can just explore it's source if you feel confortable with it.
The channel class is in sound_lib/channel.py, the output is in output.py and the stream is in stream.py.

If you want to get in touch with me you can follow me on Twitter
have a nice day.
Paul

2018-11-18 06:58:09

The easiest way to use sound_lib is with the game_utils.sound module. (Game_utils also includes classes for menus, cut-scenes and the like.)

Thumbs up

2018-11-18 19:12:59

yeah. I would, but I can't get it to compile into the actual EXE using pyinstaller, which makes its usage all but useless

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!

2018-11-19 06:38:39

As for soundlib, I had to learn it all myself, which was relatively easy given the fact I knew how bass worked already.

Follow on twitter! @masonasons_me
Thanks, enjoy, thumbs up, share, like, hate, exist, do what ya do,
my website: masonasons.me
If this post is of any use, why not thumb it up?

2018-11-19 18:15:48

@6
Yeah. I manjaged to teach myself most of it, though I freely admit to having a helping hand to get me started from a friend of mine. The dir() command is wonderful in python.
I must wonder if it is something in my code, perhaps? because googling this issue, where I use pyinstaller to turn the python program into an exe file does not seem to ever occur.

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!

2018-11-19 22:20:44

You will have to make pyinstaller not pack the files into the executable in order to make sound_lib work correctly. Not sure on the exact command for this.

Follow on twitter! @masonasons_me
Thanks, enjoy, thumbs up, share, like, hate, exist, do what ya do,
my website: masonasons.me
If this post is of any use, why not thumb it up?

2018-11-20 10:13:51

where do I get soundlib and gameUtils etc etc?

Thumbs up

2018-11-20 20:02:49

Really? I think it does it even without onefile to be honest, but don't quote me on that.

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!

2018-11-21 22:49:15

It didn't when I tried it last.

Follow on twitter! @masonasons_me
Thanks, enjoy, thumbs up, share, like, hate, exist, do what ya do,
my website: masonasons.me
If this post is of any use, why not thumb it up?

2018-11-21 23:16:07

@masonian
You can use both AO2 and sound_lib in a frozen one-file executible, however the libs have to be placed along-side your app. The procedure is as follows

First, delete c:\python36\lib\site-packages\pyinstaller\hooks\hook-accessible_output2 and hook-sound_lib.py
These, in fact, are more a hinder than help it turns out. thanks a lot relative paths.

Next, cd to your project irectory and run

pyinstaller --onefile --windowed (... whatever flags here) script.py

This will create a dist directory with your scripts executable, which will complain after running. Now comes the most tedious part, but once it's done you won't have to worry about it. Copy the sounds directory and any other requirements to dist. Now you'll have to copy the bass and screen reader DLL's
Copy these directories into dist as well. c:\python36\lib\site-packages\accessible_output2 and c:\python36\lib\site-packages\sound_lib. Returning to dist, open accessible_output2 and sound_lib's directories an feel free to delete everything other than lib

Let me know if more explanation is necessary here

Thumbs up

2018-11-22 17:23:10

Hey @cartertemm
I followed your steps, converting to python 2.7 because that is what I am using, and still get the error from post 1.

Nathan Smith
Managing Director of Nathan Tech
It's not disability
It's ability!