Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropped final character in saved filename with mic.record #875

Closed
gciccarelli3 opened this issue Mar 12, 2015 · 1 comment
Closed

Dropped final character in saved filename with mic.record #875

gciccarelli3 opened this issue Mar 12, 2015 · 1 comment

Comments

@gciccarelli3
Copy link

Hi,

filename = '../data/20150312094043_voice_ID1000_S001_T001_R001_pataka'
microphone.switchOn()
core.wait(3)
mic.microphone.AdvAudioCapture(name='mic', stereo = False)
mic.record(sec=20, block=False, filename = filename + '.wav')
Using this line to specify file name results in 20150312094043_voice_ID1000_S001_T001_R001_patak.wav instead of 20150312094043_voice_ID1000_S001_T001_R001_pataka.wav
Note the dropped 'a' at the end of pataka

However, by adding an intermediate character in the concatenation, all characters are used.

mic.record(sec=20, block=False, filename = filename + '123456' + '.wav')
20150312094043_voice_ID1000_S001_T001_R001_pataka123456.wav

This could be my misunderstanding of how python concatenate works somehow.

This error does not happen with a shorter filename e.g. filename = '../data/mySubject1234' writes out as mySubject1234.wav

Using Psychop v1.81.03 on mac 10.8.2

Thanks.

@jeremygray
Copy link
Contributor

This is a bug, will fix. The issue is not the length of the filename, but the fact that it ends with an 'a'. The bug is that if a filename is given to .record(), any trailing '.wav' is supposed to be removed, but that is done incorrectly and removes any of the characters w, a, v, or .

Possible work arounds:

  1. end your filenames with another character, e.g., x:
    mic.record(sec=20, block=False, filename = filename + 'x.wav')
    It does not have to be 'x'. This will give you filenames like
    20150312094043_voice_ID1000_S001_T001_R001_patakax.wav
  2. Set the filename prior to calling .record()
    mic.wavOutFilename = filename + '.wav'
    mic.record(sec=20, block=False)
    This will give you file names with extra stufff (a timestamp, in unix epoch time), like
    20150312094043_voice_ID1000_S001_T001_R001_pataka-1426173235.230.wav

peircej added a commit that referenced this issue Mar 16, 2015
BF: microphone filename .wav; closes #875
peircej pushed a commit that referenced this issue Jul 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants