Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
On Fri, Jan 22, 2010 at 18:15, Jim Simmons wrote: > Sean, > > I appreciate the support, but I don't think what I have written is > going to be anything like a finished product by February 3. A > homepage link to the OLPC content on Floss Manuals might be > appropriate, since there are some finished manuals there and the book > might appear on that page in a couple of months. I wanted to add a > chapter on Collaboration and another on Debugging before I considered > it front-page-worthy. > > As for press releases and the like I don't know that one guy writing a > manual in his spare time is going to impress anyone. A finished book > (and I think the book needs more than the two chapters I mentioned to > be considered finished) or a whole team of people working on a book > would be a different story. I for one think that this is a wonderful contribution, probably the most important one to happen during the 0.88 release cycle. Regards, Tomeu > Making more Activities available, and especially convincing teachers > and children to try and write Activities is definitely my goal, and I > hope that when we have a more finished product that as many people as > possible get to know about it. > > Thanks, > > James Simmons > > On Fri, Jan 22, 2010 at 9:45 AM, Sean DALY wrote: >> I consider this to be a fabulous initiative. Growing the Activity >> ecosystem is very important for Sugar and OLPC and a handbook has been >> a missing link. >> >> I will speak with Christian about a homepage link and I even think we >> should do a callout in our next press release, tentatively scheduled >> for February 3, the day OLPC France will present the OLPC project (and >> myself Sugar) to France's largest corporate foundations at L'Atelier >> (http://www.atelier.fr/usages/3/07012010/one-laptop-per-child-ordinateur-veritable-revolution-pedagogique-39192-.html) >> >> Thanks. >> >> Sean >> >> >> On Thu, Jan 21, 2010 at 5:24 PM, Jim Simmons wrote: >>> I just finished writing another chapter of the book, this one on >>> adding Text to Speech to your Activities. I've also made various >>> additions and corrections to the rest of it. If you want to check out >>> what I have a PDF created with OBJAVI! is available here: >>> >>> http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf >>> >>> I'm going to start working on code samples for a Collaboration chapter >>> next, and I want to do a chapter on debugging Sugar Activities after >>> that. I think Walter had developed some code to let you run Sugar >>> Activities outside of the Sugar environment and that would be a good >>> fit for the debugging chapter. For collaboration I'm going to try to >>> put together a sort of half-finished game called "Battle Royale Tic >>> Tac Toe". I'll also write about file sharing as used by Read Etexts. >>> >>> Once I have this material added I think I'll have enough to make it >>> worth putting on the front page of the site. That won't mean it's >>> finished, but enough of it will be that the book could be considered >>> complete. >>> >>> I welcome collaborators as well as editors on this. There are many >>> topics you could put in a book like this that I'm not qualified to >>> write. >>> >>> I'm up to 87 pages now. >>> >>> James Simmons >>> ___ >>> IAEP -- It's An Education Project (not a laptop project!) >>> IAEP@lists.sugarlabs.org >>> http://lists.sugarlabs.org/listinfo/iaep >>> >> > ___ > IAEP -- It's An Education Project (not a laptop project!) > IAEP@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/iaep > -- «Sugar Labs is anyone who participates in improving and using Sugar. What Sugar Labs does is determined by the participants.» - David Farning ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
Sean, I appreciate the support, but I don't think what I have written is going to be anything like a finished product by February 3. A homepage link to the OLPC content on Floss Manuals might be appropriate, since there are some finished manuals there and the book might appear on that page in a couple of months. I wanted to add a chapter on Collaboration and another on Debugging before I considered it front-page-worthy. As for press releases and the like I don't know that one guy writing a manual in his spare time is going to impress anyone. A finished book (and I think the book needs more than the two chapters I mentioned to be considered finished) or a whole team of people working on a book would be a different story. Making more Activities available, and especially convincing teachers and children to try and write Activities is definitely my goal, and I hope that when we have a more finished product that as many people as possible get to know about it. Thanks, James Simmons On Fri, Jan 22, 2010 at 9:45 AM, Sean DALY wrote: > I consider this to be a fabulous initiative. Growing the Activity > ecosystem is very important for Sugar and OLPC and a handbook has been > a missing link. > > I will speak with Christian about a homepage link and I even think we > should do a callout in our next press release, tentatively scheduled > for February 3, the day OLPC France will present the OLPC project (and > myself Sugar) to France's largest corporate foundations at L'Atelier > (http://www.atelier.fr/usages/3/07012010/one-laptop-per-child-ordinateur-veritable-revolution-pedagogique-39192-.html) > > Thanks. > > Sean > > > On Thu, Jan 21, 2010 at 5:24 PM, Jim Simmons wrote: >> I just finished writing another chapter of the book, this one on >> adding Text to Speech to your Activities. I've also made various >> additions and corrections to the rest of it. If you want to check out >> what I have a PDF created with OBJAVI! is available here: >> >> http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf >> >> I'm going to start working on code samples for a Collaboration chapter >> next, and I want to do a chapter on debugging Sugar Activities after >> that. I think Walter had developed some code to let you run Sugar >> Activities outside of the Sugar environment and that would be a good >> fit for the debugging chapter. For collaboration I'm going to try to >> put together a sort of half-finished game called "Battle Royale Tic >> Tac Toe". I'll also write about file sharing as used by Read Etexts. >> >> Once I have this material added I think I'll have enough to make it >> worth putting on the front page of the site. That won't mean it's >> finished, but enough of it will be that the book could be considered >> complete. >> >> I welcome collaborators as well as editors on this. There are many >> topics you could put in a book like this that I'm not qualified to >> write. >> >> I'm up to 87 pages now. >> >> James Simmons >> ___ >> IAEP -- It's An Education Project (not a laptop project!) >> IAEP@lists.sugarlabs.org >> http://lists.sugarlabs.org/listinfo/iaep >> > ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
I consider this to be a fabulous initiative. Growing the Activity ecosystem is very important for Sugar and OLPC and a handbook has been a missing link. I will speak with Christian about a homepage link and I even think we should do a callout in our next press release, tentatively scheduled for February 3, the day OLPC France will present the OLPC project (and myself Sugar) to France's largest corporate foundations at L'Atelier (http://www.atelier.fr/usages/3/07012010/one-laptop-per-child-ordinateur-veritable-revolution-pedagogique-39192-.html) Thanks. Sean On Thu, Jan 21, 2010 at 5:24 PM, Jim Simmons wrote: > I just finished writing another chapter of the book, this one on > adding Text to Speech to your Activities. I've also made various > additions and corrections to the rest of it. If you want to check out > what I have a PDF created with OBJAVI! is available here: > > http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf > > I'm going to start working on code samples for a Collaboration chapter > next, and I want to do a chapter on debugging Sugar Activities after > that. I think Walter had developed some code to let you run Sugar > Activities outside of the Sugar environment and that would be a good > fit for the debugging chapter. For collaboration I'm going to try to > put together a sort of half-finished game called "Battle Royale Tic > Tac Toe". I'll also write about file sharing as used by Read Etexts. > > Once I have this material added I think I'll have enough to make it > worth putting on the front page of the site. That won't mean it's > finished, but enough of it will be that the book could be considered > complete. > > I welcome collaborators as well as editors on this. There are many > topics you could put in a book like this that I'm not qualified to > write. > > I'm up to 87 pages now. > > James Simmons > ___ > IAEP -- It's An Education Project (not a laptop project!) > IAEP@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/iaep > ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
Aleksey, I tried out your new speech.py last night and it checked out OK. I've put this code in the book and in Git. I will probably add an example of how to use espeak word splitting before the book is published. Right now I need to work on learning collaboration so I can teach it to others, but I'll come back to this chapter soon. I don't know if I'm going to mention GroupThink in this book or not. I want to create some simple collaboration examples, explain them, then see how I feel about adding more content. GroupThink doesn't look like something for a beginner's book. Maybe when this book is out the door some more qualified person will do an advanced book covering all the stuff I could not. James Simmons On Thu, Jan 21, 2010 at 4:41 PM, Aleksey Lim wrote: > On Thu, Jan 21, 2010 at 10:24:50AM -0600, Jim Simmons wrote: >> I just finished writing another chapter of the book, this one on >> adding Text to Speech to your Activities. I've also made various >> additions and corrections to the rest of it. If you want to check out >> what I have a PDF created with OBJAVI! is available here: >> >> http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf > > Thanks for your efforts! > > just minor cleanups you can consider to make code less verbose and > easily understandable(perhaps), see attached speech.py ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
On Thu, Jan 21, 2010 at 10:24:50AM -0600, Jim Simmons wrote: > I just finished writing another chapter of the book, this one on > adding Text to Speech to your Activities. I've also made various > additions and corrections to the rest of it. If you want to check out > what I have a PDF created with OBJAVI! is available here: > > http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf > > I'm going to start working on code samples for a Collaboration chapter > next, and I want to do a chapter on debugging Sugar Activities after > that. Could be useful to mention groupthink library in collaboration part http://wiki.sugarlabs.org/go/Summer_of_Code/2009/Groupthink > I think Walter had developed some code to let you run Sugar > Activities outside of the Sugar environment and that would be a good > fit for the debugging chapter. For collaboration I'm going to try to > put together a sort of half-finished game called "Battle Royale Tic > Tac Toe". I'll also write about file sharing as used by Read Etexts. > > Once I have this material added I think I'll have enough to make it > worth putting on the front page of the site. That won't mean it's > finished, but enough of it will be that the book could be considered > complete. > > I welcome collaborators as well as editors on this. There are many > topics you could put in a book like this that I'm not qualified to > write. > > I'm up to 87 pages now. > > James Simmons > -- Aleksey ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
Aleksey, I did consider mentioning the word tracking feature you put in your example. However, when I tried your example with actual book text rather than letting it speak the source code of the program it seemed to actually skip speaking some of the words. The markup version was more robust. The machine I used for that test was running Fedora 10, and it may be that in 11 or 12 it would work better. I have another box running 11 and I could try it there. I do have your examples in the Git project for the book so readers could discover them on their own. I could see word tracking being useful in the core Read Activity. Actually highlighting text in place in PDF documents and scanned page images is not as simple as what I'm doing with plain text, but perhaps in Read you could have the spoken words appear in a text crawl at the top of the screen. Right now I want to work on collaboration examples but I may revisit this chapter and add something on word tracking. James Simmons On Thu, Jan 21, 2010 at 4:53 PM, Aleksey Lim wrote: > On Thu, Jan 21, 2010 at 10:41:59PM +, Aleksey Lim wrote: >> >> Thanks for your efforts! >> >> just minor cleanups you can consider to make code less verbose and >> easily understandable(perhaps), see attached speech.py > > and also, could be useful to mention words tracking feature of espeak, > like > http://wiki.sugarlabs.org/go/Activity_Team/gst-plugins-espeak#Simple_TTS_example > > Yes, some espeak versions(at least old ones) could miss some words but > its getting better(I didn't check last espeak version but at least > espeak developers are working on track improvements) and in case of > simple tts usage, just reusing espeak native feature would be more > useful than coding marking stuff. ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
Aleksey, Thanks for your feedback. I'll check out your new code when I get home. Offhand I can't tell what you changed, but I'll make sure to test everything before I update the chapter. I was hoping that speech.py could be a file that new developers could drop into their Activities without fully understanding it. Your work has made speech easy to add to an Activity, so maybe after the book is out we'll start seeing more Activities that use it. James Simmons On Thu, Jan 21, 2010 at 4:41 PM, Aleksey Lim wrote: > On Thu, Jan 21, 2010 at 10:24:50AM -0600, Jim Simmons wrote: >> I just finished writing another chapter of the book, this one on >> adding Text to Speech to your Activities. I've also made various >> additions and corrections to the rest of it. If you want to check out >> what I have a PDF created with OBJAVI! is available here: >> >> http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf > > Thanks for your efforts! > > just minor cleanups you can consider to make code less verbose and > easily understandable(perhaps), see attached speech.py > > Aleksey ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
On Thu, Jan 21, 2010 at 10:53:30PM +, Aleksey Lim wrote: > On Thu, Jan 21, 2010 at 10:41:59PM +, Aleksey Lim wrote: > > On Thu, Jan 21, 2010 at 10:24:50AM -0600, Jim Simmons wrote: > > > I just finished writing another chapter of the book, this one on > > > adding Text to Speech to your Activities. I've also made various > > > additions and corrections to the rest of it. If you want to check out > > > what I have a PDF created with OBJAVI! is available here: > > > > > > http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf > > > > Thanks for your efforts! > > > > just minor cleanups you can consider to make code less verbose and > > easily understandable(perhaps), see attached speech.py > > and also, could be useful to mention words tracking feature of espeak, > like > http://wiki.sugarlabs.org/go/Activity_Team/gst-plugins-espeak#Simple_TTS_example > > Yes, some espeak versions(at least old ones) could miss some words but s/some words/some symbols/ > its getting better(I didn't check last espeak version but at least > espeak developers are working on track improvements) and in case of > simple tts usage, just reusing espeak native feature would be more > useful than coding marking stuff. > > > > > > I'm going to start working on code samples for a Collaboration chapter > > > next, and I want to do a chapter on debugging Sugar Activities after > > > that. I think Walter had developed some code to let you run Sugar > > > Activities outside of the Sugar environment and that would be a good > > > fit for the debugging chapter. For collaboration I'm going to try to > > > put together a sort of half-finished game called "Battle Royale Tic > > > Tac Toe". I'll also write about file sharing as used by Read Etexts. > > > > > > Once I have this material added I think I'll have enough to make it > > > worth putting on the front page of the site. That won't mean it's > > > finished, but enough of it will be that the book could be considered > > > complete. > > > > > > I welcome collaborators as well as editors on this. There are many > > > topics you could put in a book like this that I'm not qualified to > > > write. > > > > > > I'm up to 87 pages now. > > > > > > James Simmons > > > > > > > -- > > Aleksey > > > import gst > > > > voice = 'default' > > pitch = 0 > > > > rate = -20 > > highlight_cb = None > > > > def _create_pipe(): > > pipeline = 'espeak name=source ! autoaudiosink' > > pipe = gst.parse_launch(pipeline) > > > > def stop_cb(bus, message): > > pipe.set_state(gst.STATE_NULL) > > > > def mark_cb(bus, message): > > if message.structure.get_name() == 'espeak-mark': > > mark = message.structure['mark'] > > highlight_cb(int(mark)) > > > > bus = pipe.get_bus() > > bus.add_signal_watch() > > bus.connect('message::eos', stop_cb) > > bus.connect('message::error', stop_cb) > > bus.connect('message::element', mark_cb) > > > > return (pipe.get_by_name('source'), pipe) > > > > def _speech(source, pipe, words): > > source.props.pitch = pitch > > source.props.rate = rate > > source.props.voice = voice > > source.props.text = words; > > pipe.set_state(gst.STATE_PLAYING) > > > > info_source, info_pipe = _create_pipe() > > play_source, play_pipe = _create_pipe() > > > > # track for marks > > play_source.props.track = 2 > > > > def voices(): > > return info_source.props.voices > > > > def say(words): > > _speech(info_source, info_pipe, words) > > print words > > > > def play(words): > > _speech(play_source, play_pipe, words) > > > > def is_stopped(): > > for i in play_pipe.get_state(): > > if isinstance(i, gst.State) and i == gst.STATE_NULL: > > return True > > return False > > > > def stop(): > > play_pipe.set_state(gst.STATE_NULL) > > > > def is_paused(): > > for i in play_pipe.get_state(): > > if isinstance(i, gst.State) and i == gst.STATE_PAUSED: > > return True > > return False > > > > def pause(): > > play_pipe.set_state(gst.STATE_PAUSED) > > > > def rate_up(): > > global rate > > rate = min(99, rate + 10) > > > > def rate_down(): > > global rate > > rate = max(-99, rate - 10) > > > > def pitch_up(): > > global pitch > > pitch = min(99, pitch + 10) > > > > def pitch_down(): > > global pitch > > pitch = max(-99, pitch - 10) > > > > def prepare_highlighting(label_text): > > i = 0 > > j = 0 > > word_begin = 0 > > word_end = 0 > > current_word = 0 > > word_tuples = [] > > omitted = [' ', '\n', u'\r', '_', '[', '{', ']', '}', '|', '<',\ > > '>', '*', '+', '/', '\\' ] > > omitted_chars = set(omitted) > > while i < len(label_text): > > if label_text[i] not in omitted_chars: > > word_begin = i > > j = i > > while j < len(label_text) and label_
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
On Thu, Jan 21, 2010 at 10:41:59PM +, Aleksey Lim wrote: > On Thu, Jan 21, 2010 at 10:24:50AM -0600, Jim Simmons wrote: > > I just finished writing another chapter of the book, this one on > > adding Text to Speech to your Activities. I've also made various > > additions and corrections to the rest of it. If you want to check out > > what I have a PDF created with OBJAVI! is available here: > > > > http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf > > Thanks for your efforts! > > just minor cleanups you can consider to make code less verbose and > easily understandable(perhaps), see attached speech.py and also, could be useful to mention words tracking feature of espeak, like http://wiki.sugarlabs.org/go/Activity_Team/gst-plugins-espeak#Simple_TTS_example Yes, some espeak versions(at least old ones) could miss some words but its getting better(I didn't check last espeak version but at least espeak developers are working on track improvements) and in case of simple tts usage, just reusing espeak native feature would be more useful than coding marking stuff. > > > I'm going to start working on code samples for a Collaboration chapter > > next, and I want to do a chapter on debugging Sugar Activities after > > that. I think Walter had developed some code to let you run Sugar > > Activities outside of the Sugar environment and that would be a good > > fit for the debugging chapter. For collaboration I'm going to try to > > put together a sort of half-finished game called "Battle Royale Tic > > Tac Toe". I'll also write about file sharing as used by Read Etexts. > > > > Once I have this material added I think I'll have enough to make it > > worth putting on the front page of the site. That won't mean it's > > finished, but enough of it will be that the book could be considered > > complete. > > > > I welcome collaborators as well as editors on this. There are many > > topics you could put in a book like this that I'm not qualified to > > write. > > > > I'm up to 87 pages now. > > > > James Simmons > > > > -- > Aleksey > import gst > > voice = 'default' > pitch = 0 > > rate = -20 > highlight_cb = None > > def _create_pipe(): > pipeline = 'espeak name=source ! autoaudiosink' > pipe = gst.parse_launch(pipeline) > > def stop_cb(bus, message): > pipe.set_state(gst.STATE_NULL) > > def mark_cb(bus, message): > if message.structure.get_name() == 'espeak-mark': > mark = message.structure['mark'] > highlight_cb(int(mark)) > > bus = pipe.get_bus() > bus.add_signal_watch() > bus.connect('message::eos', stop_cb) > bus.connect('message::error', stop_cb) > bus.connect('message::element', mark_cb) > > return (pipe.get_by_name('source'), pipe) > > def _speech(source, pipe, words): > source.props.pitch = pitch > source.props.rate = rate > source.props.voice = voice > source.props.text = words; > pipe.set_state(gst.STATE_PLAYING) > > info_source, info_pipe = _create_pipe() > play_source, play_pipe = _create_pipe() > > # track for marks > play_source.props.track = 2 > > def voices(): > return info_source.props.voices > > def say(words): > _speech(info_source, info_pipe, words) > print words > > def play(words): > _speech(play_source, play_pipe, words) > > def is_stopped(): > for i in play_pipe.get_state(): > if isinstance(i, gst.State) and i == gst.STATE_NULL: > return True > return False > > def stop(): > play_pipe.set_state(gst.STATE_NULL) > > def is_paused(): > for i in play_pipe.get_state(): > if isinstance(i, gst.State) and i == gst.STATE_PAUSED: > return True > return False > > def pause(): > play_pipe.set_state(gst.STATE_PAUSED) > > def rate_up(): > global rate > rate = min(99, rate + 10) > > def rate_down(): > global rate > rate = max(-99, rate - 10) > > def pitch_up(): > global pitch > pitch = min(99, pitch + 10) > > def pitch_down(): > global pitch > pitch = max(-99, pitch - 10) > > def prepare_highlighting(label_text): > i = 0 > j = 0 > word_begin = 0 > word_end = 0 > current_word = 0 > word_tuples = [] > omitted = [' ', '\n', u'\r', '_', '[', '{', ']', '}', '|', '<',\ > '>', '*', '+', '/', '\\' ] > omitted_chars = set(omitted) > while i < len(label_text): > if label_text[i] not in omitted_chars: > word_begin = i > j = i > while j < len(label_text) and label_text[j] not in omitted_chars: > j = j + 1 > word_end = j > i = j > word_t = (word_begin, word_end, label_text[word_begin: > word_end].strip()) > if word_t[2] != u'\r': > word_tuples.append(word_t) > i = i + 1 > return word_tuples > > def add_word_marks(word_tuples): > "Adds a mar
Re: [IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
On Thu, Jan 21, 2010 at 10:24:50AM -0600, Jim Simmons wrote: > I just finished writing another chapter of the book, this one on > adding Text to Speech to your Activities. I've also made various > additions and corrections to the rest of it. If you want to check out > what I have a PDF created with OBJAVI! is available here: > > http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf Thanks for your efforts! just minor cleanups you can consider to make code less verbose and easily understandable(perhaps), see attached speech.py > I'm going to start working on code samples for a Collaboration chapter > next, and I want to do a chapter on debugging Sugar Activities after > that. I think Walter had developed some code to let you run Sugar > Activities outside of the Sugar environment and that would be a good > fit for the debugging chapter. For collaboration I'm going to try to > put together a sort of half-finished game called "Battle Royale Tic > Tac Toe". I'll also write about file sharing as used by Read Etexts. > > Once I have this material added I think I'll have enough to make it > worth putting on the front page of the site. That won't mean it's > finished, but enough of it will be that the book could be considered > complete. > > I welcome collaborators as well as editors on this. There are many > topics you could put in a book like this that I'm not qualified to > write. > > I'm up to 87 pages now. > > James Simmons > -- Aleksey import gst voice = 'default' pitch = 0 rate = -20 highlight_cb = None def _create_pipe(): pipeline = 'espeak name=source ! autoaudiosink' pipe = gst.parse_launch(pipeline) def stop_cb(bus, message): pipe.set_state(gst.STATE_NULL) def mark_cb(bus, message): if message.structure.get_name() == 'espeak-mark': mark = message.structure['mark'] highlight_cb(int(mark)) bus = pipe.get_bus() bus.add_signal_watch() bus.connect('message::eos', stop_cb) bus.connect('message::error', stop_cb) bus.connect('message::element', mark_cb) return (pipe.get_by_name('source'), pipe) def _speech(source, pipe, words): source.props.pitch = pitch source.props.rate = rate source.props.voice = voice source.props.text = words; pipe.set_state(gst.STATE_PLAYING) info_source, info_pipe = _create_pipe() play_source, play_pipe = _create_pipe() # track for marks play_source.props.track = 2 def voices(): return info_source.props.voices def say(words): _speech(info_source, info_pipe, words) print words def play(words): _speech(play_source, play_pipe, words) def is_stopped(): for i in play_pipe.get_state(): if isinstance(i, gst.State) and i == gst.STATE_NULL: return True return False def stop(): play_pipe.set_state(gst.STATE_NULL) def is_paused(): for i in play_pipe.get_state(): if isinstance(i, gst.State) and i == gst.STATE_PAUSED: return True return False def pause(): play_pipe.set_state(gst.STATE_PAUSED) def rate_up(): global rate rate = min(99, rate + 10) def rate_down(): global rate rate = max(-99, rate - 10) def pitch_up(): global pitch pitch = min(99, pitch + 10) def pitch_down(): global pitch pitch = max(-99, pitch - 10) def prepare_highlighting(label_text): i = 0 j = 0 word_begin = 0 word_end = 0 current_word = 0 word_tuples = [] omitted = [' ', '\n', u'\r', '_', '[', '{', ']', '}', '|', '<',\ '>', '*', '+', '/', '\\' ] omitted_chars = set(omitted) while i < len(label_text): if label_text[i] not in omitted_chars: word_begin = i j = i while j < len(label_text) and label_text[j] not in omitted_chars: j = j + 1 word_end = j i = j word_t = (word_begin, word_end, label_text[word_begin: word_end].strip()) if word_t[2] != u'\r': word_tuples.append(word_t) i = i + 1 return word_tuples def add_word_marks(word_tuples): "Adds a mark between each word of text." i = 0 marked_up_text = ' ' while i < len(word_tuples): word_t = word_tuples[i] marked_up_text = marked_up_text + '' + word_t[2] i = i + 1 return marked_up_text + '' ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep
[IAEP] New and revised chapters of "Make Your Own Sugar Activities!" ready for review, feedback
I just finished writing another chapter of the book, this one on adding Text to Speech to your Activities. I've also made various additions and corrections to the rest of it. If you want to check out what I have a PDF created with OBJAVI! is available here: http://objavi.flossmanuals.net/books/ActivitiesGuideSugar-en-2010.01.21-18.33.56.pdf I'm going to start working on code samples for a Collaboration chapter next, and I want to do a chapter on debugging Sugar Activities after that. I think Walter had developed some code to let you run Sugar Activities outside of the Sugar environment and that would be a good fit for the debugging chapter. For collaboration I'm going to try to put together a sort of half-finished game called "Battle Royale Tic Tac Toe". I'll also write about file sharing as used by Read Etexts. Once I have this material added I think I'll have enough to make it worth putting on the front page of the site. That won't mean it's finished, but enough of it will be that the book could be considered complete. I welcome collaborators as well as editors on this. There are many topics you could put in a book like this that I'm not qualified to write. I'm up to 87 pages now. James Simmons ___ IAEP -- It's An Education Project (not a laptop project!) IAEP@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/iaep