Utility Functions

TinnitusReconstructor.subject_selection_processMethod
subject_selection_process(stimuli_matrix::AbstractVecOrMat{T}, target_signal::AbstractVector{T}) where {T<:Real}

Perform the synthetic subject decision process, given a matrix of precomputed stimuli stimuli_matrix and a target_signal. The stimuli_matrix is of size m x n where m is the number of trials and n is the number of samples in the signal. The target_signal is a flat vector of size n or an n x 1 matrix. Return the n-dimensional response vector y as well as the stimuli_matrix as well as nothing for the binned representation.

source
TinnitusReconstructor.gsFunction
gs(responses, Φ)

Linear reverse correlation.

References

  • Gosselin, F. and Schyns, P.G., 2003. Superstitious perceptions reveal properties of internal representations. Psychological science, 14(5), pp.505-509.
source
TinnitusReconstructor.csFunction
cs(responses, Φ, Γ::Integer=32)

One-bit compressed sensing reverse correlation with basis.

References

  • Plan, Y. and Vershynin, R., 2012. Robust 1-bit compressed sensing and sparse logistic regression: A convex programming approach. IEEE Transactions on Information Theory, 59(1), pp.482-494.

  • Zhang, L., Yi, J. and Jin, R., 2014, June. Efficient algorithms for robust one-bit compressive sensing. In International Conference on Machine Learning (pp. 820-828). PMLR.

source
TinnitusReconstructor.zhangpassivegammaFunction
zhangpassivegamma(Φ::AbstractArray{T}, y, Γ::Integer) where {T<:Real}

Passive algorithm for 1-bit compressed sensing with no basis.

References

  • Zhang, L., Yi, J. and Jin, R., 2014, June. Efficient algorithms for robust one-bit compressive sensing. In International Conference on Machine Learning (pp. 820-828). PMLR.
source

Audio manipulation

TinnitusReconstructor.synthesize_audioFunction
synthesize_audio(spect::AbstractVecOrMat, nfft::Integer)

Synthesize audio from a frequency spectrum spect using a number of FFT points nfft.

Arguments

  • spect::AbstractVecOrMat: frequency spectrum
  • nfft::Integer: number of FFT points
source
TinnitusReconstructor.wav2spectFunction

Crops a signal from 0:duration, where duration is in seconds, computes the short-time Fourier transform, converts to decibels, and then averages across STFT windows.

Arguments

  • audio::Union{AbstractSampleBuf, Matrix}
  • duration::Real: duration in seconds

Example Usage

audio = load(audio_file_path)
spect = wav2spect(audio; duration = 1.0)
source
TinnitusReconstructor.dBFunction
dB(x)

Convert from amplitude-scale to decibel-scale via

$\mathrm{dB}(x) = 10 \mathrm{log10}(x)$

Examples

```jldoctest

julia> TinnitusReconstructor.dB.([1, 2, 100]) 3-element Vector{Float64}: 0.0 3.010299956639812 20.0 ````

See also

source
TinnitusReconstructor.invdBFunction
invdB(x)

Convert from decibel-scale to amplitude-scale via

$\mathrm{invdB}(x) = 10^{x/10}$

Examples

julia> TinnitusReconstructor.invdB.([-100, 0, 1, 2, 100])
5-element Vector{Float64}:
 1.0e-10
 1.0
 1.2589254117941673
 1.5848931924611136
 1.0e10

See also

source