Recording Game Sound (In Game)

I have created a little drum sim/game and i was wondering if there is anyway to record the game sound to an audio file and then replay it back without leaving the game? I have had a look at other questions and i think someone said it would be possible in unity3. If the worst comes to the worst I could create a script which saves the time of which the drum is played to a text file and then read it back. But I would rather avoid this because using the sound (out of game would be helpful). Any help would be greatly appreciated.

I don't see a direct way to extract just game audio or stream audio events out of the engine.

That said, you could consider something akin to MIDI and store the strength of hits/releases of your drums in a file as measured in time.

{KIT} {TIME} {HIT/RELEASE} {VELOCITY}

DrumA 00:00:051 DOWN 0.8

DrumA 00:01:011 UP 0.1

DrumB 00:01:012 DOWN 0.3

DrumB 00:01:014 UP 0.1

DrumB 00:02:015 DOWN 0.3

DrumB 00:02:017 UP 0.1

If you have the drum sounds as resources assets (.wav, .mp3, etc.) you could then play them back outside the game by firing playback of the assets (kit) against the values described in the file via another application.

If you are concerned about audio source location or effects, you could probably simulate that as well by extending the amount of information you store.

{KIT} {TIME} {HIT/RELEASE} {VELOCITY} {POSX} {POSY} {DELAY} etc…

One interesting application of storing it as a sequence of instructions would be that you could ‘ghost’ drum or add accompaniment in-game by recording a session and allowing the player to play along with a recorded session.

Anyhow, just a thought.