Movie and Sound component won’t play simultaneously in PsychoPy - python

I am trying to develop a basic experiment in the PsychoPy Builder where a silent movie plays in the background while I go through a .csv list to play a sequential series of about 100 very short sounds (about 300 milliseconds each). When I play the .csv list by itself, the sounds play perfectly like I would expect, but when I add the video component, only the first sound in the list will play and it won’t play the entire list of sounds. The video does continue to play, but somehow seems to interfere with the sound component or reading through the .csv file.
I tried deactivating the audio of the silent movie because I thought this could interfere with the sound component, but this does not resolve the issue.
It seems the program is waiting for the video to end before it can repeat the loop and go to the next sound in the list, but instead the program just closes as soon as the video ends. Furthermore, I want the single video to be playing while the sound component loops through the list, but I don't know how to apply the loop only to one component and not the video component that is supposed to play simultaneously with the sounds.
I feel like this should be very easy to achieve, yet I could not find someone with a similar issue when googling a solution. Your help is much appreciated.

Related

I need help.Trying to make a mp3 player which when playing a music detect pitch

So far i already have the Application buttons etc... And i can open the file location of the music players music list which i can select the specific tracks.
I can also play the track and pause/stop the track
At the moment i am trying to use Aubio but its not going so well since i dont know how to use it well. Tutorials on this is scares as well.
Basically my objective is to make a music player which tracks change in pitch - when pitch changes switch the image placed in the tK after 1 sec - (i dont know if this can be done but) image change is changed to a random image in a specific folder
I have tried using different sources to get me to understand but its not working well - i am a slow beginner and need some sort of help to get me to my goal
Sorry forgot to mention - This is all being done in a TK window - i

Is there a Python sound module with these capabilities? (Stop, Play from any point)

So I'm trying to make a program that includes the playing of sound files (MP3). I am using playsound but it is inadequate as you cannot stop the sound until it is finished, also i would like a way to start sound files from a point other than the start.
For example i want to be able to play sound.mp3 for an int(input()) amount of time then stop it, i also want to be able to play sound.mp3 starting int(input()) miliseconds in.
Are there modules that can do this or extra code that i can use to make modules be able to do this.
I am yet to find ways to play from any point online, so i haven't tried anything yet.

pygame mixer music change playback speed

I want to playback an .mp3 file at 50% it's original speed, naturally pitched down (i.e. keeping the pitch is not my requirement).
I am using pygame.mixer and found several solutions (such as this one) that suggest changing the frequency on initialization should do the job as shown below, however that does not work for me.
from pygame import mixer
mixer.init(frequency=22050) # my track.mp3 has a 44100 sample rate
mixer.music.load("track.mp3")
mixer.music.play()
Am I doing something wrong? No matter to what value i change frequency it does not at all change the playback speed or pitch of the music played.
I found this solution here, with which I am able to speed down my track and play it back using mixer.Sound(speed_change(sound, 0.5).raw_data()).play(), however this method does not allow me to use the mixer.music functionality such as seek(time) or setting the start time when using .play().
I am generally also open to solutions that are not using pygame mixer, however I do need to be able to stop and/or pause the playback and have a seek functionality.
One way to do this would be to use this Audio Slowdown Software.]1
This would have the advantage of being easily reusable without having to type extra code or extra lines.

Is there a way to cut up a live music recording by clicks?

I'm new to coding in Python and so I'm wondering if it's feasible to record our band's performances and separate the live recordings by the drummer's clicks? They click between every song.
I've looked through numerous libraries, but I'm unsure of how I'd go about starting. My current idea is to check for drops in volume and the frequency of the clicks to decide a split in the audio file. Could anyone please help?

Phonon: how to clear screen after video plays

I am writing a program for audio-visual experiments, which will present a pre-generated list of audio-only and video-with-audio stimuli to experiment subjects. I have decided to use PyQT and Phonon for this, despite the fact that I'm fairly new to writing QT-based programs (and GUI programming in general).
The issue I'm having is that, when the previous file played was video (.mov in this case), and the current file is audio-only (.wav file), the image from the last frame of the video file remains on the screen while the audio file is playing. The video image remains until the next .mov file rolls around in the stimulus list.
Is there a way to clear the Phonon screen, in order to show just an empty black screen while the audio-only files are playing? I've done a fair bit of poking around with Google, and though this question has been asked by a number of people on different forums, it seems to have gone unanswered.
Any suggestions will be greatly appreciated!
This seems to be a bug, or missing feature, and it's hard to come up with a good workaround.
One somewhat hacky solution is to force a resize of the video widget:
size = self.video.size()
self.video.resize(0, 0)
self.video.resize(size)
but I wouldn't bet on this working on all platforms.
A more reliable workaround would be to put the video-widget inside a container widget with a black background, and then simply hide/show the video-widget when stopping/starting the media.

Categories