MattLivingston / voiceid

Automatically exported from code.google.com/p/voiceid
0 stars 0 forks source link

None type for score when adding model to DB #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce:

OS: Crunchbang 11 Waldorf 64-bit
Python 2.7

Run the following:

    from voiceid.sr import Voiceid
    from voiceid.db import GMMVoiceDB

    db = GMMVoiceDB('/home/gavin/.voiceid/gmm_db')
    print 'adding maps0 audio'
    db.add_model('/home/gavin/maps0_002', 'maps0')

The following error is thrown:

Traceback (most recent call last):
line type: <type 'str'>
  File "/home/gavin/PycharmProjects/transcription/audio/voiceid-test.py", line 11, in <module>
    db.add_model('/home/gavin/maps0_002', 'maps0')
  File "/usr/local/lib/python2.7/dist-packages/voiceid/db.py", line 249, in add_model
    if abs(abs(float(line[idx:iidx])) - abs(score)) < 0.07:
TypeError: bad operand type for abs(): 'NoneType'

The type of score is None. I can pass in a value for score, but I don't know 
what it should be.

On Ubuntu 12.04, the snippet runs without errors, even when I do not pass in a 
value for score.

Thanks,
Gavin

Original issue reported on code.google.com by gavinhac...@gmail.com on 12 Feb 2014 at 12:47

GoogleCodeExporter commented 9 years ago
Hi,
I just tried your code in Crunchbang 11, I notice a different error but the 
solution can be the same.
The permissions of /usr/local/share/voiceid/LIUM_SpkDiarization-4.7.jar were 
wrong,
I suggest you to fix by running this command:

sudo chmod 555  /usr/local/share/voiceid/LIUM_SpkDiarization-4.7.jar

try and let me know, it worked for me.

Original comment by maurome...@gmail.com on 13 Feb 2014 at 1:36

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion; it may have solved part of the problem. I still 
cannot add some .wav files to the DB; other .wav files I can add sometimes, but 
other times fail with the TypeError above. Now I wonder if my audio is the 
problem; I am trying to add files from the MOCHA 
(http://data.cstr.ed.ac.uk/mocha/) corpus. I added RIFF headers with sox.

The function I use to add the files is:

def add_sample(path, speaker_name):
    db = GMMVoiceDB('/home/gavin/.voiceid/gmm_db')
    print 'Adding', path, '...'
    db.add_model(path[:-4], speaker_name)
    print 'Successfully added', path, 'to the model.'

Thanks,
Gavin

Original comment by gavinhac...@gmail.com on 15 Feb 2014 at 4:00

GoogleCodeExporter commented 9 years ago
I am also having similar issue even after fgollowing your suggestions above

bsnayak@ubuntu:~/voiceid/Samples$ vid -s Jans -g Jan_Norden_18_31.wav 
Traceback (most recent call last):
  File "/usr/local/bin/vid", line 166, in <module>
    default_db.add_model(file_basename, speaker)
  File "/usr/local/lib/python2.7/dist-packages/voiceid/db.py", line 247, in add_model
    if abs(abs(float(line[idx:iidx])) - abs(score)) < 0.07:
TypeError: bad operand type for abs(): 'NoneType'
bsnayak@ubuntu:~/voiceid/Samples$ sudo chmod 555  
/usr/local/share/voiceid/LIUM_SpkDiarization-4.7.jar
[sudo] password for bsnayak: 
bsnayak@ubuntu:~/voiceid/Samples$ vid -s Jans -g Jan_Norden_18_31.wav 
Traceback (most recent call last):
  File "/usr/local/bin/vid", line 166, in <module>
    default_db.add_model(file_basename, speaker)
  File "/usr/local/lib/python2.7/dist-packages/voiceid/db.py", line 247, in add_model
    if abs(abs(float(line[idx:iidx])) - abs(score)) < 0.07:
TypeError: bad operand type for abs(): 'NoneType'

Original comment by bsnayak....@gmail.com on 22 Jun 2015 at 9:24