2018-09-21 09:16:26

Now see this:
Usage: OpenALHRTF.py wavefile
    Using an example wav file...
Traceback (most recent call last):
  File "C:\Users\Gaurav\Documents\python\OpenAL HRTF Python Example\OpenALHRTF.py", line 303, in <module>
    Example()
  File "C:\Users\Gaurav\Documents\python\OpenAL HRTF Python Example\OpenALHRTF.py", line 43, in __init__
    for a in xrange(0,704,64):
NameError: name 'xrange' is not defined
AL lib: (EE) alc_cleanup: 1 device not closed

2018-09-21 09:21:21

Yay! I changed xrange to range and I heard a sound going from left to right. But now after that the output text onscreen:
Usage: OpenALHRTF.py wavefile
    Using an example wav file...
2
Traceback (most recent call last):
  File "C:\Users\Gaurav\Documents\python\OpenAL HRTF Python Example\OpenALHRTF.py", line 303, in <module>
    Example()
  File "C:\Users\Gaurav\Documents\python\OpenAL HRTF Python Example\OpenALHRTF.py", line 50, in __init__
    self.listener.hrtf = 1
  File "C:\Users\Gaurav\Documents\python\OpenAL HRTF Python Example\OpenALHRTF.py", line 106, in _set_hrtf
    elif num >= 0 and num <= self.hrtf_buffers[0]:
TypeError: '<=' not supported between instances of 'int' and 'c_long'
AL lib: (EE) alc_cleanup: 1 device not closed

2018-09-21 09:33:56

Oops. On line 106 change it from:

    elif num >= 0 and num <= self.hrtf_buffers[0]:

to

    elif num >= 0 and num <= self.hrtf_buffers[0].value:

I think that should fix it.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-21 09:42:27

OK, this time it worked perfectly. But I think it was in some infinite loop or something that's why it kept repeating over and over again, and the text output this time was:
Usage: OpenALHRTF.py wavefile
    Using an example wav file...
2
AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 44100hz instead
True
AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 44100hz instead
True
it did it thrice so I turned it off.

2018-09-21 09:54:56

The example is written to play the sound 3 times, the first time without hrtf, the second with the first set of HRTF tables, and the third time with the second set of HRTF tables. Hm, seems it couldn't find the 48000hz HRTF tables so settled for the 44100 file instead, it seems it could be an issue with Adlib. You should see them in the example directory as "default-44100.mhr" and "default-48000.mhr".

You can change the tables that are loaded by using this line:

    #enable hrtf default_44100 table
        self.listener.hrtf = 1

Actually, you should probably change line 62 to:

    #enable hrtf default_44100 table
        self.listener.hrtf = 2

So it tries to load the second codec properly.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-21 10:04:12

Aah I see. Thanks.

2018-09-21 10:28:24

i have an error when running the hrtf example:
AttributeError: function 'alcGetStringiSOFT' not found

best regards
never give up on what ever you are doing.

2018-09-21 10:33:33

Are you using Pyglet or PyAL? If your using pyglet you need to copy over lib_alc.py to "python/lib/site-packages/pyglet/media/drivers/openal".

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-21 10:41:44

i have it in the folder, but still it does not work. i am using pyglet.

best regards
never give up on what ever you are doing.

2018-09-21 10:55:35

Do you have OpenAL from openal.org installed? That version doesn't have the advanced features enabled, so if you haven't copied over it with OpenAL Soft your system will default to it instead of the DLL's in the working directory. If thats the case you could try downloading and following the instructions in OpenAL Soft, or you can just uninstall OpenAL and use the DLL that comes with the example.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-21 15:55:10

Is it possible to create binaries in python which can't be reversed engineer by tools like pyinstaller extracter and so on? Because majority of the python softwares are open source. If yes, then how?

2018-09-22 05:22:32

Hey guys, I need some help I was reading through pyglet documentation. Now, when I run the following code, NVDA doesn't read anything at all. It says "unknown". I am assuming that the program prints the necessary stuff but screen reader doesn't get it. The code is:
import pyglet
from pyglet import*
window=pyglet.window.Window()
@window.event
def on_key_press(symbol, modifiers):
        if symbol==key.UP:
            print("you pressed up arrow!")
        elif symbol==key.DOWN:
            print("you pressed down arrow!")
        elif symbol==key.S:
            print("yea! it works, it is the key S!")
        elif symbol==key.ESCAPE:
            print("exitting...")
pyglet.app.run()
help would be apreciated.

2018-09-22 09:14:23

First, there is no way to create any binary, for any language, that cannot be reverse engineered. The most anyone can do is make it more difficult to do, or to read the result, but if someone wants your source code, there going to get it.

Second, pyglets window is generally not screen reader friendly. When you press the arrow keys the main window that has focus will print out the words, those words will appear on a secondary console window that opens at the same time as the main window, you'll have to tab over to give it focus.

To get around this you can use the [Tolk Library], this can allow you do direct calls to your screen reader that it can pick up. The latest version from AppVeyor is the one you want, not the one on Github by the way.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-23 06:52:50

OK, I got tolk. Now for python how do I install it because there's no setup.py file which I can run in command line shell and it'll install the lib. I ran build_python batch file but nothing happened.

2018-09-23 08:29:31 (edited by magurp244 2018-09-23 08:32:02)

Using Tolk is fairly easy, but to get it set up you need to collect a few files from the Tolk archive you downloaded and put them in your working directory with whatever script your working on.

After uncompressing it to, say, a directory called Tolk, go to "tolk/src/python/" and copy Tolk.py to your working directory.

Next go to "tolk/bin/x86/" and copy Tolk.dll to your working directory.

Then go to "Tolk/lib/x86/" and copy everything there to your working directory, which should be dolapi32.dll, nvdacontrollerclient32.dll, and saapi32.dll.

Now, tolk.py is the script you import to run Tolk, its a python wrapper for Tolk.dll. Tolk.dll uses the 3 other files, dolapi32, nvdacontrollerclient32, and saapi32, to interface with various types of screenreaders like NVDA. So, if you plan on distributing files you'll need to include all of these with your binary. Also, if your running on a 64 bit system, grab the files from the x64 folders instead of the x86 folders, so Tolk.dll from "tolk/bin/x64", and everything in "Tolk/lib/x64". Now to use Tolk with those files in your working directory just use commands like this:

import Tolk

#initialize tolk
Tolk.load()

#get tolks functions
print(dir(Tolk))

#detect available screen readers
print(Tolk.detect_screen_reader())

#check if braille, speech, or tolk are loaded
print(Tolk.has_braille(), Tolk.has_speech(), Tolk.is_loaded())

#if tolk is speaking, silence it
Tolk.silence()

#have tolk speak
Tolk.output('Talking!')

#output text to a braille display
Tolk.braille("braille!")

#check if tolk is speaking
print(Tolk.is_speaking())

#when the program is finished, unload tolk
Tolk.unload()

Keep in mind that Tolk will need some time to actually, you know, speak. So a better example might involve waiting and whatnot, but you get the idea.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-23 08:40:38

Wow bro thanks a ton. I'd like to add you on skype. What is your skype details? Or we have a blind programmer group, I think our group will be delighted to have you there.

2018-09-24 01:00:54

I don't use skype, but you can generally find me floating around here, heh.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-25 07:34:17

ok. I am looking to develop a simple game. I want to start with something simple, but fun. what language is good to start with. I started studying python, and find I quite enjoy it. however, I can't figure out for the life of me, how to check if my code is working properly. can someone explain to me how to do this, and if bgt is a good language to just code something simple in to start with. any help would be greatly appreciated.

2018-09-25 09:14:07

When you say working properly, what do you mean? To run python scripts you need to install Python, then on the command line you run them by writing "python your-script.py". A simple program like:

print("Hello world!")

Should then be printed in the window, such feedback and results is generally how you know a program is working. If your doing things like creating windows, the fact those windows open is a sign they are working, but checking the output in the console window can also tell you how the program is doing or if there are any errors, if there are Python will output a traceback error log of the problem that occured.

Going off your other thread, which by the way would have been better to create a new thread than to necro-post like that, to work with Jaws you'll need to get the Tolk library, and for audio you'll need to grab an library that has audio functions, like Pygame, SFML, Pyglet, PyAL, Libaudioverse, etc. Few libraries can handle advanced audio however, if thats what you want I can recommend Pyglet. Many of the instructions for doing this have already been covered in this thread, but if you like I can walk you through them.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-09-25 10:31:56

well first of all, I am sorry for asking this on this thred. was just curious and looking for some health. I have been studying bgt for a minute and find it to dam easy. python is easy as well, but it is universal, thus the reason I want to make a game with it. have you done it? is it hard? I figured if talon can make one, so can we.

2018-09-25 11:18:57 (edited by magurp244 2018-09-25 11:23:43)

I was more referring to [this] thread, but lets move on... BGT is considered to be quite easy, but tends to set off virus scanners these days, and theres no guarentee of future updates to it. As for games, the short answer is yes, you can absolutely make a game with python. The difficulty really depends on how much you know and the level of complexity, are you making a simple text adventure? Or a complex 3D first person shooter? Deciding what you want to make helps determine the tools and resources you'll need for the job. If you check post 4 in this thread, you'll find a number of python examples I provided that you may find useful, including a prototype of a first person engine.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2018-10-02 08:58:15 (edited by sunshine 2018-10-02 08:59:41)

@Magurp244, I'm facing some issues when working with the pyglet keyboard handlers. We're working on the game engine, and we created a keyboard.py file which could be imported anywhere in the game file and keypresses could  be handled without importing the from pyglet.window import key everytime. Can you provide a good working example for keyboard handler using pyglet? We could've used pygame for keypress handling but then it would've been a mess as pygame for keypresses and pyglet for OpenAL will make the code kind of messy, not to mention that I'm doubtful that it will even work that way.

2018-10-02 11:14:38

Hm, well there are a few ways of handling it. There's the [KeyStateHandler], but generally I sub class the window and use it as a foundation, adding and updating classes for game logic, menus, etc. passing around input data as required. Every cycle the windows update cycle collects input, then passes it to game logic or whatever, rinses and repeats for the next cycle, and so forth and so on. Example:

import pyglet
from pyglet.window import key

class Example(pyglet.window.Window):
    def __init__(self):
        super(Example, self).__init__(640, 480, resizable=False, fullscreen=False, caption="Example")

    #key input buffer
        self.key_input = []
    #our logic or whatever class
        self.thing = thing()
    #update main loop
        pyglet.clock.schedule_interval(self.update, .01)


    def update(self,dt):
    #update our whatever class with current key input
        self.thing.update(self.key_input)
    #draw screen
        self.draw()
    #clear key buffer for next cycle
        self.key_input = []


    def draw(self):
        self.clear()


#capture key presses
    def on_key_press(self,symbol,modifiers):
        self.key_input.append(key.symbol_string(symbol) + " press")
        if symbol == key.ESCAPE:
            self.close()


#capture key release
    def on_key_release(self,symbol,modifiers):
        self.key_input.append(key.symbol_string(symbol) + " release")


class thing(object):
    def update(self,key):
        if 'RETURN press' in key:
            print 'handling return key'
        elif 'RETURN release' in key:
            print 'handling return key release'


if __name__ == '__main__':
    window = Example()
    pyglet.app.run()
-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer