Recording audio question ?

For questions about using Classic.

Post » Sat Dec 04, 2010 8:04 pm

is there any way of recording the sound during game play (just the sound) and saving it automatically........The only way i can do it at the moment, is to run and record with windows sound recorder at the same time......is there any way to automate this...or does anybody now a solution.........i know Construct is primarily used for creating games, but this function would be a god send. :?
B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Sat Dec 04, 2010 8:15 pm

You could do this with Python:

PyAudio:
http://people.csail.mit.edu/hubert/pyaudio/
[code:38qshoqv]import pyaudio
import sys

chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
RECORD_SECONDS = 5

p = pyaudio.PyAudio()

stream = p.open(format = FORMAT,
channels = CHANNELS,
rate = RATE,
input = True,
output = True,
frames_per_buffer = chunk)

print "* recording"
for i in range(0, 44100 / chunk * RECORD_SECONDS):
data = stream.read(chunk)
# check for silence here by comparing the level with 0 (or some threshold) for
# the contents of data.
# then write data or not to a file

print "* done"

stream.stop_stream()
stream.close()
p.terminate()[/code:38qshoqv]


or Csounds w/ Python support:
http://www.csounds.com/journal/issue6/p ... codes.html
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Dec 04, 2010 10:16 pm

[quote="scidave":2doapyaa]You could do this with Python:

PyAudio:
http://people.csail.mit.edu/hubert/pyaudio/
[code:2doapyaa]import pyaudio
import sys

chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
RECORD_SECONDS = 5

p = pyaudio.PyAudio()

stream = p.open(format = FORMAT,
channels = CHANNELS,
rate = RATE,
input = True,
output = True,
frames_per_buffer = chunk)

print "* recording"
for i in range(0, 44100 / chunk * RECORD_SECONDS):
data = stream.read(chunk)
# check for silence here by comparing the level with 0 (or some threshold) for
# the contents of data.
# then write data or not to a file

print "* done"

stream.stop_stream()
stream.close()
p.terminate()[/code:2doapyaa]


or Csounds w/ Python support:
http://www.csounds.com/journal/issue6/p ... codes.html[/quote:2doapyaa]



[u:2doapyaa]You are a god[/u:2doapyaa]

i have been looking for this solution for over a year!

Phython is something i am still struggling to understand?

If you get the time, will you post me a step by step on this(or a cap)

Thanks a lot [u:2doapyaa]scidave[/u:2doapyaa]

chrisbrobs
B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Wed Feb 02, 2011 12:11 am

Hi there scidave,

I'm not really familiar with the workings of python, could you please put this into a .cap?

Also, is it possible to use a 'save dialogue' to select where to save it to, either before or after it has recorded? and if so, how?
B
5
G
2
Posts: 40
Reputation: 930


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests