val sampleRate = 16000
val audioSamples: ShortArray = AudioUtils.generateToneSamples(
freqHz = 400.0,
durationMs = 1000,
sampleRate = sampleRate
)
// play the raw audio samples
val audioTrack = RawAudio.from(audioSamples, sampleRate, AudioChannel.MONO, AudioEncoding.PCM_16BIT)
.toAudioTrack()
audioTrack.play()
// export to a wav file
val wavFile = File("hello.wav")
RawAudio.from(audioSamples, sampleRate, AudioChannel.MONO, AudioEncoding.PCM_16BIT)
.toWavFile(wavFile)
forked from deeplyinc/audioutils-android
-
Notifications
You must be signed in to change notification settings - Fork 0
KimGyeongyeon/audioutils-android
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Kotlin 100.0%