Skip to content

Reverse correlation using linear regression and compressed sensing for uncovering the psychoacoustic tinnitus spectrum

License

Notifications You must be signed in to change notification settings

The-Lammert-Lab/TinnitusReconstructor.jl

Repository files navigation

TinnitusReconstructor

Stable Dev Build Status Coverage ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

This package provides both a range of auditory stimulus generation techniques as well as reverse correlation reconstruction (RC) functions.

The stimulus generation methods are intended to be used in RC experimental paradigms related to reconstructing the internal representations of tinnitus. However, the functionality is generic and may be useful in many other scenarios.

Example usage

Create a stimgen struct using some default and some custom parameters.

using TinnitusReconstructor
stimgen = GaussianPrior(; 
        n_bins=80,
        n_bins_filled_mean=20,
        n_bins_filled_var=0.01,
    )
# GaussianPrior{Float64, Int64}(100.0, 22000.0, 0.5, 44100.0, 0.01, 20, 80)

Load in the target sound and convert to binned representation

using FileIO: load
import LibSndFile
audio_file = "ATA/ATA_Tinnitus_Buzzing_Tone_1sec.wav" # File path.
audio = wav2spect(load(audio_file)) # Read in file, truncate to 0.5s, convert to spectrum.
target_signal = 10 * log10.(audio) # Convert to dB

# Convert to binned representation that matches the number of stimgen bins
binned_target_signal = spect2binnedrepr(stimgen, target_signal) 

Generate 500 random stimuli and simulate ideal responses for each. Then, compute the linear (gs) and compressed sensing (cs) reconstructions and correlate the reconstruction with the binned target signal to determine reconstruction quality.

using Statistics
responses, _, stim = subject_selection_process(stimgen, target_signal, 500)
recon_linear = gs(responses, stim')
recon_cs = cs(responses, stim')
r_linear = cor(recon_linear, binned_target_signal)
r_cs = cor(recon_cs, binned_target_signal)

Citation

@article{Hoyland2023,
	author={Hoyland, Alec and Barnett, Nelson V. and Roop, Benjamin W. and Alexandrou, Danae and Caplan, Myah and Mills, Jacob and Parrell, Benjamin and Chari, Divya A. and Lammert, Adam C.},
	journal={IEEE Open Journal of Engineering in Medicine and Biology}, 
	title={Reverse Correlation Uncovers More Complete Tinnitus Spectra}, 
	year={2023},
	volume={4},
	number={},
	pages={116-118},
	doi={10.1109/OJEMB.2023.3275051}
}