Writing a new book : What can you do with bytes ?

What can you do with bytes ?Writing the previous book was a very interesting experience. A few days ago, I decided to start the writing of a new book called "What can you do with bytes in ActionScript 3 ?"

The idea is to cover different topics (through 7 chapters) related to binary and discover some cool things you can do with it in ActionScript 3.

This book will be free and available as a downloadable PDF like the first version of "Pratique d'ActionScript 3". I will write it in English so that everybody can read it (this time!) :)

English reviewers will be very welcome to improve my English through the chapters ! :)

Download :

Chapter 1 - The first bits
Chapter 2 - Everyday bytes
Chapter 3 - Encoders
Chapter 4 - Parsers
Chapter 5 - Low-level networking
Chapter 6 - External devices
Chapter 7 - Emulators

Comments (120)

  1. Tek wrote:

    It’s really a good thing, the Flash community is not used to work with bytes regarding to the history of the language and its context. I hope you will have the time to make it as simple as possible. Good luck.

    Sunday, April 26, 2009 at 12:23 am #
  2. Tek wrote:

    I not have read it will be published free, your our hero Thibault, I’m so proud of you!

    Sunday, April 26, 2009 at 12:32 am #
  3. Thibault Imbert wrote:

    lol, thank you Tek!

    Sunday, April 26, 2009 at 12:33 am #
  4. yuku wrote:

    Looking forward to reading this book since the last book is in a language I don’t understand!
    (I’m from Indonesia)

    Thanks so much ^^

    Sunday, April 26, 2009 at 12:36 am #
  5. Palleas wrote:

    Can’t wait to read it !

    Sunday, April 26, 2009 at 1:18 am #
  6. Cay wrote:

    Awesome! looking forward to it :D

    Sunday, April 26, 2009 at 2:37 am #
  7. Jloa wrote:

    Yahooooo (no an ad :)
    Thibault, thx a lot! So glad 2 c that u’ve decided to make an eng translation thx ^_^

    Sunday, April 26, 2009 at 2:52 am #
  8. Xeonarno wrote:

    I love you

    Sunday, April 26, 2009 at 8:38 am #
  9. Pedram wrote:

    it’s good work.
    I’m waiting for publish day ;)

    Sunday, April 26, 2009 at 8:49 am #
  10. maru wrote:

    I don’t see any chapter covering the art of cooking macarons, I’m really disappointed ;)
    btw I think you’re crazy, but I’m impatient to read it, since I can’t speak with 0 and 1 for the moment !

    Sunday, April 26, 2009 at 10:06 am #
  11. Looks like a really good idea – i’ll be buying for sure, presumably jpeg, png encoders will be in the encoder section. How about squeezing a full chapter on AlivePDF in there next to encoders.

    Sunday, April 26, 2009 at 2:51 pm #
  12. Thibault Imbert wrote:

    Hi David,

    AlivePDF will be covered in the encoders chapter for sure, but I don’t think it will take a whole chapter, well, we’ll see :)



    Sunday, April 26, 2009 at 2:54 pm #
  13. np labs wrote:

    can’t wait to read it and find what treasures it holds ;)

    Sunday, April 26, 2009 at 5:08 pm #
  14. Alan wrote:

    Really looking forward to this new book. Thank you for dedicating so much of your time to share your knowledge and help others.

    Sunday, April 26, 2009 at 7:42 pm #
  15. glimglam wrote:

    Sounds interesting!

    English is not my native language, but I do work as a technical writer and, if needed, I would be happy to help out with the reviewing part.

    Sunday, April 26, 2009 at 8:59 pm #
  16. Rezmason wrote:

    This looks really good.

    You know what’d make a good Flash workshop? One on technical writing. I’d love to write me a book. B)

    Sunday, April 26, 2009 at 11:41 pm #
  17. rsturk wrote:

    I can’t wait to read it. Thanks for writing it in English.

    Monday, April 27, 2009 at 12:21 am #
  18. Kispik wrote:

    Bonsoir, j’aimerais savoir si tu peux m’aider.
    J’ai récupéré les sources du SDK 3.3.0, j’ai un soucis lorsque je rajoute un mxml dans le package mx.controls, je l’ai vois pas dans mon projet. Pourrais tu m’aider S’il te plait ?

    Monday, April 27, 2009 at 12:50 am #
  19. I am super excited about this! Always really wanted to learn about how bytes work in AS3, and all the topics you have are so very interesting! Thanks so much for doing this :-D And for making it free and well in English :-P

    Monday, April 27, 2009 at 1:16 am #
  20. Tek wrote:

    Oh yes, this time I want to review the book myself too!

    Monday, April 27, 2009 at 1:19 am #
  21. walktree wrote:

    ByteArray is really powerful,thank you for your great work!

    Monday, April 27, 2009 at 5:03 am #
  22. Nishant wrote:

    Hey. Eager to see the book and will be glad to review :-)

    Monday, April 27, 2009 at 6:45 am #
  23. mad wrote:

    Bonsoir,il sera cool de voire mp3 et flv parmi les sujet traites , specialement dans les chapitres Encoders , parsers.
    Anyway ..merçi pour tt ;)

    Monday, April 27, 2009 at 7:39 am #
  24. Goach wrote:

    tu iras au paradis mec !

    Monday, April 27, 2009 at 12:17 pm #
  25. warsiz wrote:

    big up mate !!! :o)
    thx for all

    Monday, April 27, 2009 at 1:39 pm #
  26. Romain wrote:

    You’re the one !

    Thanks you so much for all your really great work ;)

    Is there a Thibault Fan’s Club somewhere ? ^_^

    Monday, April 27, 2009 at 9:26 pm #
  27. Thibault, send me an email about reviewing when you get to that point… I’ve technical edited two recent Flash-related O’Reilly titles.

    Tuesday, April 28, 2009 at 4:04 am #
  28. nwebb wrote:

    Love the idea. Please feel free to get in touch when you get to the reviewing stage :)

    Tuesday, April 28, 2009 at 4:15 pm #
  29. Sounds great! Can’t wait to read it.

    Tuesday, April 28, 2009 at 7:52 pm #
  30. darien wrote:

    i’m damn over excited for this book!

    Wednesday, April 29, 2009 at 12:47 pm #
  31. You must be heaven sent. That would be most welcomed. Thanks for the effort.

    I was considering learning that aspect of AS3, covering topics such as AMF, Sockets, Bits and Bytes, Pixel/Color manipulation, Compression etc.

    You were clearly able to identify the need for such a resource,.

    Wednesday, April 29, 2009 at 5:27 pm #
  32. Philip wrote:

    Good idea!

    You could write something about sound synthesis too (:

    Can’t wait

    Wednesday, April 29, 2009 at 7:59 pm #
  33. Fabien wrote:

    Il se s’arrêtera donc jamais ! La plume le code, l’open source et Thibaut une symbiose parfaite

    Thursday, April 30, 2009 at 3:08 pm #
  34. Boris wrote:

    You are one of the best things that happened to ActionScript community in years… especially for average programmers like me. Thank you!

    Thursday, April 30, 2009 at 3:15 pm #
  35. Milos wrote:


    I run on problem when you flush() some data from socket and then if you want to stop sending that data, it seams that it’s imposible. close() method will only disconnect client but data continue to go over wire even if you close application (I tested it with wireshark). I googled and found that many developers have the same issue, but there is no answer how to solve it. Also there is no explination of this in Adobe’s docs. So many of us would appriciete very much if you can include explination of this issue in your book. Thank you.

    Thursday, April 30, 2009 at 8:22 pm #
  36. Very nice Thibault! I don’t mind the French thought because there are not that many French Actionscript materials out there. I live in Montreal where it is pretty much bilingual, and so it is very helpful to have some French Actionscript and Flash terminology so that I can explain it to our francophone developers and designers. :D

    Saturday, May 2, 2009 at 2:00 am #
  37. Thibault Imbert wrote:

    Hi David,

    That’s very cool to hear !


    Saturday, May 2, 2009 at 2:03 am #
  38. Tkitek wrote:

    Someone has said : FOREVER is made of lot of NOWs… I say : you are making our FOREVER stuff your NOWs… thank you Rivers (ton petit rongeur des prairies ! )

    Tuesday, May 26, 2009 at 4:13 pm #
  39. Tony wrote:

    Salut Thibault,

    Quelque chose que j’aimerais trouver dans les api Camera et Microphone : la possibilité d’avoir accès aux données binaires de la capture. Ceci afin d’implémenter des protocoles comme SIP (Session Initiation Protocol, utilisé dans le domaine de la téléphonie sur ip) directement en as3 avec Socket.

    Actuellement, certaines sociétés comme Ribbit ou TringMe permettent d’avoir des softphones web flash mais ils utilisent un serveur FMS pour accéder aux packets entre le client et le serveur final de toIP (Asterisk, par exemple). On a donc ici un intermédiaire superflu (fms) qui de plus est couteux en bande passante car le protocole de transfert pour fms est TCP comme tu sais…

    Des infos par rapport à çà ?


    Saturday, June 6, 2009 at 3:58 pm #
  40. Clemente G wrote:

    This would be great. There are NO good resources on byteArrays at all and that sucks. I can’t wait for this release. Any ETA on release date yet??

    Sunday, June 7, 2009 at 11:50 am #
  41. Doug wrote:

    Keep me posted T! I would love to help with any reviews.

    Nice work

    Wednesday, June 10, 2009 at 11:54 am #
  42. Indelebil wrote:

    Mon anglais est trop pauvre!!!

    Ca faisait longtemps que je cherchais des infos plus spécifiques sur la manip des bytes avec Flash. Ton premier bouquin nous a déjà bien aidé, mais un livre spécifique, ce serait vraiment terrible.
    Impatient que çà sorte…

    J’aimerai t’envoyer un lien sur une appli AIR (en cours de développement) pour faire du montage vidéo.
    Tiens moi au courant…

    Tuesday, June 16, 2009 at 7:48 pm #
  43. Thomas wrote:

    Thibault, would you mind to give a rough estimate when one or several chapters will be made available? I, like many others, will be very happy to read more about this topic.

    Merci beaucoup!

    Thursday, October 1, 2009 at 2:07 pm #
  44. jimb wrote:

    Please, add me to your list of English reviewers!

    Friday, October 9, 2009 at 8:43 pm #
  45. 7heaven wrote:

    looking forward to it!

    Thursday, November 12, 2009 at 5:34 am #
  46. kevin wrote:

    Howdy, Thibault, will the new job impede production of this book? (By the way, congrats on the new job working on the flash player :)

    If you would like another English reviewer, I would love to help out. Like others, I find there is very little information on Byte-Arrays so a book like this would be perfect.

    Congrats and good luck!

    Thursday, February 25, 2010 at 10:38 pm #
  47. Thibault Imbert wrote:

    Hi Kevin,

    Thanks! :)

    Funny you post this right now, I am currently back on it. I was busy working on the optimizing guide and now I have some more time to work on it.

    I will post an update about its current status very soon.



    Thursday, February 25, 2010 at 11:26 pm #
  48. sami wrote:

    Hi I need this book NOW :D
    Just wanted to learn about Bytes in AS3.
    - Why is it in French ……..

    Wednesday, March 24, 2010 at 12:43 pm #
  49. esedeerre wrote:

    Thank you very much!!!!

    Friday, April 9, 2010 at 3:44 pm #
  50. warsiz wrote:

    you’re the one dude !!!

    Friday, April 9, 2010 at 4:15 pm #
  51. Good thing !

    What is the purpose of the Chapter 5 – Low-level networking ?
    You want to talk about the new features of AIR2 About Server Socket ?
    Or it’s an other new – undisclosed – features of Adobe concerning the access of the layer 3 or 2 of the OSI Model ? Like Packets or Frames ?


    Friday, April 9, 2010 at 4:23 pm #
  52. l'ohm collectif wrote:

    great! bravi

    Friday, April 9, 2010 at 5:42 pm #
  53. Leandro Zanol wrote:

    Hi man, I want to congratulate you for sharing all of your knowledge and experience!
    God bless you.

    Friday, April 9, 2010 at 6:31 pm #
  54. jim wrote:

    I am new to use byteArray.
    Thank you for your wonderful book

    Saturday, April 10, 2010 at 7:07 am #
  55. A. Traikov wrote:

    It’s a great book. Looking forward to see the next chapters.

    Saturday, April 10, 2010 at 11:50 am #
  56. senthil kumaran wrote:

    There are only a few intellectual as well as good hearted human beings like Thibault Imbert. Cheers……. man.

    Saturday, April 10, 2010 at 2:49 pm #
  57. MatD wrote:

    Bravo Thibault! Good book idea, and chapter 1 is clear and precise. I’m really interested in reading the chapter 7 about emulators. This will surely give us new ideas and perspective using Actionscript.

    Merci de partager tout ce savoir avec la communauté ;-)

    Sunday, April 11, 2010 at 1:28 pm #
  58. iGman wrote:

    Thibault Imbert, You Rock!

    Monday, April 12, 2010 at 11:45 pm #
  59. Thibault Imbert wrote:

    Hi guys,

    I am happy to hear that you like it, Chapter 2 is on its way!



    Tuesday, April 13, 2010 at 6:49 pm #
  60. Stef wrote:

    hey , toujours de l’aussi bon boulot , continue et merci …. heureux que tu ai su me transmettre ton savoir et ta passion pour flash en formation …

    Thursday, April 15, 2010 at 11:32 am #
  61. Santosh wrote:

    You truly rock

    Wednesday, April 21, 2010 at 7:01 am #
  62. Michael Michailidis wrote:

    Hey man, thank you so much for this wonderful resource. It is exactly what we need to take Flash on a new level.

    Since you are also after feedback, I was reading the first chapter and noticed that the (~) operator was written as a one’s compliment operator while it looks like it’s a two’s compliment since it increments the value by one.

    PS. Not to rush, when do you think you will have the rest of the chapters written. I am involved in a project that would absolutely benefit from your knowledge.

    Thursday, April 22, 2010 at 12:36 pm #
  63. Just started reading this, but something caught my eye early on. You often refer to the “less significant bit” when it ought to be the “least significant bit” ,http://en.wikipedia.org/wiki/Least_significant_bit .

    Thanks for all of your efforts. I look forward to working my way through the book as it unfolds.

    Tuesday, April 27, 2010 at 6:58 pm #
  64. Thibault Imbert wrote:

    Hi Jason,

    I am happy you like the book, thanks !

    You are right, it is a typo that I will fix right away ;)

    Thanks again,


    Tuesday, April 27, 2010 at 7:08 pm #
  65. Michael Michailidis wrote:

    I would also suggest that you write a few things more on page 18 when you do:

    function readBit ():uint
    return uint((buffer & ( 1 << incRead++ )) != 0 );

    The hard thing to understand is that the != returns boolean and you are type casting it to uint which happens to return a 0 for '00000000' and 1 for anything else. It took me a little more time to understand that…

    Wednesday, April 28, 2010 at 11:47 am #
  66. joshspoon wrote:

    Thx for sharing your knowledge and you have a lot of it so I think it will be a good book.

    Thursday, April 29, 2010 at 8:16 pm #
  67. spadeA wrote:

    thank you !I have read some contents and i am looking forward to all the content

    Thursday, May 27, 2010 at 9:13 am #
  68. Per wrote:

    Hi I have been reading the first chapter and I have never used the bytearray. Great job because you have really explain it in a way that I have learned something. Can’t wait until the next chapter. =)

    //Per Borin

    Monday, May 31, 2010 at 10:46 pm #
  69. chnzbq wrote:

    Thx very much…I am looking forward to your next chapter…But it seems that something goes wrong in your first chapter on Page 25…
    the binary of 0xFFAA9911 goes wrong in the middle of this page…same with the binary of 0x00BB0000…
    i mean in the byte level your number is different from what you give above…

    Friday, June 4, 2010 at 3:53 pm #
  70. Jay Wolfe wrote:

    Unfortunately I don’t think this book will ever be written. It’s been over a year with no response to comments, no additional chapters, and no information on the status.

    Too bad as I think this could be an extremely useful book and show the html5 community that html5 can’t come close to doing what Flash can do.

    Thursday, July 1, 2010 at 1:31 am #
  71. Thibault Imbert wrote:

    Hi Jay,

    The first chapter has been posted a few months ago, check the index, direct link here :


    I am finalizing chapter 2 which is going to be posted soon. Hope you will like it!



    Thursday, July 1, 2010 at 9:28 am #
  72. I have read Chapter 1 and it’s great. Brilliant stuff, thanks.

    Thursday, July 8, 2010 at 1:18 pm #
  73. DATE BOOK PUBLISH?? wrote:


    Sunday, July 11, 2010 at 5:18 pm #
  74. franco wrote:


    Sunday, July 11, 2010 at 5:19 pm #
  75. Alp Tuğan wrote:

    Thank you so much for the book.I’m looking forward to other chapters.

    Tuesday, July 13, 2010 at 11:58 am #
  76. Diego wrote:

    you are my hero.. thx for share this great firts chapter..waiting anxiety the next ones.

    Thursday, August 12, 2010 at 5:45 pm #
  77. volgogradetzzz wrote:

    Hello. The book is amazing. Thanks a lot from snow Russia.
    But I’ll support chnzbq in post 69 – there’re a mistake on page 25 – you can’t change only one component (byte) from the 32-bit color such a way (with | operator).

    Tuesday, September 21, 2010 at 12:56 pm #
  78. Parag Shah wrote:

    I know it’s not correct to push you as you are already helping us a lot by providing such super stuff absolutely at no cost.. but looking at what is in store, can’t stop requesting you to put the next chapter as soon as you can..

    I am sure you are onto it.. Just that our patience plays ugly at times….

    Hope to see it underlined soon…

    Wednesday, September 22, 2010 at 9:02 am #
  79. Anthony wrote:

    Free Book??? why not try to get paid for it, and get it done faster, so we can buy it?

    I can work with Byte data, but, I still have trouble breaking down file specs, and I am not used to looking for the key things in the spec, that can get you going when making an encoder/decoder for a file format.

    If you want to give it away for free, you should publish it online as html, and put adverts at the top of each page to generate income to support your work.

    Monday, September 27, 2010 at 5:05 pm #
  80. ddk2 wrote:

    hope to see the next chapter

    Wednesday, November 24, 2010 at 10:53 am #
  81. Avik wrote:

    “What can you do with bytes in ActionScript 3″ ,I want to buy this book .Would you please tell me what is the procedure I have to follow.

    Monday, November 29, 2010 at 1:22 pm #
  82. Juan J wrote:

    Amazing! Such as this site :)
    I’ve been in love with AS3 for some time now but there are several things idk, and apparently a big group of them will be covered by this book, so I cannot wait for the next chapters! :D
    Keep rocking!

    Wednesday, December 1, 2010 at 11:57 pm #
  83. Rohit Sharma wrote:

    I went througth ByteArray class… but stuck… i hope this book clear all the aspects to use with it…

    Saturday, December 11, 2010 at 1:33 pm #
  84. jab wrote:

    Thanks for all of your hard work. This has helped me a ton. Looking forward to future chapters.

    Monday, January 3, 2011 at 4:21 pm #
  85. Richard wrote:

    I hope you haven’t given up on this? Looking forward to the real meat and potatoes usage of the ByteArray Class.

    Sunday, January 9, 2011 at 8:28 pm #
  86. liaoyanxuan@qq.com wrote:

    i can from china,you let us wait so long,please let the rest go.

    Friday, January 14, 2011 at 3:23 am #
  87. Arnaud wrote:

    Je pense qu’il serait judicieux d’ajouter un chapitre sur les particules et un autre sur la gestion de textures notamment pour la lumières en 3D.

    Merci d’avance.

    Wednesday, January 26, 2011 at 4:51 pm #
  88. Jason wrote:

    Hi Thibault

    Just read your first chapter. You are a REALLY good teacher. Coming from the world of music and animation and into Flash through kids entertainment with Boowa and Kwala, I have been dipping my toes into the waters of ByteArrays and muddling through by trial and error.

    Having read your first chapter, I already feel less uncomfortable. PLEASE write the rest so I can feel at ease :)

    I’ll be happy to send you any corrections I see as I read through. It would be a small service indeed compared to what you give.



    Correction 1)
    The man is counting with a base 10 and
    this is what we call the decimal base.
    Should perhaps read
    Man counts with a base of 10 -
    this is what we call the decimal base.

    Let me know if you want more !?

    Thursday, February 3, 2011 at 6:52 pm #
  89. Mahesh wrote:

    I am not able to download the book(WCYDWB)except the first chapter. Please help.

    Wednesday, February 16, 2011 at 9:07 am #
  90. Stephen wrote:

    Awesome first chapter… any update on the second chapter?

    Again, great work.

    Thursday, February 17, 2011 at 7:26 pm #
  91. Rob Fox wrote:

    On the bottom of page 25 you illustrate how “Thanks to this mask we are then able to use it with the AND operator to reset the red offset”. Then you filter out the alpha not the red color.
    Awesome book btw. Makes me a lot better programmer in AS as well as Java.

    Friday, February 18, 2011 at 10:48 am #
  92. Can’t wait to see the rest :)

    Thursday, March 3, 2011 at 12:23 pm #
  93. Anthony wrote:

    Have you made any additional progress?

    It looks as though it has been quite some time since you released the first chapter.

    Thursday, March 3, 2011 at 9:49 pm #
  94. Alexander Schimek wrote:

    thank you very much for this update!!!

    Tuesday, March 15, 2011 at 2:30 am #
  95. tiTano wrote:

    Hi Thib,
    I started reading the first chapter this morning. Found it very very intersting!

    But there is something strange:

    At page 16 you tested performance for bitwise operator:
    “In terms of performance, it may be advantageous to use this technique to divide or multiply a
    value. In the following code we use the traditional division operator…”

    I tested on Incubator an current 10.2 debug player and surprisingly it results the traditional way is slightly faster than using bitwise shift…

    Wednesday, March 16, 2011 at 11:11 am #
  96. Ezell wrote:

    This is awesome, I want to learn the nuts and bolts of these things looking for references can get very difficult at times.

    Thursday, March 17, 2011 at 6:39 pm #
  97. mihnea wrote:

    Hey Thibault,

    You could make a kindle version. I’ll be willing to pay for it and I don’t think I’m the only one :)

    Friday, March 18, 2011 at 1:00 pm #
  98. Stephen wrote:

    On page 2 of Chapter 2, you set parameter.nom to “Stevie” – not parameters.name.

    Sunday, March 20, 2011 at 3:56 pm #
  99. Thibault Imbert wrote:

    Hi Stephen,

    Thanks! Updated.


    Sunday, March 20, 2011 at 10:00 pm #
  100. tom wrote:

    this is really cool book

    Monday, March 21, 2011 at 11:27 am #
  101. John wrote:

    Very well written, and so good of you to make it free.

    If it helps, I like to think of bits and bytes this way:

    Place 8 ‘bits’ of wire next to each other on a printed circuit board and use them to transfer data between memory and cpu. That’s a computer with an 8 bit ‘bus’. Like bus transfer! A byte is a collection of 8. Now we have 64 bit PCs that can bus 8 bytes at a time.


    Thursday, March 24, 2011 at 2:11 pm #
  102. northWolf wrote:

    Hi,Mr Imbert,I’m very glad to see your blog at the moment,I’m a Chinese and I fall in love with AS3 at 2009, when I hope it isn’t too late.

    Sunday, April 10, 2011 at 5:25 pm #
  103. Thanks for taking the time for you to talk about this, I really feel strongly about it and adore learning much more on this subject. If feasible, as you acquire experience, would you thoughts updating your weblog with a lot more data? It’s extremely useful for me.

    Saturday, April 23, 2011 at 4:29 pm #
  104. zes wrote:

    Hi, Thibault.

    Tout d’abord merci pour tout ton travail et le partage de celui-ci ! Tes anciens livres m’ont permis de rentrer facilement dans le monde de AS3.

    Une chance que ce bouquin là soit un jour en français ???

    Monday, May 2, 2011 at 11:40 am #
  105. Thibault Imbert wrote:

    Salut Zes,

    Merci! Malheureusement ce livre n’a pas de version Francaise prevue.


    Monday, May 2, 2011 at 6:20 pm #
  106. Parag Shah wrote:

    Bingo!!! I m sure it would be a worth wait and would be as super as Chapter 1…

    Saturday, May 14, 2011 at 9:33 am #
  107. Ezell Burke wrote:

    Thank you man,
    You are my Hero. I am trying to understand How low level api’s are written like amf and socket api’s. This is wonderful help on my quest of understanding.

    Thursday, May 19, 2011 at 7:42 pm #
  108. Henke37 wrote:

    You should have used the extended wave format that allows you to save floating point values instead of integers. In theory you should get less conversion artifacts and such. But the input signal isn’t exactly clear enough for it to matter here.

    Thursday, May 26, 2011 at 9:22 pm #
  109. Will Streeter wrote:

    This is rather long… but the short of it is that I am trying to change the position at which a byteArray begins to play back its contents. Specifically contents that has been loaded through a mic recording in an AIR app

    I am developing an AIR application that enables a user to recording audio through a microphone, and then edit their recording. Simply recording the audio data into a byteArray and playing it back to the user unedited is not a problem. A very strange problem begin, however, once I change the start position of the byteArray. I must implement a scrubber that will enable the user to stop the sound in mid play back and start again from a different point. Thus, I have a byteArray containing some 4 million bytes (4000000) , I begin the play back of the byteArray at 0 position and when I play it back from a starting position of 0 it plays back each time perfectly. However, when I change the starting position to start at 2 million (2000000) for instance, the play back of the byteArray from the position of 2 million to the end, works the first time. When I close the application and recompile and try it again, and create another audio recording, the playback starting from the 0 position of the byteArray works perfectly, but the moment I change the starting position again to say 2 million out of million, all I get is hissing static when I play it back. Recompiling and repeating the process a third time, the play back from the 0 position is perfect, however, once again when I change the starting position of the byteArray, I get no sound at all.

    I started by just modifying the various examples that were used for showing how to playback recorded data from a byteArray that was demonstrated in the following project.


    currentBufferingData.readBytes(recordedData, 0, currentBufferingData.length);

    changing the offset to a dynamic variable (currentVocalPosition) and subtracting the
    the currentVocalPosition from the total length of the byteArray for the length or amount of data to read.

    currentBufferingData.readBytes(recordedData, currentVocalPosition, (currentBufferingData.length-currentVocalPosition))

    as this did not work I tried using writeBytes and leaving of the length;


    All these different attempts yielded the same result:
    1st recompile: works
    2n recompile: static
    3rd reompile : silence nothing.

    Thinking that the byteArray was getting corrupted so how, I decided to create a clone of the byteArray each time I play it back. Thus, I create an array and assign the first index of the array with an empty byteArray to store an edited version of the original cloned copy of the original byteArray recording,
    this._dynamicArray[0] = new ByteArray();

    I then create a second cloned copy of the original byteArray recording and assign it to the second index of the dynamic array.

    this._dynamicArray[1] = this.micAssetMngr.getMicDataClone();

    I used this copy of the original byteArray to copy the parts of the byteArray that I want to playback. Thus, when a user has changed the current position of the byteArray, I take from this position to end of the byteArray as the portion of the sound I want to playback..

    Of course the results of this do not yield any better results. The same thing happens, it works the first time, and then after I recompile and try again all I get is hissing static when I change the starting position, and then of course on the third recompile and playback of new starting position I get nothing but silence.

    private function playRecordedData():void{
    this.playingVocalStarted = false;
    if(this.beat && this.hasEventListener(CuePointEvent.CUE_POINT)){
    this.beat.removeEventListener(CuePointEvent.CUE_POINT, onCuePoint);

    this._dynamicArray[0].position = 0;
    delete this._dynamicArray[0];

    this._dynamicArray[0] = new ByteArray();
    this._dynamicArray[1] = this.micAssetMngr.getMicDataClone();
    this._dynamicArray[0].length = 0;
    this._dynamicArray[0].writeBytes(this._dynamicArray[1], this.currentVocalPosition);
    this._dynamicArray[0].position = 0;

    this._dynamicArray[1].position = 0;
    delete this._dynamicArray[1];

    /*2nd try
    this._dynamicArray[0] = new ByteArray();
    this._dynamicArray[1] = this.micAssetMngr.getMicDataClone();
    this._dynamicArray[0].length = 0;
    this._dynamicArray[0].position = this.currentVocalPosition;

    this._dynamicArray[1].position = 0;
    delete this._dynamicArray[1];

    /*3rd try
    this._dynamicArray[0] = new ByteArray();
    this._dynamicArray[1] = this.micAssetMngr.getMicDataClone();
    var length:uint = this._dynamicArray[1].length – this.currentVocalPosition;
    this._dynamicArray[1].position = this.currentVocalPosition;
    this._dynamicArray[1].readBytes(this._dynamicArray[0], 0, length);
    this._dynamicArray[0].position = 0;

    this._dynamicArray[1].position = 0;
    delete this._dynamicArray[1];

    /*4th try
    var temp:ByteArray = this.micAssetMngr.getMicDataClone();

    while (temp.bytesAvailable > this.currentVocalPosition){
    if(this.vocal && this.vocal.hasEventListener(Event.SOUND_COMPLETE)){
    this.vocal.removeEventListener(Event.SOUND_COMPLETE, onVocalPlaybackComplete);
    if(this.vocal && this.vocal.hasEventListener(SampleDataEvent.SAMPLE_DATA)){
    this.vocal.removeEventListener(SampleDataEvent.SAMPLE_DATA, playSoundHandler);

    this.vocal = new SoundAssetManager();
    this.vocal.addEventListener(SampleDataEvent.SAMPLE_DATA, playSoundHandler);
    this.vocal.name = SoundAssetManager.PLAYING_VOCAL;
    this.vocal.addEventListener(Event.SOUND_COMPLETE, onVocalPlaybackComplete);

    Wednesday, June 15, 2011 at 8:44 pm #
  110. game dreamer wrote:

    the book is great and i wonder when will the rest of book come out?

    Wednesday, August 10, 2011 at 4:53 am #
  111. VSheyanov wrote:

    THanks for the book!
    When the other part will come out?

    Monday, September 12, 2011 at 4:43 pm #
  112. Ihsan wrote:

    A very brave attempt with very good intentions! If you would not offend, I want to point out that 1 kilo bytes are not 10^3 = 1000 bytes but rather a number very close to it which is 2^10 = 1024 bytes. Because of this closeness amounts of bytes are considered to be named like kilo, mega giga etc. each time expanding with the factor of 2^10. 1KB = 1024 bytes, 1MB = 1024 x 1024 bytes. Thanks for your efforts and patience.

    Sunday, December 11, 2011 at 10:02 pm #
  113. Konstantin wrote:

    I don’t get it, why is there a frog on the book cover?
    I always meant to ask you that.

    Sunday, January 8, 2012 at 1:50 pm #
  114. next chapter wrote:

    When are the next chapters coming out?

    Tuesday, March 27, 2012 at 11:14 pm #
  115. next chapter wrote:

    next chapter?

    Wednesday, March 28, 2012 at 2:07 pm #
  116. Thibault Imbert wrote:

    Hi guys,

    I have been very busy lately and could not work on the book. I hope I will be able to get back on it soon.


    Saturday, May 12, 2012 at 12:40 pm #
  117. Poco wrote:

    Any news about the next chapter?

    Sunday, August 19, 2012 at 10:33 am #
  118. Polaco wrote:

    I just have found this book by browsing at the site randomly. This chapters are soo enlighteners and enjoyable, thanks a lot Thibault.

    Monday, September 17, 2012 at 7:10 am #
  119. sateesh wrote:

    Any update on the next chapters? Can’t wait to see the rest

    Thursday, January 17, 2013 at 8:54 am #
  120. Sateesh wrote:

    I love the flash ecosystem and actionscript very much, needless to say its exiciting. I would like to learn the low-level corner of actionscript. Could you please update the other chapters of “What can you do with bytes” in your mean time, if possible. Again, Thank you very much Thibault.

    Friday, May 3, 2013 at 2:12 pm #

Trackbacks/Pingbacks (25)

  1. ByteArray | ifmi on Friday, April 9, 2010 at 3:33 pm

    [...] Tad kam įdomu: griebiam. [...]

  2. [...] (由于作者目前只写了第一章,余下章节将会陆续放出,我的朋友们,你可以点击这里关注Thibault [...]

  3. [...] 地址:http://www.bytearray.org/?p=711 [...]

  4. MicRecorder, a tiny microphone library - ByteArray.org on Wednesday, August 11, 2010 at 6:28 pm

    [...] working on the second chapter of "What can you do with bytes ?", I came up with a tiny helper class for developers who need to record audio easily from the [...]

  5. [...] 当我在写第二章 “字节可以做什么的时候?”,我想出了一个微型的帮助类,可以帮助开发者在他们的程序中轻松地从麦克风中录制音频。 [...]

  6. [...] Le premier chapitre est téléchargeable gratuitement ici. [...]

  7. Первые биты on Saturday, November 27, 2010 at 8:18 am

    [...] Представляю вашему вниманию перевод главы «Chapter 1 – The first bits» из несуществующей пока книги «What can you do with bytes ?» [...]

  8. What can you do with bytes ? – Updated! - ByteArray.org on Monday, March 14, 2011 at 10:07 am

    [...] hard to find time for writing lately, but this week end I found the time to finish the chapter 2 of What can you do with bytes ? I know I am late, but I hope you guys will like this second chapter. At the Flash Gaming Summit I [...]

  9. [as3]What can you do with bytes ? | CODE@蝴蝶。夢 on Monday, March 14, 2011 at 11:31 am

    [...] http://www.bytearray.org/?p=711 This entry was posted on Monday, March 14th, 2011 at 5:25 pmand is filed under AS3. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. [...]

  10. [...] hard to find time for writing lately, but this week end I found the time to finish the chapter 2 of What can you do with bytes ? I know I am late, but I hope you guys will like this second chapter. At the Flash Gaming Summit I [...]

  11. Байты каждый день on Thursday, March 17, 2011 at 9:46 am

    [...] Представляю вашему вниманию перевод главы «Chapter 2 – Everyday bytes» (PDF) из книги «What can you do with bytes ?» [...]

  12. Export player version abfragen? - Flashforum on Tuesday, March 22, 2011 at 4:23 pm

    [...] [...]

  13. Actionscript & 3D « dkor on Wednesday, March 30, 2011 at 3:51 pm

    [...] here the fact that Thibault Imbert has written the 2nd chapter of his new book titled ‘ What can you do with bytes ? ‘ concerning the possibilities that the ByteArray class offers. In the first chapter Thibault [...]

  14. [...] was kind enough to let us download the first chapter called “The first bits. The complete book will be available on his website. And by the way, don’t hesitate to check [...]

  15. [...] was kind enough to let us download the first chapter called “The first bits. The complete book will be available on his website. And by the way, don’t hesitate to check [...]

  16. Anonymous on Monday, July 11, 2011 at 7:49 pm

    [...] [...]

  17. Text Dokument Analyse - Flashforum on Monday, October 10, 2011 at 2:42 pm

    [...] [...]

  18. Whats your Top Ten Everything on Wednesday, October 12, 2011 at 8:13 am

    Get your top ten today…

    [...]Writing a new book : What can you do with bytes ? – ByteArray.org[...]…

  19. What Can You Do With Byte ? | Derwin Studio on Monday, November 28, 2011 at 3:02 am

    [...] donc de l’arrivée du second (ok, c’était en mars) pour vous parler du livre WCYDOWB? de Thibault Imbert, l’auteur de Pratique d’ActionScript [...]

  20. is fibromyalgia real on Friday, December 2, 2011 at 1:02 pm

    is fibromyalgia real…

    [...]Writing a new book : What can you do with bytes ? – ByteArray.org[...]…

  21. download Opera mini on Friday, December 23, 2011 at 5:24 am

    download Opera mini…

    [...]Writing a new book : What can you do with bytes ? – ByteArray.org[...]…

  22. Wikipedia References on Tuesday, January 24, 2012 at 11:57 pm

    Wikipedia References…

    [...]Writing a new book : What can you do with bytes ? – ByteArray.org[...]…

  23. vkpm club on Thursday, November 15, 2012 at 8:27 am

    vkpm club…

    [...]Writing a new book : What can you do with bytes ? – ByteArray.org[...]…

  24. get great graphics here on Friday, November 16, 2012 at 8:27 am

    get great graphics here…

    [...]Writing a new book : What can you do with bytes ? – ByteArray.org[...]…

  25. […] […]