Microphone:getData
Returns a new SoundData with all of the buffered audio samples that the Microphone has recorded.
Get all available audio as a newly created SoundData
.
soundData = Microphone:getData()
Arguments
None
Returns
Name | Type | Description |
soundData | soundData | A SoundData with sampleCount of samples in it (or less if less was available; or all if sampleCount was not given). Nothing is returned if no data is available.
|
Get at most sampleCount
samples from the microphone's internal queue as a newly created SoundData
.
soundData = Microphone:getData(sampleCount)
Arguments
Name | Type | Description |
sampleCount | number | How many samples of audio to get right now, at most. If less is available, you will get less (use Microphone:getSampleCount to check the exact number).
|
Returns
Name | Type | Description |
soundData | soundData | A SoundData with sampleCount of samples in it (or less if less was available; or all if sampleCount was not given). Nothing is returned if no data is available.
|
Get at all available audio and write it into soundData
.
soundData = Microphone:getData(soundData)
Arguments
Name | Type | Description |
soundData | soundData | The SoundData to fill with audio (instead of creating a new one).
|
Returns
Name | Type | Description |
soundData | soundData | A SoundData with sampleCount of samples in it (or less if less was available; or all if sampleCount was not given). Nothing is returned if no data is available.
|
Get at all available audio and write it into soundData
starting at offset
samples into soundData
.
soundData = Microphone:getData(soundData, offset)
Arguments
Name | Type | Description |
soundData | soundData | The SoundData to fill with audio (instead of creating a new one).
|
offset | number | Index in samples into soundData at which to start to overwrite with new audio data from the microphone's internal buffer.'
|
Returns
Name | Type | Description |
soundData | soundData | A SoundData with sampleCount of samples in it (or less if less was available; or all if sampleCount was not given). Nothing is returned if no data is available.
|
Notes
There's a limit on the number of samples the Microphone is able to hold, which can be set at creation time in lovr.audio.newMicrophone
. While the Microphone is recording, be sure to call this function periodically to get a new chunk of audio in order to make room for more.
You can use Microphone:getSampleCount
to figure out how many samples the Microphone is currently holding.
See also
Microphone:getSampleCount
Microphone:startRecording
Microphone:stopRecording
Microphone:isRecording
SoundData
Microphone