Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaying sounds #26

Open
garakatsamol opened this issue Nov 20, 2012 · 1 comment
Open

Replaying sounds #26

garakatsamol opened this issue Nov 20, 2012 · 1 comment

Comments

@garakatsamol
Copy link

HI, thanx for your work.
I am trying to record something with a backgrounf music. So i have succesfully implemented a player where i have two sources. The one is loading from an mp3 and the other is the recorder data.

I make a sequence and an audio performerfor each of my sources and then i use both audio performers as sources and i add them to a new sequence. (that is because i want to control in realtime the gain of each performer.). The outcome is assign to an audioplayer

This works fine until i replay the sound. At this case the recorded sound seems to play in fast forward and at the end of the recording sound throws an error

Error: Sample pointer out of range.
at com.noteflight.standingwave3.elements::Sample/getSamplePointer()

Before i replay the sound i try to ensure that audioplayer is stopped

player.stop()

reset the audio performer

_aPerformer.resetPosition()

I get the microphone data with

WaveFile.createSample(recorder.output)

And before i replay it (not really sure if this has a point) i set the position of the recorded data byteArray to 0

recorder.output.position=0

I would appreciate any help.
Thanx in advance!

@garakatsamol
Copy link
Author

well, the problem was that i was constructing again each time the sequences because i wanted to add a different starting point and i was actually adding the same source each time, which resulted in playback issues.

Since i found a way to remove the sources from the sequences and manage the proccess, i finally got it working.
i did that with the help of jordan's implementation
http://www.jordansthings.com/blog/?p=5

He added in the ListPerformance class the following function

 /* added by jordan */
public function removeSource(elementnum:int):void
        {
            _elements.splice(elementnum, 1)
    }
}

so when i want to remove all the sources from a sequence i do it by

while(_sequence.elements.length>0)
{               
    _sequence.removeSource(0)
}

It seems a little rough but it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant