Skip to content

Running errors and what I think are logical errors #3

Closed
@mostcat

Description

@mostcat

env:

  • Win10
  • Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 4 2021, 13:27:16) [MSC v.1928 64 bit (AMD64)] on win32

The error is concentrated in this sentence:

 stream.write(array.array('f',
                             ((volume * math.sin(2.0 * math.pi * i * tone[0] / float(sr)) + volume * math.sin(2.0 * math.pi * i * tone[1] / float(sr)))
                              for i in range(sr*int(length)))).tostring())

Error1:

stream.write(array.array('f',
AttributeError: 'array.array' object has no attribute 'tostring'

Error2:
sr*int(length))
int(length) = int(0.25) = 0


After fixing the above 2 errors, you can dial normally through the phone handset

    commandDTMF = array.array('f',((volume * math.sin(2.0 * math.pi * i * tone[0] / float(sr)) + volume * math.sin(2.0 * math.pi * i * tone[1] / float(sr)))
                                for i in range(int(sr*length)))).tobytes()
    stream.write(commandDTMF)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions