Share My Creation Audio example: sensor theramin code

Hi,

Sorry if this is in the wrong place, but the showcase section said I wasn't allowed to start a new thread there.

I wrote a simple program called SensoMin that I thought would make a useful example for some people of how to use the soundpool library and accelerometer to make interesting sounds.

A zip file of the project is attached. Basically the program loads and plays a looped sound sample (pure sine wave of 1kHz). The code also demonstrates how to make sounds of different pitch using the playrate methods, as playing at twice the speed is akin to playng a note at twice the frequency/pitch, etc.

Anyway, I hope it's of use to someone who wants to learn how to code for sound loading/playing and audio manipulation. I've uploaded the apk to GetJar and it should be available soon once reviewed (Page not found). I'll hopefully upload it to the android market soon too.

Best wishes,

Andrew.
 

Attachments

  • sensomin.zip
    107 KB · Views: 1,544
Last edited:

JogiDroid

Member
Licensed User
Longtime User
Hmm, some files are missing, splash.gif and sound files..
 

geocomputing

Member
Licensed User
Longtime User
JogiDroid: Sorry, I thought that making zip files in B4A would mean all files are included. I must be wrong so I made a new zip file to upload.

Erel: Thank you for moving my post. Unfortunately I don't seem to have privileges here to upload my zip file. How can I put my new zip here please?

Best wishes,

Andrew.
 

geocomputing

Member
Licensed User
Longtime User
Hi Erel,

Many thanks for the reply. It seems to be working today. Yesterday after logging in the 'manage attachments' popup window refused to believe I was logged in I think (it seemed to lose my logged in status when moving between threads too, so just a glitch I expect). Thanks for the file tab info too, it's the first time I've made a b4a zip file, so I've learnt something new.

JogiDroid, the full zip file exceeds the forum file upload limit. However, the source code is in the above zip which is the most important thing. The sound samples are just made in audacity by generating a few second tone. Any full screen image file should be OK for the splash and background images.

Best wishes,

Andrew.
 

JogiDroid

Member
Licensed User
Longtime User
Hi Erel,


JogiDroid, the full zip file exceeds the forum file upload limit. However, the source code is in the above zip which is the most important thing. The sound samples are just made in audacity by generating a few second tone. Any full screen image file should be OK for the splash and background images.

Best wishes,

Andrew.

Is there special length of sound that is enough? 1s, 10s, 60s?

Anyway, thanks, I have been thinking to make very similar program.. so yours is good tutorial..
 

geocomputing

Member
Licensed User
Longtime User
Hi JogiDroid,

I'm glad you found it useful. I made the samples three seconds long and mono. That gave a sensible file size and I didn't want them too short in case the looping caused any sound artifacts when going from the start to the end of the sound. I don't think the sample length really matters too much though, as even on my relatively underpowered wildfire I get good continuous sound.

Best wishes,

Andrew.
 
Top