Main Menu

search

You are here

SDR: tutorial2

[last updated: 2019-06-14]
go to: Java
go to: SDR Study
go to: SDR - Tutorial3
-----

  • Install Audacity:
    • (link to:) Audacity
    • As always before making changes:
      $ sudo apt-get update
      $ sudo apt-get dist-upgrade
    • $ sudo apt-get install audacity
    • Open Audacity from Menu > Sound & Video > Audacity
  • record a cough, save it (File > Export Audio...) as a Wav file
  • Copy github directories and files from SDR-master to SDR/src/tutorial2
    Make parallel directories in SDR/bin/tutorial2
  • First Audacity tests:
    • In g0KLA, he mentions processing data from a stereo recording.
      In my first sound sample I selected mono recording. I anticipate this will be a problem, but will leave it for now.
    • The first test will execute Tut2Main1
      which is located in tutorial2 directory.
      Renamed cough wav file: test_sound.wav
      which is what Tut2Main1 will be looking for.
      Compiled successfully.
    • To execute it:
      Tut2Main1.class is located in src/tutorial2 directory
      test_sound.wav is located in src directory
      $ java tutorial2.Tut2Main1 is executed from src directory
    • Execution successful.
      Status returned - Format: PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, little endian
      Data points that were generated were cut and pasted into spreadsheet.
    • The plot is too complicated to compare to the waveform displayed in Audacity. OTOH, the next step of the processing relies on the data being stereo, with 4 bytes of data per frame, so I will abandon this sound test and re-record in stereo before proceeding.
  • Second Audacity test -
    Visualize the Audio:
    • Created new directory in src named soundFiles and moved test_sound.wav into it.
      Edited Tut2Main1.java so that new WavFile gets: "soundFiles/test_sound.wav"
      Re-compiled and executed successfully.
    • Renamed original recording from test_sound.wav to test_sound01.wav
    • Set Audacity to record in stereo, and recorded another cough. Shortened to 0.2 sec, then
      saved as test_sound02,wav in src/soundFiles directory.
    • Copied test_sound02.wav to test_sound.wav to execute,
    • $ java tutorial2.Tut2Main1 executed successfully from src directory
      Format: PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian
    • Cut and pasted data from monitor to spreadsheet.
  • LineChart test tool:
    • This executes Tut2Main2
      which uses MainWindow,
      which uses LineChart
    • Tut2Main2 must be edited with my custom test sound directory location
      Number of samples must also be edited to match the size of the test_sound file.
      Default in g0kla code was 1500, but my sound sample is larger, so I used 1700.
    • From g0kla: "Does our Line Chart work? ... write a short main method ... "
      He does not say in the tutorial what file this is, but in fact it is:
      Tut2Main2. This is the file that will be executed to test the LineChart.
    • compiled successfully, moved up to src directory and executed:
      $ java tutorial2.Tut2Main2
      and it worked!! Plotted line chart window!
      OTOH, the terminal window did not give prompt back, suggesting the process did not terminate.
      Closing the display window terminated the terminal process.
      Did ctrl-z did the same but left the display window displayed.
  • Read from the soundcard:
    • Plot directly in LineChart? An exercise left to the student...
    • Use FFT from tutorial1 and plot in LineChart:
      • This will use Tut2Main3
        (again this fact is not statetd explicitly in the g0kla tutorial...)
      • This program has a line to select the sound source.
        There are two alternative lines, only one of which will be used.
        One is "WavFile soundcard ..." to select the file captured from Audacity,
        and the other is "SoundCard soundcard ... " to use the sound card in the laptop.
        The one not used will be commented out ("//") before compiling and executing.
      • There is a bunch of stuff in the tutorial that is mostly incomprehensible to me, but ...
        with SoundCard source line selected, I compiled and executed Tut2Main3,
        and it worked!!! It gave me a real time Line Chart showing whatever it was hearing from the laptop microphone.
      • At this point the tutorial kind of jumps ahead without details, and talks about putting a signal from an HF receiver into the laptop soundcard port via a stereo audio cable (into microphone jack??).
        In any case, not having such a source, I'll be skipping this part for now...
      • OTOH there are several things he suggests trying:
        Edit "int averageNum = 10;" to "change the amount of averaging."
        Edit "int len = 256;" to "change the length of the FFT."
        He also notes that playing the WavFile will "... rattle through at top speed ...",
        with suggested edit to prevent that.
  • This concludes tutorial2
    Proceed to: tutorial3

.

.

.

eof