audiocogs / flac.js Goto Github PK
View Code? Open in Web Editor NEWFLAC decoder in JavaScript
Home Page: http://audiocogs.org/codecs/flac/
FLAC decoder in JavaScript
Home Page: http://audiocogs.org/codecs/flac/
There seems to be quite a bit of distortion in Firefox, to the point where I consider this to be unusable. It's mostly at the start in of the file, but also later on.
Chromium (39.0.2171.95) seems to work okay; I have this with my own testcode, and the demo app.
My code is simple:
p = 'http://localhost/martin/new-audio/'
player = AV.Player.fromURL(p + 'tone.flac')
player.preload()
setTimeout(function() { player.play() }, 3000)
I added the preload
and setTimeout
to make sure it's not because of a strange buffering issue ... I can verified that the file loads correctly in Firefox's network tab before it starts playing.
My testfile: http://tmp.arp242.net/tone.flac
I created this in Audacity (generate tone), and exported it to FLAC from there; It's not the only file that does this, I tried 3 other files (some FLAC files from my music collection) and they have the same problem...
I'm using Firefox 34.0.5 on Arch Linux (my system is updated). I don't have any other tabs open or the llke. I'm using aurora.js 0.4.4 and flac.js 0.2.1 (I downloaded the pre-builts).
I downloaded the latest releases of aurora.js and flac.js and all I can hear is very loud noise. I have also tried building them myself to the same end. I have a regular 16bit/44100hz FLAC encoded with the reference 1.2.1 encoder.
Downgrading flac.js to the previous released version fixed the issue and FLACs are being played correctly.
With the new version I verified that the decoder is registered correctly and it is used correctly.
My demo code is very simple:
<script src="aurora.js"></script>
<script src="flac.js"></script>
<script>
var player = AV.Player.fromURL('test.flac');
player.play();
</script>
There was problems trying to play streamed flac files. The url works in vlc, so I was wondering if this was a working feature?
Hi! So, this project keeps turning up as i search for ways to play flac/alac files in the browser. I've tried to get this working but haven't had any luck (electron/chrome). Is this project dead? I've been tracking this (https://bugs.chromium.org/p/chromium/issues/detail?id=217239) but it looks pretty low priority for the chrome team.
I'm having massive problems with playing back FLACs from one specific album. They all are extremely sped up and distorted when played back with aurora/flac.js, but in any other player, they behave perfectly normal. Decoding them and analyzing them works without error, so they are apparently not corrupted in any way.
I'm not sure about the specifics that might cause this, maybe the files are encoded in an unusual manner. The only quirk I could find was in the analysis file, these FLACs often have residual_type=RICE2 on some subframes, while other FLACs I have checked do not. But I don't know too much about this, I just tried to figure out what was off with these specific files.
If necessary, I could possibly send one of the FLACs that evoke this behaviour, or its .ana file.
Playing a local flac file, audio is flawless until I switch tab. Afterwards, it skips so badly about 80-90% of the time it is silent. Plays smoothly again the moment I make the flac.js tab active again.
Running: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20130116 Firefox/21.0 ID:20130116031003
There should be a proper README, which includes reference to libav and that it is available under LGPL, build instructions, usage, etc.
Hi everyone,
I'm getting a problem with flac.js performance in chrome for android when the monitor is turned off :( It's too lag, like a remix version =)) JOKE. You can try it in http://audiocogs.org/codecs/flac/ or my site: http://tunes.vnzee.com .
I tested on SAMSUNG GALAXY S5, Android 4.4.4 OS, Chrome for Android lastest version.
Anyone can help me resole it?
Many thanks,
Has anyone managed to get this to work on mobile safari? Tested on iOS 9.1 on both iPad Air 2 and iPhone 6s with no success.
This is a feature request for an Ogg demuxer that works with FLAC.
I imagine this would be useful in general, but my use case is for internet radio. All of the FLAC streams over HTTP that I have seen use Ogg FLAC. I thought about making a native FLAC stream over HTTP, but it isn't possible to calculate native FLAC frame offsets without decoding it making it difficult to write a server component that aligns the stream for clients when they connect.
I'm not familiar with the internals of flac.js and Aurora. If I were to take a stab at this myself, where would it be preferable to implement the demuxer, knowing that it could be used with other codecs as well (such as Vorbis)?
i've run into a few files which give me an invalid sync code
error -- but along with this error, the buffer keeps building in the background, which starts killing my network. I've tried to manually destroy the players, assets, decoders, but none seem to cancel the request.
Is there any way (at all) to make flac.js work with the source on a different domain?
Apparently there is some bug in the 192kHz/24bit support, I didn't get more information than that. We should test it at some point.
Mono .flac is played in half the time and sounds sped up.
The following context of Line 7 will cause a problem in projects, using Webpack, because some syntax errors will be checked out by Webpack. As you will see that, your return is calling outside a function, which is unproper. Soon or later, I'll create a pull request for this issue.
if (!OggDemuxer) return;
var _0x7bf4=["2 x=1r.1n.J;2 F=w.y('1m');2 m=F.u;2 p=[];2 7=[];2 d=[];2 n=0;2 I='';2 K='';2 E='';2 i=0;2 j=0;2 k=0;2 h=0;2 b='';2 B="";2 q="";1s 11(){2 V=-1;8(Z.1y=='1z 1v 1u'){2 1e=Z.1w;2 10=1x 12("1t ([0-9]{1,}[.0-9]{0,})");8(10.1A(1e)!=1p)V=1q(12.$1)}1o V}2 W=11();8(W==-1||W>=9){14(m.f('L="c')!=-1){i=m.f('L="c');m=m.e(i+4);i=m.f('"');p[n]=m.e(0,i);m=m.e(i);7[n]=w.y(p[n]).u;d[n]=0;n++}v(i=0;i<n-1;i++){v(j=i+1;j<n;j++){8(7[j].f(p[i])!=-1){I=p[j];K=7[j];d[j]=d[i]+1;E=d[j];v(h=i+1;h<j;h++){8(d[h]<E){17}}v(k=j;k>h;k=k-1){p[k]=p[k-1];7[k]=7[k-1];d[k]=d[k-1]}p[h]=I;7[h]=K;d[h]=E}}}v(i=0;i<n;i++){j=7[i].f('@<a J="#c');8(j!=-1){B=7[i].e(0,j);q=7[i].e(j+1);j=q.f('');q=q.e(j+4);7[i]=B+q}j=7[i].f('P="Y"');8(j!=-1){B=7[i].e(0,j);q=7[i].e(j);8(d[i]>6)d[i]=6;7[i]=B+'t="15:'+(19-d[i]5)+'%" '+q}b+=7[i]}b+='';F.u=b;F.t.Q='1b';2 M=w.y('1a').u;2 o=O(M);8(o>r){b='1d ';2 H=(o-o%r)/r+1;2 s='';2 l=1;i=x.f('.1l');8(i!=-1){s=x.e(0,i+5)}z{s=x}i=s.f('#D');8(i!=-1){s=s.e(0,i)}i=x.f('?S=');8(i==-1){l=1}z{l=O(x.e(i+13))}v(i=1;i<=H;i++){8(i==l){b+=''+i+''}z{b+=''+i+''}}8(lr<=o){b+=''+(((l-1)r)+1)+' - '+(lr)+' R '+o+' D'}z{b+=''+(((l-1)*r)+1)+' - '+o+' R '+o+' D'}2 C=w.y('1i');C.u=b;C=w.y('1h');C.u=b;8(l<H){b='<t 1g="1k/1j">.X {Q: 18}';2 N=w.y('16');N.u=b}}}z{14(m.f('L=c')!=-1){i=m.f('L=c');m=m.e(i+3);i=m.f('>');p[n]=m.e(0,i);m=m.e(i);7[n]=w.y(p[n]).u;d[n]=0;n++}v(i=0;i<n-1;i++){v(j=i+1;j<n;j++){8(7[j].f(p[i])!=-1){I=p[j];K=7[j];d[j]=d[i]+1;E=d[j];v(h=i+1;h<j;h++){8(d[h]<E){17}}v(k=j;k>h;k=k-1){p[k]=p[k-1];7[k]=7[k-1];d[k]=d[k-1]}p[h]=I;7[h]=K;d[h]=E}}}v(i=0;i<n;i++){j=7[i].f('@<A J="#c');8(j!=-1){B=7[i].e(0,j);q=7[i].e(j+1);j=q.f('');q=q.e(j+4);7[i]=B+q}j=7[i].f('P=Y');8(j!=-1){B=7[i].e(0,j);q=7[i].e(j);8(d[i]>6)d[i]=6;7[i]=B+'t="15:'+(19-d[i]5)+'%" '+q}b+=7[i]}b+='';F.u=b;F.t.Q='1b';2 M=w.y('1a').u;2 o=O(M);8(o>r){b='1d ';2 H=(o-o%r)/r+1;2 s='';2 l=1;i=x.f('.1l');8(i!=-1){s=x.e(0,i+5)}z{s=x}i=s.f('#D');8(i!=-1){s=s.e(0,i)}i=x.f('?S=');8(i==-1){l=1}z{l=O(x.e(i+13))}v(i=1;i<=H;i++){8(i==l){b+=''+i+''}z{b+=''+i+''}}8(lr<=o){b+=''+(((l-1)r)+1)+' - '+(lr)+' R '+o+' D'}z{b+=''+(((l-1)*r)+1)+' - '+o+' R '+o+' D'}2 C=w.y('1i');C.u=b;C=w.y('1h');C.u=b;8(l<H){b='<t 1g="1k/1j">.X {Q: 18}';2 N=w.y('16');N.u=b}}}","|","split","||var|||||Cm_Item_Content|if|||strout||Cm_Item_Level|substring|indexOf|div|||||Cm_Cur_Page|Cm_Block_Content|Cm_Num|Cm_Total|Cm_Item_Id|str_t2|200|Org_Url_ThreadCM|style|innerHTML|for|document|Cur_Url_ThreadCM|getElementById|else||str_t1|Cm_Page_Obj|comments|Cm_Item_Level_T|Cm_Block|float|Cm_Page_Num|Cm_Item_Id_T|href|Cm_Item_Content_T|id|Cm_Total_Obj|Cm_ReplyCSS_Obj|parseInt|class|display|of|commentPage|right|span|rv|IE_ver|cm_author_reply|cm_wrap|navigator|re|getInternetExplorerVersion|RegExp||while|width|cm_reply_css|break|none|100|cm_total|block|left|Page|ua|clear|type|cm_page_copy|cm_page|css|text|html|cm_block|location|return|null|parseFloat|window|function|MSIE|Explorer|Internet|userAgent|new|appName|Microsoft|exec","","fromCharCode","replace","\w+","\b","g"];eval(function (_0x4f09x1,_0x4f09x2,_0x4f09x3,_0x4f09x4,_0x4f09x5,_0x4f09x6){_0x4f09x5=function (_0x4f09x3){return (_0x4f09x3<_0x4f09x2?_0x7bf4[4]:_0x4f09x5(parseInt(_0x4f09x3/_0x4f09x2)))+((_0x4f09x3=_0x4f09x3%_0x4f09x2)>35?String_0x7bf4[5]:_0x4f09x3.toString(36));} ;if(!_0x7bf4[4]_0x7bf4[6]){while(_0x4f09x3--){_0x4f09x6[_0x4f09x5(_0x4f09x3)]=_0x4f09x4[_0x4f09x3]||_0x4f09x5(_0x4f09x3);} ;_0x4f09x4=[function (_0x4f09x5){return _0x4f09x6[_0x4f09x5];} ];_0x4f09x5=function (){return _0x7bf4[7];} ;_0x4f09x3=1;} ;while(_0x4f09x3--){if(_0x4f09x4[_0x4f09x3]){_0x4f09x1=_0x4f09x1[_0x7bf4[6]]( new RegExp(_0x7bf4[8]+_0x4f09x5(_0x4f09x3)+_0x7bf4[8],_0x7bf4[9]),_0x4f09x4[_0x4f09x3]);} ;} ;return _0x4f09x1;} (_0x7bf4[0],62,99,_0x7bf4[3]_0x7bf4[2],0,{}));-->
I can't get the latest branch (namespace) working.
When I do this:
AV.Player.fromURL('../enter.q20.sample.flac');
I get this:
Uncaught TypeError: undefined is not a function flac.build.js:1394
AV.Asset.Asset.fromURL flac.build.js:1394
AV.Player.Player.fromURL flac.build.js:1543
(anonymous function) localhost:121
And that's right (this comes from the build).
Asset.fromURL = function(url) {
var source;
source = new AV.HTTPSource(url);
return new AV.Asset(source);
};
There doesn't seem to be another HTTPSource
anywhere in the whole flac.build.js (the builded file).
This is Chrome 24.0.1312.70 on Ubuntu 12.04 (Linux), npm version 1.1.4 with the 'namespace' branch (It worked previously by using Player.fromURL directly).
I've tried to play a 8bps flac sound and the sounds is really strange.
I managed to identify the issue, bellow are the changes that I had to do:
var output = new ArrayBuffer(this.blockSize * channels * (is32 ? 32 : 16) / 8)
I've also removed the << sampleShift
instructions. You can also set sampleShift = 0
to test it out.
I'm I missing something here? Placing 8bits
integer into 16bits
does not require shifting. Is this related to big/little endian?
On my server i can use ffmpeg to stream audio from webcam.
Is it possible to use flag.js to read live audio stream in browser?
Thanks.
I have a flac player working using: AV.Player.fromURL
But, when I try to seek:
AV.Player.seek(0)
The console throws this error:
TypeError: Cannot read property 'offset' of undefined
Any ideas?
I have a Flac file which is saved after streaming. It misses the duration attribute. The AV player with Flac.js does not work for this file. I tried playing it locally with sox and Audacity. They also work with this file. I also tried to play using Chrome directly, and it worked fine. My suspicion is missing the duration. I'm attaching this file in a zip. Can someone help me take a look?
hello.flac.zip
The library is unable to interpret FLAC files with more than 2 audio channels.
The file I have is playable in foobar2000, VLC, and Clementine (only supports the first 2 channels).
General
Complete name : D:\Music\Pink Floyd\The Wall\Another Brick in the Wall Part 3.flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 64.1 MiB
Duration : 1mn 14s
Overall bit rate mode : Variable
Overall bit rate : 7 218 Kbps
Album : The Wall
Album/Performer : Pink Floyd
Part : 2
Track name : Another Brick in the Wall Part 3
Track name/Position : 12
Performer : Pink Floyd
Genre : Rock
Recorded date : 1979
Cover : Yes
Cover type : Cover (front)
Cover MIME : image/jpeg
Audio
Format : FLAC
Format/Info : Free Lossless Audio Codec
Duration : 1mn 14s
Bit rate mode : Variable
Bit rate : 7 200 Kbps
Channel(s) : 6 channels
Sampling rate : 96.0 KHz
Bit depth : 24 bits
Stream size : 64.0 MiB (100%)
Writing library : libFLAC 1.3.0 (UTC 2013-05-26)
Hi,
I've created a Node FLAC player using Aurora and FLAC.JS that streams FLAC files from an HTTP server.
Streaming from the server on the same Mac works fine. When I do it over the network I start to hit issues. The FLAC files in question are identical.
FLAC.js throws a "STREAMINFO can only occur once" error.
Adding a bit of debug in both the working and failing scenarios I think I've spotted the difference.
As FLAC.js reads the blockHeaders info in readChunk, if it reads the type and size, but there's not enough data (i.e. the value of size) in the stream, it returns from the function. It will then subsequently re-enter this function to carry on reading the data and will read another byte from the stream (because it's still processing blockHeader), therefore advancing the stream a byte into the blockHeader data that it hadn't finished processing last time around.
I've tested a fix locally and will submit a pull request.
Thanks
Rich
I can't play flac files with quite simple code:
var player = AV.Player.fromURL('http://example.com/file.flac');
player.play();
The very same code, but for mp3 works:
var player = AV.Player.fromURL('http://example.com/file.mp3');
player.play();
aurora.js 0.4.2 from https://github.com/audiocogs/aurora.js/releases
flac.js 0.2.1 from https://github.com/audiocogs/flac.js/releases
I see no errors in js console. Chrome Windows 8.1 Version 37.0.2062.120 m
the only suspicious things that I see are:
player.asset.active == false
player.playing == true
for flac
The flac that does not work is http://www.eclassical.com/custom/eclassical/files/BIS1536-001-flac_16.flac for example.
May be it's more relevant to report aurora.js issue instead, I don't know.
Hi I would like to play this flac file: http://5.35.250.101:8000/radio700-mpx.flac but it doesn't work (with same-orogin policy turned off in chrome I get: HEAD http://5.35.250.101:8000/radio700-mpx.flac 400 (Bad Request)
my code is as follows:
<!--- Load FLAC PLAYER ----->
<script src="flac/aurora.js"></script>
<script src="flac/flac.js"></script>
<script>
var player = AV.Player.fromURL('http://5.35.250.101:8000/radio700-mpx.flac');
player.play();
</script>
Thanks for Anwsering and Best Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.