How to Control Your Computer With Sonar
by gigafide in Circuits > Audio
4749 Views, 13 Favorites, 0 Comments
How to Control Your Computer With Sonar

What Is Sonar?
![226_sonar_alt.mp4_snapshot_00.30_[2010.06.24_00.58.28].jpg](/proxy/?url=https://content.instructables.com/FQL/V0RM/GAPURMZH/FQLV0RMGAPURMZH.jpg&filename=226_sonar_alt.mp4_snapshot_00.30_[2010.06.24_00.58.28].jpg)
Putting Sonar on Your PC
![226_sonar_alt.mp4_snapshot_00.41_[2010.06.24_01.00.06].jpg](/proxy/?url=https://content.instructables.com/FUX/P3DR/GAPV335V/FUXP3DRGAPV335V.jpg&filename=226_sonar_alt.mp4_snapshot_00.41_[2010.06.24_01.00.06].jpg)
![226_sonar_alt.mp4_snapshot_00.46_[2010.06.24_01.02.48].jpg](/proxy/?url=https://content.instructables.com/FGA/D533/GARZ1FYI/FGAD533GARZ1FYI.jpg&filename=226_sonar_alt.mp4_snapshot_00.46_[2010.06.24_01.02.48].jpg)
![226_sonar_alt.mp4_snapshot_00.49_[2010.06.24_01.03.08].jpg](/proxy/?url=https://content.instructables.com/FI2/7OZG/GAPURN05/FI27OZGGAPURN05.jpg&filename=226_sonar_alt.mp4_snapshot_00.49_[2010.06.24_01.03.08].jpg)
![226_sonar_alt.mp4_snapshot_00.51_[2010.06.24_01.03.40].jpg](/proxy/?url=https://content.instructables.com/F93/WAX6/GAPURN06/F93WAX6GAPURN06.jpg&filename=226_sonar_alt.mp4_snapshot_00.51_[2010.06.24_01.03.40].jpg)
How to Edit the Source Code
![226_sonar_alt.mp4_snapshot_01.03_[2010.06.24_01.12.52].jpg](/proxy/?url=https://content.instructables.com/F25/V8AL/GAPV336L/F25V8ALGAPV336L.jpg&filename=226_sonar_alt.mp4_snapshot_01.03_[2010.06.24_01.12.52].jpg)
![226_sonar_alt.mp4_snapshot_01.17_[2010.06.24_01.13.12].jpg](/proxy/?url=https://content.instructables.com/F5D/RHAJ/GAPURN0U/F5DRHAJGAPURN0U.jpg&filename=226_sonar_alt.mp4_snapshot_01.17_[2010.06.24_01.13.12].jpg)
![226_sonar_alt.mp4_snapshot_01.26_[2010.06.24_01.13.31].jpg](/proxy/?url=https://content.instructables.com/FM0/W8RQ/GAPV7VZC/FM0W8RQGAPV7VZC.jpg&filename=226_sonar_alt.mp4_snapshot_01.26_[2010.06.24_01.13.31].jpg)
![226_sonar_alt.mp4_snapshot_01.30_[2010.06.24_01.13.40].jpg](/proxy/?url=https://content.instructables.com/F38/TMST/GAPURN0V/F38TMSTGAPURN0V.jpg&filename=226_sonar_alt.mp4_snapshot_01.30_[2010.06.24_01.13.40].jpg)
![226_sonar_alt.mp4_snapshot_01.36_[2010.06.24_01.13.58].jpg](/proxy/?url=https://content.instructables.com/FTT/ILLK/GAPV7VZE/FTTILLKGAPV7VZE.jpg&filename=226_sonar_alt.mp4_snapshot_01.36_[2010.06.24_01.13.58].jpg)
In order to edit and compile it, you'll need a few things first:
- Begin by downloading Visual C++ Express 2008, which Microsoft offers for free.
- Then you also want to download and install wxWidgets version 2.8.10.
- Lastly, you'll need to download PortAudio and extract it to your "sonar_dist" folder using 7zip.
Cleaning the Source Code
![226_sonar_alt.mp4_snapshot_01.43_[2010.06.24_01.17.22].jpg](/proxy/?url=https://content.instructables.com/F3D/VXY9/GAPV336R/F3DVXY9GAPV336R.jpg&filename=226_sonar_alt.mp4_snapshot_01.43_[2010.06.24_01.17.22].jpg)
![226_sonar_alt.mp4_snapshot_01.46_[2010.06.24_01.17.39].jpg](/proxy/?url=https://content.instructables.com/F0B/1NNF/GAPV336S/F0B1NNFGAPV336S.jpg&filename=226_sonar_alt.mp4_snapshot_01.46_[2010.06.24_01.17.39].jpg)
![226_sonar_alt.mp4_snapshot_01.47_[2010.06.24_01.17.45].jpg](/proxy/?url=https://content.instructables.com/FN0/MTHE/GAPURN14/FN0MTHEGAPURN14.jpg&filename=226_sonar_alt.mp4_snapshot_01.47_[2010.06.24_01.17.45].jpg)
![226_sonar_alt.mp4_snapshot_01.48_[2010.06.24_01.17.57].jpg](/proxy/?url=https://content.instructables.com/FXG/GTDN/GARZ1G16/FXGGTDNGARZ1G16.jpg&filename=226_sonar_alt.mp4_snapshot_01.48_[2010.06.24_01.17.57].jpg)
![226_sonar_alt.mp4_snapshot_02.01_[2010.06.24_01.18.38].jpg](/proxy/?url=https://content.instructables.com/FUP/HUZ8/GARZ1G1I/FUPHUZ8GARZ1G1I.jpg&filename=226_sonar_alt.mp4_snapshot_02.01_[2010.06.24_01.18.38].jpg)
Editing the Source Code
![226_sonar_alt.mp4_snapshot_02.11_[2010.06.24_01.19.16].jpg](/proxy/?url=https://content.instructables.com/F3F/52UI/GAPV337M/F3F52UIGAPV337M.jpg&filename=226_sonar_alt.mp4_snapshot_02.11_[2010.06.24_01.19.16].jpg)
![226_sonar_alt.mp4_snapshot_02.19_[2010.06.24_01.22.47].jpg](/proxy/?url=https://content.instructables.com/F0H/OV32/GAPURN18/F0HOV32GAPURN18.jpg&filename=226_sonar_alt.mp4_snapshot_02.19_[2010.06.24_01.22.47].jpg)
![226_sonar_alt.mp4_snapshot_02.25_[2010.06.24_01.23.00].jpg](/proxy/?url=https://content.instructables.com/F9Z/YO31/GARZ1G23/F9ZYO31GARZ1G23.jpg&filename=226_sonar_alt.mp4_snapshot_02.25_[2010.06.24_01.23.00].jpg)
![226_sonar_alt.mp4_snapshot_02.34_[2010.06.24_01.23.20].jpg](/proxy/?url=https://content.instructables.com/F2N/AXPT/GAPV7VZM/F2NAXPTGAPV7VZM.jpg&filename=226_sonar_alt.mp4_snapshot_02.34_[2010.06.24_01.23.20].jpg)
![226_sonar_alt.mp4_snapshot_02.42_[2010.06.24_01.25.34].jpg](/proxy/?url=https://content.instructables.com/FXO/C095/GAPURN19/FXOC095GAPURN19.jpg&filename=226_sonar_alt.mp4_snapshot_02.42_[2010.06.24_01.25.34].jpg)
Now go into your "sonar_dist" folder and double click on "sonar.vcproj". You should be able to click on the debug button to launch the sonar program. So now if you want to change what the program does, you can double click on "SysInterface.cpp" and under the "sleep_monitor/platform windows" boolean, you can change the PostMessage to any other c++ command you want. For instance, this command will open up the CD tray:
mciSendString('set CDAudio door open", NULL, 0, NULL);
and this command will open up a website:
ShellExecute(NULL, "open", "http://www.tinkernut.com", NULL, NULL, SW_SHOWNORMAL);
You can view the video above for what the examples look like. Have fun experimenting with this one!