Sine Wave Synthesis Part 5 - MainActivity and Testing

North Border Software

Home Tutorials Hints & Tips About
Share on Facebook Share on Twitter

Android Sine Wave Synthesis

Part 5 - MainActivity and Testing

Preceding tutorials in this series:

Tutorials in that series that follow:

The final programming task in this set of tutorials is to complete the class. There is very little to do here other than create an instance of the PlayWave class and program the toggle button to turn the sound on and off.

Add the following code with the other variables to create an instance if the PlayWave class:

PlayWave wave = new PlayWave();

The only other programming to do is within the onClick method for the toggle button. The frequency is sent to the TextView to display the set frequency. Finally, a boolean variable ‘on’ is declared such that if it is true the sound is started and if it is false the sound is turned off.

On completion, your class should look similar to the one below.

The project is now ready to test. For the next and final tutorial in this series, the project is loaded as an App on an Android device and the fidelity of the wave examined through an oscilloscope. The limits of PCM are also explored.

Download Download the Project files

© 2015 North Border Software All rights reserved
Privacy and Cookies Terms of Use Disclaimer Copyright
North Border Software Logo

Android Apps and Training