@koenaad you seem to be figuring it out, but here’s my understanding:
audio::dsp::Converter is likely what you’re looking for. On OS X / iOS, setting the samplerate on an
audio::Device is currently limited to what your hardware supports, as it instructs Core Audio to process audio at that rate. On other platforms, both
InputDeviceNodes use an
audio::dsp::Converter internally, and I believe the implementation supports pretty much all samplerates. But that will also affect what you hear (are you also playing your sound out of some speakers?), if this is just to compress and send over the 'net, maybe you should get the
audio::Buffer back from
BufferRecorderNode and run it with the Converter yourself.
Also makes me think of writing to an .ogg file would suit your situation, as it’d be much much smaller. This isn’t implemented yet, only reading oggs is implemented at this time, but it wouldn’t take a huge effort to add a
TargetFileOggVorbis, all the ogg source is in there to do it (and a commented out shell here). It’s definitally something I’d like to see get done, anyway.
I find it confusing that BufferRecorderNode does not inherit from OutputNode, isn’t it also an endpoint for audio?
Currently the only
OutputNode implementation is
BufferRecorderNode falls into the ‘auto-pullable’ category, along with
MonitorNodes. At the time I designed it, I was under the impression that you can only ever have one
OutputDeviceNode running at any given time, and this essentially runs the dsp graph within an
Context also keeps a list of
NodeAutoPullables, of which it updates each time the
OutputDeviceNode gets a system callback. Knowing what I do now, this design is limited on many platforms (for example on Windows most multi-channel soundcards present themselves to the OS as multiple stereo pairs of audio devices), and I’m planning to change it. I think your confusion is worth considering, perhaps the idea of
NodeAudioPullable shoudl be removed, and all that currently inherit from it should be
OutputNodes. This isn’t at the top of my todo list, but it’s getting there, and I’m collecting notes from situations such as this.
Please keep me updated, and let me know what you find!