Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 13 of 13
Originally Posted by Rubberman 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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8

    Quote Originally Posted by Rubberman View Post
    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?
    the problem is poor reponsiveness (you can also ignore the "delay" in the script I posted above, that dosen't make much difference)

    it won't capture the next key till the wav from the previous key gets through playing

  2. #12
    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,393
    Well, you could run $playcommand in the background, as in:
    Code:
    #!/bin/bash
    while read -n1 char; do
    	playcommand="aplay --duration=1 "$char".wav"
    	$playcommand &
    done
    That will allow the script to grab the next character while playing the previous one.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #13
    Just Joined!
    Join Date
    Dec 2009
    Posts
    8
    I will try this, thank you! my dev system is at work right now, so we'll see monday

Page 2 of 2 FirstFirst 1 2

Posting Permissions

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