-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a solution to the sound playing problem, a first run of subjects on t…
…he final experiment
- Loading branch information
1 parent
44bca7a
commit 73fa11c
Showing
5 changed files
with
15,283 additions
and
15,213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from psychopy import core, visual, gui, data, event | ||
from psychopy.misc import fromFile, toFile | ||
import time, random | ||
from scipy.io.wavfile import write | ||
import numpy as np | ||
import pygame | ||
from matplotlib import pyplot as plt | ||
import os, sys, inspect | ||
import time | ||
# realpath() with make your script run, even if you symlink it :) | ||
#cmd_subfolder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]) + "/scripts") | ||
cmd_subfolder = os.path.realpath('..')+'/scripts' | ||
if cmd_subfolder not in sys.path: | ||
sys.path.insert(0, cmd_subfolder) | ||
import sound_build, exp_param | ||
|
||
#------------ load global experiment parameters | ||
Exp = exp_param.exp_param() | ||
|
||
|
||
for i in np.arange(0,np.shape(Exp.Sound_array)[0]): | ||
s = sound_build.make_noisy_stim(i,Exp) | ||
level = Exp.level | ||
#scaled = np.int16(s/np.max(np.abs(s)) * (2**12-1))# 32767) | ||
scaled = np.int16(s * (2**9-1))# 32767) | ||
write('test.wav', 44100, scaled) | ||
pygame.mixer.init(frequency=44100, size=-16, channels=1, buffer=4096) | ||
pygame.mixer.music.load("test.wav") | ||
pygame.mixer.music.play() | ||
time.sleep(Exp.duration_tot+0.5) | ||
#plt.plot(Exp.time_stim,s) | ||
#plt.show() | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
30,226 changes: 15,113 additions & 15,113 deletions
30,226
Code/notebooks/Test_experiment_parameters.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters