audiosynth icon indicating copy to clipboard operation
audiosynth copied to clipboard

iOS Support

Open jrf0110 opened this issue 12 years ago • 4 comments

It seems that this library is not working on iOS (at least on my iphone5 running ios6). Have you looked into this issue at all? If so, could you point me in the right direction before I go down the rabbit hole? If you haven't, down the rabbit hole I shall go.

jrf0110 avatar Jan 07 '14 03:01 jrf0110

I'm not sure what the issue is specifically, I haven't looked into it that deeply (yet) - but I would hazard a guess that it has to do with iOS audio element dataURI support (there are resources indicating that only one audio stream can be played at a time on older versions of iOS Safari, but a sound should still play).

The nature of the error, "this operation could not be completed", occurs in both iOS Safari and Chrome for iOS and this is not a custom error, indicating to me it's an operating system support issue. Will look into further when I get the chance.

keithwhor avatar Jan 07 '14 15:01 keithwhor

Weird. I didn't even get an error. Any thoughts on using the Web Audio API rather than the audio element?

jrf0110 avatar Jan 07 '14 17:01 jrf0110

I got it working on iOS. The problem was, that Safari thought the file duration was extremely short. The issue is in in the generate function, where the WAV file is created, specifically in the file header in the 'RIFF' part. As I understand, this header should be a 32bit integer with value 36+chunkLength. This fixed it for me: var out = [ 'RIFF', pack(1, 36 + data.length * channels * bitsPerSample / 8), 'WAVE', ... ]

c0monoid avatar Feb 06 '24 11:02 c0monoid