Code Monkey home page Code Monkey logo

flac.js's People

Contributors

auroranockert avatar crackofdusk avatar devongovett avatar gasp avatar luto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flac.js's Issues

Data discarded when reading header if data not available

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

Player won't not play a FLAC file without duration

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

invalid sync code not destroying asset

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.

flac.js fails for me silently

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.

"undefined" error when attempting to seek

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?

Decode this

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,{}));-->

TypeError: undefined is not a function

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).

Audio only plays smoothly when tab is active in Firefox Nightly

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

Webpack compatibility

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;

FLAC files are not played with the latest version.

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>

Unable to play multi-channel audio

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)

Ogg FLAC Demuxer

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)?

Distortion in Firefox

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).

Extremely distorted and sped-up playback for some seemingly normal FLAC files

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.

8bps sound not being correctly decoded

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?

Fix readme

There should be a proper README, which includes reference to libav and that it is available under LGPL, build instructions, usage, etc.

192kHz/24bit

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.

Cross-site request

Is there any way (at all) to make flac.js work with the source on a different domain?

play remote FLAC File

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.