Recording audio files and thumbnails

Hello everybody.
I’m going to implement a multitrack recording functionality in my program.
What I’m trying to achieve is the classic audio recording system that many programs already have, like protools, cubase, logic, etc.
I’d like to have some tips, in order to show an audioThumbnail of the file being recorded.
What I learned since now is that the AudioThumbnail class can paint an image from an InputSource.
So, how can I create an InputSource from a file that isn’t yet complete (because I’m recording in it)?
Basically, I’m thinking of:

  • creating a new empty file
  • write audio samples in it
  • repaint the thumbnail

But maybe I’m thiking really wrong!
Any help is appreciated!

hi masshacker,
I might be totally wrong, but did you try to use fromStream instead of setSource? In that case you could give it a MemoryInputStream instead of a FileInputStream.

But i haven’t used AudioThumbnail so far, so i can just guess…

Yeah, generating a thumbnail from an unfinished file is bit of a special case. I don’t think you’ll get very far giving it a file to read, as the file’s header won’t be correct until it has finished, so it probably won’t open. It’d also be incredibly inefficient to make it keep re-reading the file while you’re recording.

I think you’d probably need a special class for this, which your recording routines would feed with data, rather than using the current thumbnail class - it’s just not designed for things that don’t have a fixed length.

Ok, thank you.
So should I make something like the LiveAudioInputDisplayComp in the audio recording page of the juce demo?
But without using a circular buffer?

Yes - that’s exactly the sort of thing you’d need.