<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Thu May 23, 2013 11:05 am by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Thu May 23, 2013 11:05 am</pubDate>
  <lastBuildDate>Thu May 23, 2013 11:05 am</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: As an addendum to my Python freebie code below...</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94525#94525</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=58561'&gt;Bazza&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 06, 2010 7:58 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      They are not needed, and........&lt;br /&gt;
&lt;br /&gt;
I quirk of mine...&lt;br /&gt;
&lt;br /&gt;
I always make sure that......&lt;br /&gt;
&lt;br /&gt;
import os&lt;br /&gt;
import sys&lt;br /&gt;
&lt;br /&gt;
......are ready for my usage to remind me and are commented&lt;br /&gt;
out for this reason. They are the first two lines of a standard&lt;br /&gt;
page that I use when coding.&lt;br /&gt;
&lt;br /&gt;
In this case I will be using this idea to get &amp;quot;real time&amp;quot; data&lt;br /&gt;
from audio input for an audio oscilloscope, (playing back is&lt;br /&gt;
unimportant to me ATM).&lt;br /&gt;
&lt;br /&gt;
How I display this on screen using text mode will be uploaded&lt;br /&gt;
too when I have worked out the method.&lt;br /&gt;
&lt;br /&gt;
IF those two imports are required for these two events then&lt;br /&gt;
they are there so that I don`t forget.&lt;br /&gt;
&lt;br /&gt;
They are probably the two most important imports that I use.</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94525#94525</comments>
                                        <author>Bazza</author>
                                        <pubDate>Sat Nov 06, 2010 7:58 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94525#94525</guid>
                                      </item>
                                      <item>
                                        <title>Re: As an addendum to my Python freebie code below...</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=94522#94522</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=66746'&gt;ScannerDarkly&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sat Nov 06, 2010 1:18 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Why are the import lines 2-3 commented out?</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=94522#94522</comments>
                                        <author>ScannerDarkly</author>
                                        <pubDate>Sat Nov 06, 2010 1:18 am</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=94522#94522</guid>
                                      </item>
                                      <item>
                                        <title>As an addendum to my Python freebie code below...</title>
                                        <link>http://linuxformat.com/forums/viewtopic.php?p=93480#93480</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=58561'&gt;Bazza&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Fri Oct 01, 2010 8:25 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi all...&lt;br /&gt;
&lt;br /&gt;
I mentioned at the end if it was possible to create a real time&lt;br /&gt;
audio oscilloscope and the answer seems to be YES. WOW!!!&lt;br /&gt;
&lt;br /&gt;
Now I would like some help from the Linux geeks on here...&lt;br /&gt;
&lt;br /&gt;
The code below is STANDARD Python, (2.5.2), and records&lt;br /&gt;
sound from the mic input at the moment.&lt;br /&gt;
&lt;br /&gt;
Only a default Python install is required - no special&lt;br /&gt;
dependancies.&lt;br /&gt;
&lt;br /&gt;
It takes about 8 seconds to record then after that it&lt;br /&gt;
immediately plays back the recording.&lt;br /&gt;
&lt;br /&gt;
Would you give it a test. You might need to raise your&lt;br /&gt;
voice into the mic but hey that is no big deal.&lt;br /&gt;
&lt;br /&gt;
Name the code below as record.py and save in the Python`s Lib drawer. As soon as you &amp;quot;import record[RETURN/ENTER]&amp;quot;&lt;br /&gt;
talk loudly into the mic for about 8 seconds or so.&lt;br /&gt;
&lt;br /&gt;
So please humour me and give it a test as I could make&lt;br /&gt;
a calibrated audioscope from it. Reply back on here...&lt;br /&gt;
&lt;br /&gt;
ENSURE that the sound card is NOT in use by another&lt;br /&gt;
application.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;# Test code for record and playback.&lt;br /&gt;
# import sys&lt;br /&gt;
# import os&lt;br /&gt;
def main&amp;#40;&amp;#41;&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; global record&lt;br /&gt;
&amp;nbsp; &amp;nbsp; record=&amp;quot;&amp;quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # Record from my laptop`s mic.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # Note sample rate unknown at the moment, &amp;#40;8KHz?&amp;#41;.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # Shout into the mic` for test purposes.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; audio=file&amp;#40;'/dev/audio', 'rb'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; record=audio.read&amp;#40;65536&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; audio.close&amp;#40;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # Playback from the sound card.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; audio=file&amp;#40;'/dev/audio', 'wb'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; audio.write&amp;#40;record&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; audio.close&amp;#40;&amp;#41;&lt;br /&gt;
main&amp;#40;&amp;#41;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
TIA...&lt;br /&gt;
&lt;br /&gt;
EDIT:&lt;br /&gt;
&lt;br /&gt;
I forgot to add:-&lt;br /&gt;
&lt;br /&gt;
If it doesn`t seem to work properly after &amp;quot;import&amp;quot;(ing) rerun&lt;br /&gt;
the code as &amp;quot;record.main()[RETURN/ENTER]&amp;quot; and all will be&lt;br /&gt;
well. I forgot that it can take a little time for the &amp;quot;pyc&amp;quot; bytecode to be generated on the VERY first attempt...</description>
                                        <comments>http://linuxformat.com/forums/viewtopic.php?p=93480#93480</comments>
                                        <author>Bazza</author>
                                        <pubDate>Fri Oct 01, 2010 8:25 pm</pubDate>
                                        <guid isPermaLink="true">http://linuxformat.com/forums/viewtopic.php?p=93480#93480</guid>
                                      </item></channel></rss>