original_docstring: Play WAV format music
          file:the Wav format music
      
docstring: Play WAV format music
  file:the Wav format music
docstring_tokens: Play WAV format music file : the Wav format music
code: def Play_Music(file):
      """Play WAV format music
          file:the Wav format music
      """
      # define stream chunk
      chunk = 1024
      # open a wav format music
      f = wave.open(file,"rb")
      # instantiate PyAudio
      p = pyaudio.PyAudio()
      # open stream
      stream = p.open(format = p.get_format_from_width(f.getsampwidth()),
                                  channels = f.getnchannels(),
                                  rate = f.getframerate(),
                                  output = True)
      # read data
      data = f.readframes(chunk)
      # append data to datas 
      datas = []
      while len(data) > 0:
          data = f.readframes(chunk)
          datas.append(data)
      # play stream
      time = 0
      for d in tqdm(datas):
          time = time + 1
          stream.write(d)
          if time > len(datas)//10:
              break
      # stop stream
      stream.stop_stream()
      stream.close()
      # close PyAudio
      p.terminate()
code_tokens: def Play_Music ( file ) : chunk = 1024 f = wave . open ( file , "rb" ) p = pyaudio . PyAudio ( ) stream = p . open ( format = p . get_format_from_width ( f . getsampwidth ( ) ) , channels = f . getnchannels ( ) , rate = f . getframerate ( ) , output = True ) data = f . readframes ( chunk ) datas = [ ] while len ( data ) > 0 : data = f . readframes ( chunk ) datas . append ( data ) time = 0 for d in tqdm ( datas ) : time = time + 1 stream . write ( d ) if time > len ( datas ) // 10 : break stream . stop_stream ( ) stream . close ( ) p . terminate ( )
short_docstring: Play WAV format music
  file:the Wav format music
short_docstring_tokens: Play WAV format music file : the Wav format music
comment: """Play WAV format music
          file:the Wav format music
      """$SEP$# define stream chunk$SEP$# open a wav format music$SEP$# instantiate PyAudio$SEP$# open stream$SEP$# read data$SEP$# append data to datas $SEP$# play stream$SEP$# stop stream$SEP$# close PyAudio