{"action":"created","issue":{"url":"https://api.github.com/repos/andrewrk/libsoundio/issues/105","repository_url":"https://api.github.com/repos/andrewrk/libsoundio","labels_url":"https://api.github.com/repos/andrewrk/libsoundio/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/andrewrk/libsoundio/issues/105/comments","events_url":"https://api.github.com/repos/andrewrk/libsoundio/issues/105/events","html_url":"https://github.com/andrewrk/libsoundio/issues/105","id":179654163,"number":105,"title":"File-output drivers","user":{"login":"iskunk","id":523357,"avatar_url":"https://avatars.githubusercontent.com/u/523357?v=3","gravatar_id":"","url":"https://api.github.com/users/iskunk","html_url":"https://github.com/iskunk","followers_url":"https://api.github.com/users/iskunk/followers","following_url":"https://api.github.com/users/iskunk/following{/other_user}","gists_url":"https://api.github.com/users/iskunk/gists{/gist_id}","starred_url":"https://api.github.com/users/iskunk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iskunk/subscriptions","organizations_url":"https://api.github.com/users/iskunk/orgs","repos_url":"https://api.github.com/users/iskunk/repos","events_url":"https://api.github.com/users/iskunk/events{/privacy}","received_events_url":"https://api.github.com/users/iskunk/received_events","type":"User","site_admin":false},"labels":[{"id":230863426,"url":"https://api.github.com/repos/andrewrk/libsoundio/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":27,"created_at":"2016-09-28T00:50:54Z","updated_at":"2016-11-14T20:01:15Z","closed_at":null,"body":"I propose the implementation of one or more file-output drivers for libsoundio.\n\nCurrently, there is no facility to direct audio samples [that would have gone to a sound device] to a file instead. This is a useful mechanism for testing/debugging and for supporting systems without a sound device, without the loss of sound data inherent to the existing dummy driver.\n\n(In fact, [LibAO](https://xiph.org/ao/doc/ao_open_file.html) and [PortAudio](http://portaudio.com/docs/v19-doxydocs-dev/write__wav_8h_source.html) have this functionality already. I can certainly vouch for its value in the former.)\n\nThe file that is created by this driver can take one of three formats that I can see: headerless raw samples, AU, and WAV. Each of these has pros and cons:\n\n|  | Pros | Cons |\n| --- | --- | --- |\n| RAW | Easy to implement, low overhead, does not require seekable stream | No internal metadata, not loadable by novice sound applications, error-prone when loading is supported |\n| AU | Easy to implement, metadata is included, does not require seekable stream | Not a popular format, dubious support among sound applications, small byte-swap overhead on little-endian systems |\n| WAV | Metadata is included, loadable by basically anything and everything | Somewhat more complex writer, requires seekable stream (so no output to e.g. stdout), 4GB maximum file size |\n\nGiven the tradeoffs, I think the ranking of most- to least-desirable is WAV, RAW, AU. The RAW driver is likely to arise in the course of implementing WAV, and AU borders on trivial, so if I can do WAV I can do all three.\n\nNote: The WAV/AU writer would be implemented standalone, without the use of a sound-file library. This facility is not intended to be an alternative to libavformat/libsndfile/libaudiofile et al.; support for sound-file features like compression, codecs, lossy encoding, etc. is out of scope. This is just about getting the samples to disk in a usable form.\n\n(Conceivably, this could be extended in the future to support file-input, simulating audio capture with the content of a sound file. But this is not the itch I'm looking to scratch.)\n\nThe only parameter that should be needed by these drivers beyond those of existing drivers is the file path/stream for the output.\n"},"comment":{"url":"https://api.github.com/repos/andrewrk/libsoundio/issues/comments/260445600","html_url":"https://github.com/andrewrk/libsoundio/issues/105#issuecomment-260445600","issue_url":"https://api.github.com/repos/andrewrk/libsoundio/issues/105","id":260445600,"user":{"login":"iskunk","id":523357,"avatar_url":"https://avatars.githubusercontent.com/u/523357?v=3","gravatar_id":"","url":"https://api.github.com/users/iskunk","html_url":"https://github.com/iskunk","followers_url":"https://api.github.com/users/iskunk/followers","following_url":"https://api.github.com/users/iskunk/following{/other_user}","gists_url":"https://api.github.com/users/iskunk/gists{/gist_id}","starred_url":"https://api.github.com/users/iskunk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iskunk/subscriptions","organizations_url":"https://api.github.com/users/iskunk/orgs","repos_url":"https://api.github.com/users/iskunk/repos","events_url":"https://api.github.com/users/iskunk/events{/privacy}","received_events_url":"https://api.github.com/users/iskunk/received_events","type":"User","site_admin":false},"created_at":"2016-11-14T20:01:15Z","updated_at":"2016-11-14T20:01:15Z","body":"> Adding a special backend for writing to files may be acceptable for debugging, but using it in production is a really bad idea.\r\n\r\nThat depends on the application, of course. (It would be a \"bad idea\" only to the extent that you're not getting live sound output at the same time.)\r\n\r\n> There are many specialized libraries just for that and they have the proper API structure for dealing with all kinds of formats and containers.\r\n\r\nThis isn't about sound-file formats/containers, just about getting samples out to a file/pipe in a usable form. If I were proposing an Ogg Vorbis writer, with all the additional complexity that entails, then this would be a fair point.\r\n\r\n> If you want to use pipes, just write directly to stdout, everything necessary is already in the C standard.\r\n\r\nCould you demonstrate how you'd go about this with the `sio_sine` example?\r\n\r\n(It's not as simple as you think.)"}}
{"actor":{"display_login":"iskunk"}}