Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
hey everyone. I work for this computer repair and training place. we do a lot of work with people with disabilities, and the local state blind services will provide computers ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8

    someone tell me if this is possible


    hey everyone. I work for this computer repair and training place. we do a lot of work with people with disabilities, and the local state blind services will provide computers for the our blind clients, if they can get thier typing up to 30 wpm, which they usually can't cause they don't have any computer to practice on at home. the computers in the shop is thier only way, and transportation is usually difficult for them

    what were thinking is a custom built box (not a computer case, just a plastic lab box) with a PS/2 port or USB port for a keyboard for them to practice on. just a black plastic box, is what the boss wants

    I was thinking, mini ITX ATOM motherboard, CF/IDE flash card, and linux, and and an amplified speaker taken apart inside and mounted in the case

    I have linux expirence, hell i'm running ubuntu server for our shop fileserver in linux raid 1. but this is an area of linux i'm kinda newbied with

    what I would want is a basic linux console to load, with a sound driver loaded, and some kind of application, that just sounds out what key is typed on the keyboard. I've done C before but not on linux, and I don't know the sound api's much, i'm thinking, just some program to fetch the keystroke, and play a locally stored WAV. I don't deal much with this area of linux, I usually deal with the server stuff, so this is kind of a new area for me

    Any C programmers out there want to make this simple program? or does anybody any other alternatives?

    thank you

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Hi,

    there has been some work done in this field.
    I can get some hits when googling: "linux speak blind".

    Like these
    Arch Linux for the blind - ArchWiki
    LinuxSpeaks: Linux for the blind and visually impaired
    Debian GNU/Linux -- You know you want it.

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    that all seems a little too complicated, all I need is a program that can easily repeat each key from the keyboard, without accidently being turned off, without somebody accidently pressing a key to exit it, or enter a other menu or function, or mess with it otherwise.

  4. #4
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    ok, I think I can achieve this with a PHP script using read and play shell commands, would someone reccomend a linux distro that is shell only, and includes sound drivers?

  5. #5
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    PHP?
    Is PHP really fit for interactive programs? Even if you find a way to process key-pressing events, I would expect some disturbing delays before the sounds are played. This can spoil the 30wpm considerably.

    When you just want to write a simple program, I recommend using ncurses.
    Like this:
    Code:
    #include <curses.h>
    
    int main()
    {
      int c;
    
      initscr(); 
      cbreak(); 
      noecho();
    
      c = getch();
      printf("Key pressed: %c\n", c);
    
      echo();
      nocbreak();
      endwin();
      return 0;
    }
    Debian GNU/Linux -- You know you want it.

  6. #6
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    I've done A LOT of command-line programming with PHP, its pretty much my only serious programming, I've done C before and I know how to get a keypress, but I've never dealt with sound processing, especially in a linux/unix environment.

  7. #7
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    well i'm almost all the way there, after a old high school aquaintance suggested a 'sound server' I got ALSA running and using aplay in ubuntu server, with a bash script I made capturing the key with read -n 1 and using aplay with a $keypress".wav" kind of thing, only question I have now is, is there any way to launch a program from the shell in a non blocking way? i tried aplays -nonblock but all taht does is play the wav shorter then usual. is there a command to launch a program into a individual child process that can overlap?

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,392
    You can fork the shell and run the sound generating script in the forked shell, leaving the main shell available for other commands, if that's what you are getting at. You can also run a shell script as a background process with the & directive. Ie, "./sound_script.sh &
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    Quote Originally Posted by Rubberman View Post
    You can fork the shell and run the sound generating script in the forked shell, leaving the main shell available for other commands, if that's what you are getting at. You can also run a shell script as a background process with the & directive. Ie, "./sound_script.sh &
    is there any way to fork just the aplay command from the shell script?

    this is the script

    Code:
    #!/bin/bash
    
    while read -n1 char; do
    	playcommand="aplay --duration=1 "$char".wav"
    	`$playcommand`
    	
    done

  10. #10
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,392
    Why would you want to run this non-blocking? The system will buffer keyboard input, so each call to read a character will get the next one in the input buffer. From what I see, your script should do what you want already. So, what's the problem, exactly?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •