Skip to content

Instantly share code, notes, and snippets.

View pushkarsingh019's full-sized avatar
🎯
Focusing

Pushkar Singh pushkarsingh019

🎯
Focusing
View GitHub Profile
@pushkarsingh019
pushkarsingh019 / eye_tracker.py
Created February 1, 2025 09:57
General Purpose Functions to Record and Store Data from Tobii Eyetracker.
def gaze_data_callback(gaze_data):
global trigger
global gaze_data_buffer
global winsize
global r
if len(trigger)==0:
ev = ''
else:
ev = trigger
@pushkarsingh019
pushkarsingh019 / gist:9aa518d8f3e36d10ff9da65b8d08762a
Created February 1, 2025 09:57
General Purpose Functions to Record and Store Data from Tobii Eyetracker.
def gaze_data_callback(gaze_data):
global trigger
global gaze_data_buffer
global winsize
global r
if len(trigger)==0:
ev = ''
else:
ev = trigger
@pushkarsingh019
pushkarsingh019 / Single_Channel.py
Last active December 24, 2024 01:58
The function create_single_channel_sound converts a monaural (single-channel) sound into a binaural (two-channel) sound. It places the original sound in either the left or right channel, as specified by the user, and fills the other channel with silence. This is useful for isolating a sound to a specific channel in a stereo format.
import numpy as np
import slab
def create_single_channel_sound(sound, channel):
"""
Pushkar Singh, 24/12/24 07:22
This functions take a monoaural sound and returns a single channel sound
Inputs
- sound : the monoaural sound object. The it should be a slab monoaural sound object.
@pushkarsingh019
pushkarsingh019 / create_itd.py
Created November 17, 2024 06:20
ITD CUES SOUND
def get_angled_sound(angle, sound, externalise, frequency):
"""
This function takes in azimuth angle and monoaural sound and returns sound with the specified angle.
Angle : azimuth angle. Where 0 is the center. So one posituve integer.
Sound : the sound on which you want to get the angled sound.
externalise : Boolean. If the function should externalise sound or not.
frequency : Frequency of the sound to calculate ITD.
head_size : Optional. In case you want calculate ITD specific to head sizes.
import numpy as np
import matplotlib.pyplot as plt
# Parameters
fs = 44100 # Sampling frequency
starttime_fakepulse = 0.0
peaktime_fakepulse = starttime_fakepulse + 0.006
endtime_fakepulse = peaktime_fakepulse + 0.006
peakamp_fakepulse = 1.0
endamp_fakepulse = 0.0
@pushkarsingh019
pushkarsingh019 / sound.py
Created October 21, 2024 13:15
Creating Sounds with HRTF
import slab
import slab.sound
slab.set_default_samplerate(44100)
hrtf = slab.HRTF.kemar()
white_noise = slab.Sound.whitenoise(duration = 2.0)
white_noise_binaural = slab.Binaural(white_noise)
angle = 80
@pushkarsingh019
pushkarsingh019 / notes.md
Created September 16, 2023 06:19
thinking and reasoning
Why do humans form categories and concepts?

Reasons for Forming Categories and Concepts

  1. Stimulus Generalization: Humans have a natural tendency to generalize and extend learned behavioral responses to a whole class of stimuli. This allows us to categorize things based on similarities and form concepts to recognize the same experiences again.

  2. Efficiency: Categorizing things into concepts reduces the amount of information that needs to be retained about a whole group of things. Concepts serve as behavioral equivalence classes, allowing us to store general information more efficiently than individual representations.

  3. Natural Groupings: The world of objects and things may have regularities, both physical and functional, that naturally lend themselves to categorization. Humans learn about these regularities and form categories based on existing natural boundaries. This idea dates back to ancient Greek philosopher Plato, who suggested that we "cut nature at its joints" whe