Flash Vorbis player

Yes, it’s been quite some time since I last posted. And yes, it’s been even longer since I promised something here, and still haven’t delivered. And no, there will be no excuses.

Instead, how about I share one thing with you…

The name is: FVorbis. Which stands for more or less “Ogg and Vorbis in Flash”. That’s right, pure ActionScript 3 implementation of the Ogg and Vorbis libraries that require no kind of native support from the Flash Player. A simple Vorbis player implemented using the new FVorbis lib compiles to about 46KB SWF file. And that’s it.

The source is actually written in haXe, not ActionScript, but the haXe compiler is able to produce proper AVM2 bytecode and put it into an SWF file that can be used with Flash Player all the same. Plus, using haXe has its numerous advantages.

The implementation relies on some new features that appeared in Flash Player version 10 (of which beta/RCs are available already for the most common platforms). That includes the new flash.Vector type and ability to generate sound programmatically.

For a very rough performance estimation: a ~50 seconds Vorbis file decodes completely in about 3-4 seconds at full speed of a single CPU core on my machine. In a player designed to decode at minimum speed allowing it to keep audio device playing continuous stream the CPU usage is at 5-15% of a single core. The machine is Core 2 Duo 2.6 GHz.

So, if you don’t have Flash 10 installed yet - go grab the latest version, and head to the first FVorbis demo at:

http://people.xiph.org/~arek/pg/hx/test.html

The source code’s public bazaar branch is currently at:

http://people.xiph.org/~arek/bzr/fogg.dev

The haXe/Flash implementation of the Ogg and Vorbis libraries has been initially auto-translated from the Cortado’s JOrbis code, followed by several-thousand-lines patch transformation and manual type and system library call changes and adjustments. Followed by further fixing of imperfections of the automated translation and tedious hunting of a bug in haXe compiler. The patches for haXe compiler - adding support of the flash.Vector, SampleDataEvent, and forced tagging of generated swf files with version 10 - are included in the fogg.dev branch. In case you would like to play with the libraries yourself…

At this point great many thanks need to go to the whole Xiph.Org team for Vorbis and more, to the Fluendo group for Cortado and a hacking environment, to the author of the JOrbis for java implementation and to Tor-Einar Jarnbjo for inspiration.

28 comments on “Flash Vorbis player”

  1. Silvia Pfeiffer wrote:

    Totally rocking awesome! Can’t wait to see Theora in it, too. ;-)


  2. thomas.apestaart.org » Vorbis in Flash:

    […] I was wondering why Arek was arriving later than usual to work, to the point of being late at his own developer meeting where just a week before he instituted a rule that the last person in the meeting is to buy the rest of the team beer on Friday. This week he told me why, and yesterday he blogged about it: an implementation of the Vorbis decoder that works in Flash Player (albeit the newer version 10). It’s based on the Jorbis code which we took for Cortado, and it looks like it’s more than fast enough too. […]


  3. phil wrote:

    Dude. You rock, you are a hero!


  4. pancake wrote:

    Congratz for the release!

    Keep up the good job!


  5. Gavin wrote:

    excellent. well done.


  6. Flash的ogg和Vorbis格式播放器:

    […] 项目地址:http://barelyfocused.net/blog/2008/10/03/flash-vorbis-player/ […]


  7. Markus wrote:

    Wow, excellent!


  8. Kevin wrote:

    This is way cool. Thanks for this work.


  9. brion wrote:

    Mwahahahha how deliciously evil >:D


  10. oli wrote:

    how did you do the autotranslation?


  11. James Ward wrote:

    This is very cool. For bonus points do this with a type 4 Pixel Bender filter so that it runs in a separate thread. :)

    -James


  12. Roy wrote:

    I think you should use JCraft’s JOrbis library, which is newer than Fluendo’s.
    http://www.jcraft.com/jorbis/index.html


  13. AS3 FVorbis Flash Ogg Vorbis Player « [ draw.logic ]:

    […] AS3 FVorbis Flash Ogg Vorbis Player October 4, 2008 — drawk This project is stacked with cool, but is also useful, an ogg/vorbis player in flash/as3.  Arek Korbik at barelyfocused.  Check out the demo (need flash player 10). Groovy. The name is: FVorbis. Which stands for more or less “Ogg and Vorbis in Flash”. That’s right, pure ActionScript 3 implementation of the Ogg and Vorbis libraries that require no kind of native support from the Flash Player. A simple Vorbis player implemented using the new FVorbis lib compiles to about 46KB SWF file. And that’s it. […]


  14. Arek wrote:

    @oli: I hacked the java2python project into a java2haxe one; it’s still missing some things but is mostly useful; the plan is to clean it up a bit and make available too.

    @Roy: good point - I wanted to start with something that I was 100% sure works for playing Vorbis files in a browser - I’ll check what’s new in JOrbis and see about porting the updates.


  15. Lucas Gonze’ blog » pure AJAX audio formats now a reality:

    […] The best hack I’ve seen since Brad Neuberg did AMASS in 2005: Arek Korbik implements Vorbis in Flash, with no dedicated Vorbis support provided by Adobe as part of Flash. It’s a god-level piece of hacking. […]


  16. Fabricio Zuardi wrote:

    Awesome! You rock!


  17. Marek Majkowski wrote:

    Great idea. Congratulations!


  18. Craig wrote:

    Wow, this is downright impressive.

    Combined with the new HTML5 audio tag’s support for Vorbis, this Flash implementation can be implemented as a backwards compatibility provider for non-HTML 5 browsers on otherwise HTML 5 sites. Extremely cool.


  19. Synthmax wrote:

    Sounds really good.
    So where is the demo and the code?

    if I follows http://people.xiph.org/~arek/pg/hx/test.html i got an empty page?

    and if I follows this I ended up in an empty reposotory

    http://people.xiph.org/~arek/bzr/fogg.dev/

    Best Synthmax


  20. Roy wrote:

    @Synthmax:
    http://lists.xiph.org/pipermail/vorbis-dev/2008-October/019586.html


  21. JeroenW wrote:

    Very cool!

    Why the FP10 dependencies? Do they improve performance? It’d be cool if this works in FP9, although I understand this might result into a performance drop.


  22. 纯Flash的ogg, Vorbis, MIDI, mod格式播放器 - Mac.6.cn:

    […] Web  6.cn   搜索 RSS 最新无回复主题 最强主题排行 会员登录历史 注册会员总数 2397讨论 28558收藏 4278据点 1408印迹 7381空间 285 Hosted by 6.cn Mac.6.cn > Internet > 分享发现 > 纯Flash的ogg, Vorbis, MIDI, mod格式播放器est地球1.021%disconnected登录后回复主题 | 跳到回复纯Flash的ogg, Vorbis, MIDI, mod格式播放器 … by est … 12 小时 41 分钟前 … 41 次点击 ogg+vorbis http://barelyfocused.net/blog/2008/10/03/flash-vorbis-player/ midi http://www.tan66.cn/new-midas3-sample-for-flashplayer10/ 国人做的 .mod格式播放器 http://gimme.badsectoracula.com/flashmodplayer/modplayer.html HaXe写的 via 1,2 本本用户乱入。有没有试成功ChiralMotion技术的? 创建新主题 … 目前这个主题还没有回复,或许你可以帮楼主加盖一层? 在回复之前你需要先进行登录电子邮件或昵称密码回到顶部 | 分享发现 | 返回 Mac.6.cn 首页 | 注册 | 找回密码 © 2007 6.cn  -  京ICP证060797号  -  About  -  V0.7-DEV Illusion Island var woopra_id = ‘789604568′; […]


  23. Ajaxian » Open Web Podcast - Episode 5: Ryan Stewart of Adobe:

    […] Video: A huge Flash advantage. Where does the video tag fit in? John pointed us to the experimental vorbis support via haXe […]


  24. Open Web Podcast - Episode 5: Ryan Stewart of Adobe:

    […] Video: A huge Flash advantage. Where does the video tag fit in? John pointed us to the experimental vorbis support via haXe […]


  25. Jonas wrote:

    Superb!

    Would it be possible to create an all AS3 version that would be possible to use in FP9?

    This would be really cool in combination with popforge library - loading ogg from the server, decoding them to wav samples for handling in popforge (http://code.google.com/p/popforge/)

    Regards / Jonas


  26. Alex McLean » Blog Archive » DSP in HaXe:

    […] However now Flash 10 is out and gives you full control, you can now pipe your samples out to audio.  Already cleverer people than me have done things like an ogg vorbis player, not using Adobe authoring tools but the excellent and properly free HaXe language which can compile to flash. […]


  27. 电器 wrote:

    文章好啊。我转载一下。是不是博主原产的啊。用不用注明出处.


  28. The WHATWG Blog » Blog Archive » This Week in HTML 5 - Episode 13:

    […] Everyone should go admire my new dog Beauregard, then scroll down to read “dave”’s non-Beau-related but extremely interesting comment on an experimental Ogg Theora video encoder. From there, I learned about this Ogg Vorbis audio decoder written in pure ActionScript (Flash), leading to the tantalizing but as-yet-unrealized possibility of a Javascript shim like mv_embed that could take <audio> elements that point to Ogg Vorbis audio files and replace them with a Flash wrapper that could play the audio file, even in browsers that do not support the <audio> element or the Ogg Vorbis audio codec. […]


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>