Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6090387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:12:29+00:00 2026-05-23T12:12:29+00:00

so i have the code: def Listen(filepath): def play(filepath): def play_music(music_file): stream music with

  • 0

so i have the code:

def Listen(filepath):
        def play(filepath):

            def play_music(music_file):
                """
                stream music with mixer.music module in blocking manner
                this will stream the sound from disk while playing
                """
                clock = pygame.time.Clock()

                pygame.mixer.music.load(music_file)


                pygame.mixer.music.play()
                while pygame.mixer.music.get_busy():
                    # check if playback has finished
                    clock.tick(30)


            # pick a MP3 or MIDI music file you have ...
            # (if not in working folder, use full path)
            music_file = filepath
            #music_file = "ChancesAre.mid"

            # set up the mixer
            freq = 44100     # audio CD quality
            bitsize = -16    # unsigned 16 bit
            channels = 2     # 1 is mono, 2 is stereo
            buffer = 2048    # number of samples (experiment to get right sound)
            pygame.mixer.init(freq, bitsize, channels, buffer)

            # optional volume 0 to 1.0
            pygame.mixer.music.set_volume(1.0)


            play_music(music_file)
        thread.start_new_thread(play,(filepath))

and i get an error:

File "C:\Users\Desktop\WhaleTunes.py", line 59, in Listen
    thread.start_new_thread(play,(filepath))
<type 'exceptions.TypeError'>: 2nd arg must be a tuple

Does anyone know why i get this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:12:29+00:00Added an answer on May 23, 2026 at 12:12 pm

    Read the TypeError message: “2nd arg must be a tuple.” You have (filepath). This is not a tuple. A tuple of one element should be written: (filepath,) to disambiguate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: def __init__(self, a, b, c, d...): self.a = a self.b
i have this code: def some_method(): #i need to get some attrs :( return
I have this code: def setVelocity (x, y, yaw) setVelocity (Command2d.new(x,y,yaw)) end def setVelocity
I have this code: def display(self): print self.doc.toprettyxml(indent= ) strigName ='/Users/my_user/Desktop/python/' + str(datetime.datetime.now()) +
I have this code: def GetSteamAccts(): #Get list of steam logins on this computer.
So I have this code: def self.age_to_bucket(age) age = age.to_i if age >= 0
I have this python code: def sqrt(x): ans = 0 if x >= 0:
I have following code: def whatever(url, data=None): req = urllib2.Request(url) res = urllib2.urlopen(req, data)
I have code: class Scene def initialize(number) @number = number end attr_reader :number end
I have the following code: def maturities InfoItem.find_all_by_work_order(self.work_order).map(&:maturity) end I was thinking about changing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.