Plotting wav file

M

Maggie

What would be the best way to plot a small .wav file in python? If
there are any tutorials or sample code, I would really appreciate it!
 
R

Rami Chowdhury

What would be the best way to plot a small .wav file in python? If
there are any tutorials or sample code, I would really appreciate it!

I'm sorry, what are you hoping to plot about the .wav file?
 
M

Maggie

I'm sorry, what are you hoping to plot about the .wav file?

--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)

..wav file was generated from .1D file that contained times of
occurrence of a stimulus within the experiment. The y-axis is the TR
and the x-axis is supposed to be the length of y. I am hoping to see
plot representation of .wav file so i can align it to time series fMRI
data via independent component analysis.
this is the sample .1D file that was converted into the .wav file --

2.625:2.855 46.125:46.355 92.125:92.355 150.125:150.355
179.125:179.355 239.625:239.855 304.75:304.98 321.75:321.98
382.25:382.48 396.75:396.98 408.75:408.98 515.25:515.48
549.375:549.605 609.875:610.105 621.875:622.105 691.875:692.105
740.375:740.605 752.375:752.605 825:825.23 851.5:851.73 866:866.23
955.5:955.73 984.5:984.73 1042.5:1042.73 1071.625:1071.855
1115.125:1115.355 1158.625:1158.855 1221.625:1221.855
1248.125:1248.355 1274.625:1274.855 1374.25:1374.48 1398.25:1398.48
1427.25:1427.48 1500.25:1500.48 1529.25:1529.48 1558.25:1558.48
1611.375:1611.605 1666.875:1667.105 1698.375:1698.605
1715.375:1715.605 1773.375:1773.605 1833.875:1834.105 1848.5:1848.73
1947.5:1947.73 1964.5:1964.73 1981.5:1981.73 1996:1996.23
2085.5:2085.73 2114.625:2114.855 2126.625:2126.855 2138.625:2138.855
2288.625:2288.855 2317.625:2317.855 2334.625:2334.855 2387.75:2387.98
2421.75:2421.98 2433.75:2433.98 2518.25:2518.48 2549.75:2549.98
2564.25:2564.48

thanks
 
R

Rami Chowdhury

.wav file was generated from .1D file that contained times of
occurrence of a stimulus within the experiment. The y-axis is the TR
and the x-axis is supposed to be the length of y. I am hoping to see
plot representation of .wav file so i can align it to time series fMRI
data via independent component analysis.
this is the sample .1D file that was converted into the .wav file --

2.625:2.855 46.125:46.355 92.125:92.355 150.125:150.355
179.125:179.355 239.625:239.855 304.75:304.98 321.75:321.98
382.25:382.48 396.75:396.98 408.75:408.98 515.25:515.48
549.375:549.605 609.875:610.105 621.875:622.105 691.875:692.105
740.375:740.605 752.375:752.605 825:825.23 851.5:851.73 866:866.23
955.5:955.73 984.5:984.73 1042.5:1042.73 1071.625:1071.855
1115.125:1115.355 1158.625:1158.855 1221.625:1221.855
1248.125:1248.355 1274.625:1274.855 1374.25:1374.48 1398.25:1398.48
1427.25:1427.48 1500.25:1500.48 1529.25:1529.48 1558.25:1558.48
1611.375:1611.605 1666.875:1667.105 1698.375:1698.605
1715.375:1715.605 1773.375:1773.605 1833.875:1834.105 1848.5:1848.73
1947.5:1947.73 1964.5:1964.73 1981.5:1981.73 1996:1996.23
2085.5:2085.73 2114.625:2114.855 2126.625:2126.855 2138.625:2138.855
2288.625:2288.855 2317.625:2317.855 2334.625:2334.855 2387.75:2387.98
2421.75:2421.98 2433.75:2433.98 2518.25:2518.48 2549.75:2549.98
2564.25:2564.48

Ah, thank you for the clarification. When I've seen the '.wav' suffix
used, it's usually indicated an audio file -- hence my confusion. I don't
know the first thing about neuro-imaging, but a quick search revealed a
few things. I presume you're using a program like
http://cnl.web.arizona.edu/waver.htm to generate your .wav file?
 
R

Rami Chowdhury

I am by far more acquainted with R and generally would use it in this
case, however, this particular experiment does require a lot of AFNI
work, therefore I am a bit lost.
the .wav was generated via --

waver -WAV -TR 2.5 -tstim `cat a_STD_W.1D` > a_STD_W.WAV

Could you post a small snippet of the .wav file itself? My understanding
is that it's simply a column of numbers, in which case it should be fairly
simple to plot them.
 
R

Rami Chowdhury

Could you post a small snippet of the .wav file itself? My
understanding is
that it's simply a column of numbers, in which case it should be fairly
simple to plot them.
[/QUOTE]

You're correct! This is the beginning of the .wav file.

0
0
0.19385
6.79566
7.62695
1.91679
-1.71133 [snip]
and so on..

That seems fairly straightforward -- assuming the .wav file is small
enough, I'd suggest simply reading the values into a list, and then using
one of the many Python plotting packages
(http://wiki.python.org/moin/NumericAndScientific/Plotting) to graph them
however you need. If you're familiar with R, I might suggest using RPy
(http://rpy.sourceforge.net/rpy.html), although I've not used it myself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top