Sensor Fun: Creating a simple audio recorder/player

Sound recording and playback is really simple using the MediaRecorder and MediaPlayer classes .. see the example below .. Sample App First some layout .. a button to start/stop recording and a button to play the recorded stuff (main.xml): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/output" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" /> <Button android:text="@+string/record" android:id="@+id/btRecord" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="@+string/play" android:id="@+id/btPlay" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> </LinearLayout> Adjusting the externalized strings in the strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Soundrecorder Tutorial</string> <string name="record">Record!</string> <string name="play">Play</string> </resources> ...

May 2, 2010 · 4 min · 766 words · Micha Kops

Linux Snippets

These are not only linux snippets but also bash snippets and snippets using tools that run under Linux, *nix or sometimes even MacOSX, I should reorder this article someday ;) Settings for more reliable bash scripts set -euo pipefail this gives us …​ -e: exit script if a single command fails -u: exit script if an unset variable is used -o pipefail: return value of a pipeline is the status of the last command to exit with a non-zero status, or zero if no command exited with a non-zero status ...

March 1, 2010 · 15 min · 3058 words · Micha Kops