mardi 17 février 2015

pauses during song playback in Raspberry Pi

I'm programing a playlist player in python using spotify and is running in Raspberry Pi. Everything is great just the songs have pauses during the playback. I done everything, update, check de ALSA driver, the code, I overclocking the raspberry, change the output between analog/HDMI, prefetch the song, but just still having pauses.


What am I doing wrong?



def player(session):

end_of_track = threading.Event()
global volume_effect

track = tracks[0]

def on_end_of_track(self):
end_of_track.set()

session.on(spotify.SessionEvent.END_OF_TRACK, on_end_of_track)
logger.info('End Track Event On')

session.player.prefetch(track)
session.player.load(track)
session.player.play()

logger.info('Playing: %r and %r', track.name, track.duration)

tracks.rotate(1)

logger.info('Next Song: %r', tracks[0].name)

if volume_effect == False:
for v in range(volume_min, volume_max, 5):
mixer.setvolume(int(v))
time.sleep(2)

volume_effect = True

try:
while not end_of_track.wait(track.duration/1000):
pass
except KeyboardInterrupt:
pass
else:
end_of_track.clear
session.player.unload()
player(session)

How can I reliably evaluate performance of Android app involving Audio recording and analysis

I am working on my masters thesis project titled "Speaker Detection and Conversation Analysis on Mobile Devices" which involves audio recording, feature extraction and analysis on Android phones. So I am developing an android app to test the hypothesis and to evaluate feasibility of doing it on Android in offline mode.


Currently I am done with Audio recording and feature extraction part. I have 3 different implementation using different toolkits. I have to evaluate performance of each project to decide which one to chose and take forward for next steps.


Battery Usage : My initial strategy is to record for 1 hour at least with phone in idle state and then with normal use, while dumping battery level at start and end of experiment. It will give me an idea about how much my android app contributes to battery consumption. Battery consumption is our major concern to test. Does it looks good ? Official documentation states that constantly monitoring battery usage actually adds up to more consumption.


CPU Consumption : I can also use http://ift.tt/1FcBZKx to evaluate performance of overall app or specific chunks of application like FFT module which are resource intensive.


Can I include any other parameter as well which is more suitable for app which involve audio processing ?


javascript AudioRecorder play sound from buffer

I am using cwilso/AudioRecorder http://ift.tt/1s0kdFP Demo: http://ift.tt/10MzWti


I can't figure out how to play the sound once recording is finished. Can somebody help please?


Using javax.sound to add background music

I'm not experienced in the topic, please understand. I am trying to add a background music to my game using javax.sound class. I tried many methods described in the internet, but none of them works. Please give me a simple class capable of playing background music. (I am using Eclipse)


Can't get audio file to play

I can't seem to figure out why my audio file won't play. The audio file is a wav file and is just. The error i am getting is javax.sound.sampled.UnsupportedAudioFileException.



public class MusicProgress {
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame b = new JFrame();
FileDialog fd = new FileDialog(b, "Pick a file: ", FileDialog.LOAD);
fd.setVisible(true);
final File file = new File(fd.getDirectory() + fd.getFile());
//URI directory = new URI (fd.getDirectory() + fd.getFile());
try {
AudioInputStream inputStream = AudioSystem.getAudioInputStream(file);
AudioFormat audioFormat = inputStream.getFormat();
Clip clip = AudioSystem.getClip();
clip.open(inputStream);
clip.start();
} catch (LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedAudioFileException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



}

}

IOS 8: Real Time Sound Processing and Sound Pitching - OpenAL or other framework

I'm trying to realize an app which plays a sequence of tones in a loop. Actually, I use OpenAL and my experiences with such framework are positive, as I can perform a sound pitch also.


Here's the scenario:



  1. load a short sound (3 seconds) from a CAF file

  2. play that sound in a loop and perform a sound shift also.


This works well, provided that the tact rate isn't too high - I mean a time of more than 10 milliseconds per tone.


Anyhow, my NSTimer (which embeds my sound sequence to play) should be configurable - and as soon as my tact rate increases (I mean less than 10 ms per tone), the sound is no more echoed correctly - even some tones are dropped in an obvious random way.


It seems that real time sound processing becomes an issue. I'm still a novice in IOS programming, but I believe that Apple sets a limit concerning time consumption and/or semaphore.


Now my questions:



  1. OpenAL is written in C - until now, I didn't understand the whole code and philosophy behind that framework. Is there a possibility to resolve my above mentioned problem making some modifications - I mean setting flags/values or overwriting certain methods?

  2. If not, do you know another IOS sound framework more appropriate for such kind of real time sound processing?


Many thanks in advance! I know that it deals with a quite extraordinary and difficult problem - maybe s.o. of you has resolved a similar one? Just to emphasize: sound pitch must be guaranteed!


Audio recording and playback option on HTML5

I am trying to develop a browser application that records the audio at 16kHz and has an option to play it back at 16kHz on HTML5.


I want the browser to be compatible with ios and android, primarily ios. What would be a good api to use to achieve this?