Recording audio question ?

This forum is currently in read-only mode.
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • 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.

  • You could do this with Python:

    PyAudio:

    http://people.csail.mit.edu/hubert/pyaudio/

    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:
    [url=http://www.csounds.com/journal/issue6/pythonOpcodes.html]http://www.csounds.com/journal/issue6/p ... codes.html[/url]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could do this with Python:

    PyAudio:

    http://people.csail.mit.edu/hubert/pyaudio/

    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:
    [url=http://www.csounds.com/journal/issue6/pythonOpcodes.html]http://www.csounds.com/journal/issue6/p ... codes.html[/url]
    

    You are a god

    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 scidave

    chrisbrobs

  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)