MediaPlayer onCompletionListener

June 21st, 2015

Another way to create an endless loop, I’m thinking, is by using the onCompletionListener function which seems very convenient.  I would imagine it’s fantastic for creating a playlist of song by tying it up with an array of songs or a set of pointers to songs in a database.  But since I’m looking to call the same fragment repeatedly, my code ends up being somewhat recursive.

The Background constructor looks like this:

Background(Context con) {
context = con;
mp1 = MediaPlayer.create(context, R.raw.neroli2);
mp1.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.seekTo(0);
mediaPlayer.start();
}
});

Now the call from the UI is even simpler:

public void play() {
mp1.start();

As unbelievably clean as this code is, it still creates a .31 second gap, which wouldn’t be terrible if this was between tracks, but it’s not seamless yet.

I would be remiss if I didn’t give a shout-out to the folks who created IntelliJ platform.  The prototyping for the setOnCompletionListener was awe inspiring.  Type in “new MediaPlayer.OnCompletionListener” and the rest of the framework is automatically inserted into your code.  I’m still in disbelief it’s that smart.  🙂

 

Android MediaPlayer looping issues.

June 19th, 2015

Looping isn’t seamless

I’m finding that some parts of the Android MediaPlayer are perhaps harder to work on.  I’ve been putting some code together to endlessly loop a short 30 second clip for the background of the Bloom project.

The code looks like this:

public class Background {
MediaPlayer mp1;

Background (Context con) {
mp1 = MediaPlayer.create(context, R.raw.soundsample1);
}

Play() {
mp1.setLooping(true);
mp1.start();
}

The simplicity is breathtaking.  Create an instance of a MediaPlayer object in the constructor then when the user presses “play”, start the sound.  Nice.

The only problem is that there is a discernible gap between the end of the plays in the loop.  It’s about 8 hundredths of a second which isn’t much, but it annoys me and that’s all it takes.

Next up – my attempt to fix this through threading.

More later…

Building an Android Bloom

June 19th, 2015

Bloom is a generative music program written for the iPod, iPad and iTouch products.  I think it’s one of the coolest programs available, mostly because I seriously love Eno’s sense of ambient and the options available (Shuffle mood, Evolve when idle, etc).  When I press the screen it plays a note and draws a colored circle which expands while the note plays and fades.  This is similar to the tape-delay system introduced with Discreet Music and used in early versions of Frippertronics.

0619150848

But this app has been available for the Apple for years so it doesn’t appear that the folks who created it have ambitions on the Android platform and other generative music programs just don’t create the environment like Bloom.  So, I’ve decided to try to write it for Android.

Having set this as a challenge to myself, I realize how many years it’s been since I’ve written code but Android development (and any development frankly) has come so far since the days of C++ coding with command line compilers, non-integrated source control and special math libraries, even an old man can put something together.  Maybe.

 

No news is no news

June 12th, 2015

There was a time and it wasn’t so long ago when there was a common courtesy in the hiring process.  When you applied for a position through the medium of e-mail, you received an automatic confirmation return which gave a mild satisfaction of knowing it was received correctly.

That doesn’t happen anymore.

What I’m referring to is a newer and, in my opinion, a ruder form of ignoring a candidate – the callback.

I’m willing to admit that I’m probably not the best candidate for every position as math teacher, tech support or even “human OCR drone.”  But when I’ve done my best to dress professionally, carry copies of my resume, shake hands firmly, answer your questions honestly, take your building tour and meet some of my potential co-workers, the very least you could do is sit down for a minute or two.  Send me an email!

</rant>

For my family

April 19th, 2014

My cousin John traced his heritage back in August 1996. He gave me a copy of his documentation because we share the same grandparents.

I’ve recently purchased a copier-scanner-fax-printer which does a reasonable job of OCR. I’ve scanned a couple of the pages relevant to me and my other cousins. I’ll make the PDFs available on this site as well.

The PDF Links:
George Ceneviva Bio (which is page 5 of the below document ( 68 kb ))
John Joseph Ceneviva Family Tree ( 1 mb )

If History has taught us anything…

October 14th, 2011

If History has taught us anything it’s that we have learned nothing from History.

Opinion

October 9th, 2011

The Obama administration made a huge mis-step by decrying the fees Bank of America and others will be charging for ATM usage.

History
A report from one of the Federal Reserve Bank of Boston showed that credit cards were inflating the price of goods, regardless if payment was in cash or credit. Thereby creating a regressive “tax” on cash buyers. ATM purchases were no mentioned because the structure of ATM fees is different (ATM fees are a flat per transaction charge but credit cards are a percentage of the transaction).
The CFPB (and / or congress) agreed to limit the transaction fees banks could charge on ATM purchases. The banks kicked back with their monthly charge for ATM purchases.
Question
My only question is this: Does the limiting of ATM transaction fees increase the likelihood that banks will increase the number of ATM cards it issues to the lower-middle and lower class, thereby giving them higher availability to lower cost banking services?
Or was this just a “dip the toe in the ‘tax the rich’ ideology” to see how it plays in middle (and middle class) America?
IMHO
The administration decided to bunt to maybe make it to first base instead of “swinging away” for the fence. The banks are in terrible shape and the housing debacle that no one is publicly talking about is really causing problems. The Fed has decided it will print money to get us out of this (same with the ECB). The easing part of the Quantative Easing is to ease ourselves into a higher inflated currency and an overall devaluation of money so that the world’s citizens don’t realize their banks have so much debt and remove their money and sink the economy.

Why I am no longer a Quaker

October 19th, 2010

It started as an echo. Bounced from a distant right-wing talking point from 5 years previous to a source just as capable of intellectual discernment and discretion as a canyon.

The news outlets had flooded us with new details of our water-boarding prisoners at Guantanamo. Prior to that, there were allegations but never an admission from Cheney / Bush that this was true.

A true Quaker rose during meeting for worship to express his grief and outrage and to remind everyone that “there is that of God in everyone.” The echo of Beck rose to alarm us by repeating the specious argument about a ticking time-bomb.

However terrible, this was not sufficient for me to stop considering myself a Quaker.

I raised a concern to the appropriate committee so that someone or some group would speak to the echo and explain that all men are innocent until proven guilty, that water-boarding is torture and we convicted Japanese soldiers of war crimes after WWII.

But they confused themselves with a Unitarian Policy committee where all views are equal weight particularly when they cook every year at the flea market.

To this day, years later, no one has told the echo that he is wrong and gullible. And no one has told the committee that Quaker values mean taking a stand for equality and justice.

A right to privacy?

September 26th, 2010

I was walking along the Delaware River yesterday thinking about an online discussion on Facebook with a high school classmate. Fall on the Canal The subject was “Don’t Ask, Don’t Tell” and as surprised and disappointed as I was that we still have the policy, I was equally surprised and disappointed that people still support it.

And I’m looking at all the freedoms we have in this great country. Freedom of Press where organizations as consistently incorrect as Fox News are allowed to publish their obviously skewed content. Freedom of Religion where any God you wish to believe in must be respected. Freedom to not have to take in soldiers into your house. Freedom to own firearms with quantities and qualities which defy logic at times (do we really need assault weapons?) We can’t be arrested without due cause. We are innocent until proven guilty. We can sue police if they cross certain lines (beatings and the like).

Yet, in the military and in American life in general, we do not have Freedom of Genitals.

We can’t marry who we choose. We can’t get insurance benefits for who we choose. We can’t have our most loved one’s visit us in the hospital. And even though they may not be enforced, laws are on the books concerning which consenting adults we share our most intimate body parts.

When is this mass phobia going to go away? When are we going to disconnect this deserved freedom from pedophilia, bestiality, drug addiction, alcohol abuse and a myriad of other scare tactics used to keep us on the “straight” and narrow?

I just keep waiting for the grown-ups to show up.

Prescription for sex

July 10th, 2010

My back had a serious problem.  The lowest disc had herniated.  I saw an osteopathic doctor who confirmed and had an MRI which was revealing and painful.  Lying perfectly flat with a triangle wedge holding my legs up should never hurt but shooting pains down my legs indicated that I had a very serious problem.

During the pre-operation discussion, complete with signing of waivers and other forms, I explained to the doctor that I really liked jogging to keep my weight down.  But I knew that the impact would not be good for me.  So, I asked him about exercises to keep me fit and not stress the back.

“Biking?” I asked.   “Only if you’re not bent over.  Ride up, like this”, the doctor said with his back straight.  “Swimming?”  He shook his head “no” and said, “too much twisting of the torso.”  I had run out of non-shock exercise so I asked, “Any other suggestions?”

“Sex”  “What?”, I asked but trying to not let him flummox me, “How about the cardio?”  “That depends on who you’re with, doesn’t it?”   I was completely speechless at that point.

Later, after the surgery was considered a success and on discharge from the hospital, the doctor was writing my prescriptions for pain medication when I asked for a special prescription…
sex daily partner of choice