TypeError for definied variable in python
<p>I'm trying to make a music player that allows a song to be put into the shell and is then played however, I'm having an issue with a type error in <code>class Notes():</code> and I can't figure out why.</p>

<pre><code>import winsound
import time

length = 125

class Notes():
    def processNote(note):
        if(note == 'C'):return Notes.processNote(262)
        if(note == 'D'):return Notes.processNote(294)
        if(note == 'D5'):return Notes.processNote(587)
        if(note == 'A'):return Notes.processNote(440)
        if(note == 'Ab'):return Notes.processNote(415)
        if(note == 'G'):return Notes.processNote(392)
        if(note == 'F'):return Notes.processNote(349)
        if(note == 'B'):return Notes.processNote(247)
        if(note == 'Bb'):return Notes.processNote(233)
song = "CCCCCCCCCCCD"
noteList = list(song)
print(noteList)

for note in noteList:
    print("Doing ", note)
    frequency = Notes.processNote(note)
    winsound.Beep(frequency, length)
</code></pre>

<p>The error: </p>

<pre><code>Traceback (most recent call last):
  File "C:\Python\Tester.py", line 27, in &lt;module&gt;
    winsound.Beep(frequency, length)
TypeError: an integer is required (got type NoneType)
</code></pre>

<p>And if I can say something, instead of</p>

<pre><code>class Notes():
    def processNote(note):
        if(note == 'C'):return Notes.processNote(262)
        if(note == 'D'):return Notes.processNote(294)
        if(note == 'D5'):return Notes.processNote(587)
        (thousands IFs)
</code></pre>

<p>You could use the python dictionary and create mapping:</p>

<pre><code>class Notes():
    def processNote(note):
        signature_to_freq = {'C': 262, 'D': 294, 'D5': 587,
                            'B': 247}
        return signature_to_freq[note]
</code></pre>

python music typeerror