Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to play music without pygame

from playsound import playsound
playsound('audio.mp3')
#Hope it helps :)
Comment

how to play music on pygame

import pygame

pygame.init()
mixer.music.load("music/main.wav")#music file 
mixer.music.play(-1)
Comment

pygame music player

import pygame

pygame.init()
pygame.mixer.play('datei.wav')
Comment

how to put song in pygame

#has to be in .mp3 format
#has to be in same folder
#load the music
pygame.mixer.music.load('song.mp3')
#play the music infinite
pygame.mixer.music.play(-1)
#or play it one time
pygame.mixer.music.play(0)
Comment

play music pygame

pygame.mixer.music.load('jazz.wav')
pygame.mixer.music.play(-1)
Comment

how to play audio in python using pygame

from pygame import mixer
  
# Starting the mixer
mixer.init()
  
# Loading the song
mixer.music.load("song.mp3")
  
# Setting the volume
mixer.music.set_volume(0.7)
  
# Start playing the song
mixer.music.play()
  
# infinite loop
while True:
      
    print("Press 'p' to pause, 'r' to resume")
    print("Press 'e' to exit the program")
    query = input("  ")
      
    if query == 'p':
  
        # Pausing the music
        mixer.music.pause()     
    elif query == 'r':
  
        # Resuming the music
        mixer.music.unpause()
    elif query == 'e':
  
        # Stop the mixer
        mixer.music.stop()
        break
Comment

PREVIOUS NEXT
Code Example
Python :: python install package from code 
Python :: columns to dictionary pandas 
Python :: python get copied text 
Python :: PRINT VS RETURN IN PYTHON 
Python :: To check pip version 
Python :: tkinter navigate pages 
Python :: reload all extensions discord.py 
Python :: get length of csv file with python 
Python :: get sheet names using pandas 
Python :: get list input from user in python 
Python :: pandas drop empty rows 
Python :: django reverse 
Python :: how to find if a value is even or odd in python 
Python :: change value in pandas dataframe cell 
Python :: business logic in django 
Python :: how to split an input in python by comma 
Python :: get self file name in python 
Python :: pandas find top 10 values in column 
Python :: import decisiontreeclassifier 
Python :: pandas shift column 
Python :: how to extract month from date in python 
Python :: mean deviation python 
Python :: import all images from folder python 
Python :: python how to unnest a nested list 
Python :: flask getting started 
Python :: float number field django models 
Python :: how to do label encoding in multiple column at once 
Python :: sns lineplot title 
Python :: Renaming row value in pandas 
Python :: calculate market value crsp pandas 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =