0

I read a 48khz, 16bit precision PCM speech data using wav read functionality of scipy.signal.

Next, I perform these steps in order : decimation -> normalisation

Decimation and normalisation is done using the following steps :

yiir = scipy.signal.decimate(topRightChn, 3)
timeSerDownSmpldSig = N.array(yiir)
factor  = 2**16
normtimeSerDownSmpldSig = normalise(timeSerDownSmpldSig, factor)

My decimated(or downsampled) signal is supposed to be 16khz( Hence, the downsampling factor of 3 as above). Now, I want to view the normalised downsampled numpy array normtimeSerDownSmpldSig in Adobe Audition.

What steps in Python and/or Adobe audition do I need to perform? How can I use the savetxt function of scipy to view the above array in Adobe Audition ?

My yiir signal values look like following :

Downsampled signal yiir First 10 values: [ -6.95990948e-05  -2.71091920e-02  -3.
76441923e-01  -5.65301893e-01
   1.59163252e-01  -2.44745081e+00  -4.11047340e+00  -2.81722036e+00
  -1.89322873e+00  -2.51526839e+00]

Downsampled signal yiir: Last ten values: [-1.73357094 -3.41704894 -2.77903517
0.87867336 -2.00060527 -2.63675154
 -5.93578443 -5.70939184 -3.68355598 -4.29757849]


Array signal obtained from iir decimate of python:
shape: (6400000,)
Type: <class 'numpy.dtype'>
dtype: float64
Rows : 6400000
min, max: -875.162306537 874.341374084

Information for usage on Adobe audition ### at this link (page45) -

http://www.newhopechurch.ca/docs/tech/AUDITION.pdf

gives out the following :

ASCII Text Data (.txt) Audio data can be read to or written from files in a standard text format, >with each sample separated by a carriage return, and channels separated by a tab character. An optional header can be placed >before the data. If there is no header text, then the data is assumed to be 16-bit signed decimal integers. The header is formatted as KEYWORD: value with the keywords being: SAMPLES, BITSPERSAMPLE, CHANNELS, SAMPLERATE, and NORMALIZED. >The values for NORMALIZED are either TRUE or FALSE. For example, SAMPLES: 1582 BITSPERSAMPLE: 16 CHANNELS: 2 SAMPLERATE: 22050 NORMALIZED: FALSE 164 -1372 492 -876 etc... Options Choose any of the following: •Include Format Header places a header before the data. •Normalized Data normalizes the data between -1.0 and 1.0.

tauseef_CuriousGuy
  • 770
  • 1
  • 12
  • 28
  • The title says "ascii text readable in adobe audition", but then you say "view the above as a wav file". Which format does Adobe Audition require, text or WAV? – Warren Weckesser Jun 13 '16 at 16:18
  • Based on a comment in an answer, it looks like the essence of the question is "How do I write a numpy array to the specific text file format that is used by Adobe Audtion". Is that correct? – Warren Weckesser Jun 13 '16 at 16:25
  • I want Adobe Audition to take the ASCII text file (containing numpy array of my downsampled signal values) as input. – tauseef_CuriousGuy Jun 13 '16 at 16:26
  • Then you'll need to specify the format of the text file that is required by Adobe Audtion, or give a link to the specification. As this is StackOverflow, you should probably also take a shot at writing some code in this format. Otherwise the question looks like one of those "give me teh codez" requests. – Warren Weckesser Jun 13 '16 at 16:28
  • @WarrenWeckesser Indeed, the essence of the question is what you wrote. – tauseef_CuriousGuy Jun 13 '16 at 16:54

1 Answers1

0

numpy.savetxt does not create WAV files. You can use scipy.io.wavfile.write.

For example, the following creates a WAV file containing a single channel (monophonic). The signal is 3 seconds of a 440 Hz sine wave sampled at 44100 samples per second.

In [18]: from scipy.io import wavfile

In [19]: fs = 44100

In [20]: T = 3.0

In [21]: t = np.linspace(0, 3, T*fs, endpoint=False)

In [22]: y = np.sin(2*pi*440*t)

In [23]: wavfile.write("sine440.wav", fs, y)

Another alternative is wavio.

Warren Weckesser
  • 110,654
  • 19
  • 194
  • 214