Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

voice key recording

2»

Comments

  • yes, I reduced blank, time_out and self.sleep by half (so it should be 1 s in total), but it's 3 sec now. I believe it somehow has to do with the recording time.

    It's variable but as far as every trial is recorded, I dont care for some "blank" recording before or after the actual content.

  • Unfortunately your script is incompatible with my version of Opensesame (I can't install pyaudio, and you use python2, but I Python3), but from looking at your code, I have the hunch that the code:

    myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=2)
    sd.wait() # Wait until recording is finished
    write('output.wav', fs, myrecording) # Save as WAV file 
    


    contributes to the delay. So basically, you are recording here for one second, before you even start the voice key loop. I think that part is redundant with this part:

    # Open the mic
    stream = pyaudio.PyAudio().open(
    	format=FORMAT,
    	channels=CHANNELS,
    	rate=RATE,
    	input=True,
    	input_device_index=0,
    	frames_per_buffer=INPUT_FRAMES_PER_BLOCK
    	)
    


    At least it is not clear what the difference between them is. They both seem to make a connection to a microphone and then record. Whereas Pyaudio seems to do it chunkwise, Sounddevice seems to do it in one block. Maybe it is possible with sounddevice to also record in blocks and blockwise check whether the loudness threshold was exceeded. Alternatively, you can use the Pyaudio code, to also write it to file. See for example here

    Does that make sense? Again, I can't test it myself, and I am not too familiar with audio recording so I might be completely wrong here.

    To check maybe, you can remove the sounddevice code, then you would have no file, but the presentation during should be accurate. Right?


    Eduard

    Buy Me A Coffee

  • yes, if it's not recording into a file, it is more or less accurate.


    I also think that i does the delay but I do not see how this piece of code


    stream = pyaudio.PyAudio().open(
    	format=FORMAT,
    	channels=CHANNELS,
    	rate=RATE,
    	input=True,
    	input_device_index=0,
    	frames_per_buffer=INPUT_FRAMES_PER_BLOCK
    	)
    


    would write into a file. :/ Sorry for the ignorant questions

  • That part only initializes the stream, the reading and writ should happen later.At that stage, if you don't know how exactly it works, it is a lot of trying out. You can check PyAudios documentation and what possibilities there are to write files. This link is also very useful. In general, I think you have to just try some things and play around until works. Like that you will also learn what all these words mean and how the script works. The script below, is my naive advice what could work, but without having pyaudio installed it is nothing more than a guess.

    # in the beginning of script
    import wave
    
    # after setting the parameters
    wavefile = wave.open(<filename>, 'wb')   
    wavefile.setnchannels(2)    
    wavefile.setsampwidth(self.pyaudio.PyAudio.get_sample_size(pyaudio.paInt16))
    wavefile.setframerate(44100)
    # in the while loop, add this extra line in the try/except part
    	try:
    		block = stream.read(chunk)
    		wavefile.writeframes(block)
    	except IOError as e:
    		print e
    
    # at the end of the script
    wavefile.close()
    

    Also, I won't be able to get back to you about this for the next week or so, so you are on your own a bit, but I am sure you are close to finishing it. Good luck!


    Eduard

    Buy Me A Coffee

  • Thanks a lot! I own you many coffees :D

  • Just of curiosity, did it work eventually?

    Eduard

    Buy Me A Coffee

  • edited July 2020

    Thanks for asking!

    In fact, I decided to record with a separate device after we realized that this recording would most probably interfere with timing which should be very precise in our experiment.

    I still havent figured out the VP-1 though :) this is to come.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games