-
Notifications
You must be signed in to change notification settings - Fork 3
Copying Audio and Classes and Autorunning Actions
You can put audio devices wherever you like on your device and read them into your HappyBrackets program using the SampleManager. However, the default place for storing audio on your device is ~/HappyBrackets/data/audio/.
From your host computer, using the terminal, copy audio to your device as follows:
scp path/to/audio_file.wav pi@device_name.local:~/HappyBrackets/data/audio/
or to copy an entire folder of audio:
scp path/to/audio_folder pi@device_name.local:~/HappyBrackets/data/audio/
The user name here is ‘pi’, which is default for a Raspberry Pi, but may be different for your system. The device name used by HappyBrackets is of the form ‘hb-abcdef01234’ where the string after the hyphen is the device’s WiFi MAC address, with the usual colons removed. HappyBrackets auto-renames the device to this name.
Following this, you will need to perform a sync to ensure the audio is completely written to the SD-Card on the PI. If you fail to do this, your SD-Card can become corrupt if you power off the device, requiring you to re-install the entire PI System from an image. You will need to SSH into the device and type the command ‘sync’.
A convenience scripts has been created that enable you to send audio to your PI from your computer and perform the sync command to avoid the possible SD-Card corruption. To send audio to your PI you can use the send-audio.sh
script. Run the script, and you will be prompted for the parameters to add.
Another convenience script to retrieve audio from your PI is get-audio.sh
.
To read samples into HappyBrackets from your sketch, use the SampleManager:
SampleManager.sample(“mysound”, “data/audio/audio_file.wav”);
Wav, aiff, most mp3 files and some other compressed audio formats are supported.
You can put class files onto the Pi which will then be loaded by HappyBrackets upon a reboot. Copy all class files to ~/HappyBrackets/data/classes as per the instructions for copying audio files. Note that you MUST place files in the correct Java package structure for them to be read properly. For example, if your class MyClass has the package declaration
package com.mydomain.myproject;
Then it should be located at ~/HappyBrackets/data/classes/com/mydomain/myproject/MyClass.class.
Your compiler should have exported your files this way anyway.
The run script is located at ~/HappyBrackets/scripts/run.sh. You will find a number of audio parameters that can be modified in the script. A reboot is required before any parameter changes will come into effect.
If you want to have HappyBrackets autorun an HBAction class then make sure that class is included in data/classes (see “copying classes to the device”), then find the line ACTION= in the script and add the full Java name of your class, including the package address. e.g.,
ACTION=com.mypackage.myproject.MyClass
User Area: If you are using HappyBrackets to do stuff.
- Getting Started
- What's in the Developer Kit Download
- Basic hardware requirements for using HappyBrackets
- Troubleshooting
- User FAQ
Further Topics:
- Logging into the device via SSH
- Using the HB Class
- Sending HB Actions
- Using the HappyBrackets IntelliJ Plugin
- Configuring HappyBrackets
- Copying Audio and Classes and Autorunning Actions
Developer Area: If you are developing or hacking HappyBrackets under the hood.