Page 1 of 1

How to save an audio stream?

Posted: Thu Mar 21, 2019 6:08 pm
by blaise84
Hello,

There's a 'Text Save' primitive that lets you save a given text, a 'Video Save' primitive that lets you save a video, but NO 'Stream Save' or 'Audio Save'.

I know that there's R&D component 'SaveWave' available, but that one can only save from a mem-input which I can't feed from a stream, only from a float array (or I would have to do my own reading like the waveplayer does, but that's a very unconvenient way to save an audio stream).

Please help.

I did not find the right solution from the internet.

http://www.dsprobotics.com/

clickfunnels review

Re: How to save an audio stream?

Posted: Fri Mar 22, 2019 8:53 am
by Spogg
Hi

If you look inside my Quilcom Caster you’ll find an audio recorder.
This may not be what you want because you have to specify the maximum recording time, rather than it be open-ended. You pre-set a defined memory size then fill it with audio data. You can’t change the memory size on the fly.

viewtopic.php?f=3&t=14601&p=47689&hilit=quilcom+caster#p47689

It might be possible using Ruby, since it can handle frames and write to disk etc. but that’s for a Ruby expert to chip in I’m afraid.

Cheers

Spogg

Re: How to save an audio stream?

Posted: Fri Mar 22, 2019 6:32 pm
by trogluddite
I have experimented a little with streaming to disk using Ruby. It is certainly possible, but I abandoned the project, as Ruby is very poorly suited to doing it; at audio rates at least. CPU loads were incredibly high due to the need to process every single sample of every Ruby Frame in real time (multiple frames for stereo and beyond), involving an enormous number of temporary Ruby objects. Ruby is also unable to create the OS threads which are a vital part of enabling buffering and HDD writing to be implemented as a background task so that the OS can manage the load effectively.

The only sensible way to implement it would be with a custom .dll via the DLL primitive, which would allow access to the Windows libraries for OS threads and low-level file access, and would massively speed up the processing of Frames (which are essentially C++ arrays under the hood.) I tried to make a little start on doing that, but my C++ chops weren't up to the task; it's very much harder work than a Ruby implementation!

Re: How to save an audio stream?

Posted: Sat Mar 23, 2019 11:09 pm
by MichaelBenjamin
...

Re: How to save an audio stream?

Posted: Sat Mar 23, 2019 11:17 pm
by MichaelBenjamin
...

Re: How to save an audio stream?

Posted: Sun Mar 24, 2019 8:34 am
by Spogg
MichaelBenjamin wrote:also maybe these two prims could help in setting up a basic save as wav func?


Yes indeed! That’s the only way I know, and it works, BUT you need to specify the recording length at the outset for the mem size. To record a stream of unknown length is a different matter entirely.

Cheers

Spogg