The Cracked Bassoon

Sam Mathias

I'm a psychoacoustician. I mainly post code for making interesting sounds.

3. July 2014 330 words ~3 minutes read 2 Comments

Speech-shaped noise

Speech-shaped noise (SSN) is noise whose long-term average spectrum is similar to that of speech. It is primarily used as a masker in studies of speech perception (e.g., Nelson et al., 2003; Qin & Oxenham, 2003). Recently, I had to generate some SSN in python. After some googling, it seemed that the most straightforward approach was to create white noise, then filter it using the FFT of a speech signal. Here is the code snippet I used to create the SSN:

The script requires two additional files to run. The first is mix.wav, a mixture of a few hundred German sentences spoken by several different male speakers. The second is fftfilt.py. To avoid edge effects caused by the filtering, I created a long SSN waveform then chopped it to the desired duration. The spectrogram of the resulting SSN looks pretty good:

ssn_spectrogram

 

Next I compared the long-term spectrum of the SSN to that of the speech mixture:

spectra

 

As you can see, the two spectra are not identical. It looks like the SSN spectrum is offset by a constant amount relative to the mixture spectrum. To test this, I computed the difference in amplitude between the two spectra across frequencies:

ampdiff

This function is noisy, indicating that the spectra are not an exact match. However, it appears to be roughly flat, on average, across frequencies, which is what we want. You can listen to this particular SSN sample below:


References

Banner image is Number 1 (Lavender Mist) by Jackson Pollock.

2 Comments

  1. Elaine

    Hi,

    I'm trying to create SSN file. I'm new to python but have some basic programming experience. I'm wondering what the biran, numpy and hears files are?

    Thanks,

    Elaine

    • smathias

      Those are packages. Depending on the installation of Python you are using, you may already have NumPy and pip, in which case brian can be installed using `pip install brian`. If this didn't make any sense to you, I recommend reading some of the basic python tutorials here. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *