Play sound through Microphone Windows 10 - python

I wanted to make a soundboard that works in voice calls. I tried a few methods, like the play sound module but they don't do what I want them to do. Would I need a lower level library to accomplish something like this and if so what should I be looking for?

Related

Is there a way to imitate sound input with python?

I wanted to make a program that would pass some sound data to the system's microphone, imitating person's speech. Originally I wanted it to "talk" in a discord voice chat to other people, but I couldn't find any way to do so.
I tried libraries like SoundCard and PyAudio, but they seem to only have functions to either get the mic input from the user, or to output sound via speakers. However, I want it to simulate microphone input.
So, is there any way to do this with python (or any other language)?
Thanks in advance.

Projectile Sound Keeps Playing Rapidly How To Fix? [duplicate]

I have the music that is always run in the background and some activities that would play sound when triggered. The music works fine.
pygame.mixer.music.load(os.path.join(SOUND_FOLDER, 'WateryGrave.ogg'))
The problem I have is that when there are 2 or more activities triggering sounds, then only one would be played (not including the background music) and the rest are muted. Is there any solution to this?
you can add sounds to different channels using the mixer:
pygame.mixer.Channel(0).play(pygame.mixer.Sound('sound\gun_fire.wav'))
pygame.mixer.Channel(1).play(pygame.mixer.Sound('sound\enemy_hit.wav'))
Within each channel you can still only play one sound at a time, but you can group sounds into different channels if they would need to play at the same time.
You can add more channels like this:
pygame.mixer.set_num_channels(10) # default is 8
A simple example. For the docs on Channels, go to:
https://www.pygame.org/docs/ref/mixer.html#pygame.mixer.Channel

Python: play sound as input

Is it possible to play a wav/mp3/... file, so that the system thinks, its a microphone that plays the sound?
For example, I have this list of sounds:
1.wav
2.wav
3.wav
Now I have a terminal, that lets me choose one of this sounds. Is it possible to let Python act like a microphone?

Play do-re-mi musical notes (each lasting 1 sec) on Python

My son plays a string instrument that sounds terribly out of tune. I would prefer him to learn some simple Python programming to play do-re-mi notes that really sound like do-re-mi.
As a start, I would like to play do-re-mi with each note lasting 1 second duration on Python. Can this be easily done on Python? Easy means the code can be explained to a 10-year-old kid or at least not so difficult that he is put off.
I am using Python 2.7 on Windows 7.
Sounds like you are trying to program a synthesizer using python... Not a simple task. However if you do not require any smooth transition from one note to the next, and no tempo change etc. i.e. just have the program recite the notes in "Close Contact of 3rd kind" fashion, I guess you could store the digital notes in regular sound files. Have an array of these filenames, in what order you want to play them, then just issue the command to play the notes one at a time with a wait in between. There are a number of python sound libraries: Snack sound, pyMedia, pyglet, winsound (build-in to the windows python), pygame, wxPython (probably a lot more)
I like the simplicity of pygame:
import pygame
import time
notes = ['note1.mp3', 'note2.mp3', 'note3.mp3', 'note4.mp3']
pygame.init()
for note in notes:
pygame.mixer.music.load(note)
pygame.mixer.music.play()
time.sleep(2)
Here it might take a little bit to learn but try PyAudio. You may have to def some functions to generate the sound waves (represented by strings). Other options include winsound, Nsound, sunau, etc it depends how you want to play the sound.

Can't get winsound.Beep to work

I am trying to make some Beep noises with the winsound.Beep command. However when I am using winsound.Beep(500, 500) I do not hear anything. With winsound.MessageBeep and winsound.PlaySound however, I DO get to play sounds. Any ideas what I should do?
What I am trying to do: I want to write a little practicing program for training intervals: the computer sounds a first tone, then a second tone and you will have to guess what the tone interval is. For this I need pitched tones, tones for which I can set the frequency. I want to keep it as simple as possible, any pitched sound will do. I do not want to have to collect a set of .wav files or whatever. I want to make use of a tone generator which I think is available on most soundcards. winsound.Beep seems like something that can do this trick, but any other suggestions are welcome.
I had the exact same problem. winsound.Beep used to work just fine and then it suddenly stopped working (or that's what I thought). The problem was that someone (or some update) had turned off the System sounds, which prevented windows from playing the Beep sound, either manually or through my program. Try right clicking on the Speaker symbol, Open volume mixer and check whether System sounds is off or minimum volume.
I hope that helps!
Are you sure that your computer has a beep? A lot of recent computer remove the beep because it was annoying and most computer today have soundcard to play wav sound instead (the other sound that you are able to play).
You can also check to validate if it's activated on this page
IMO, I think that using the beep for other things than debugging is not a good idea.
EDIT
Mayby you can try this code to create a sound using a base wav with synth algorythm

Categories

Resources