TarsosTSP with Kotlin in Android Studio

91 Views Asked by At

As a bloody beginner with Kotlin and Android Studio (i am used to DotNEt) I have troubles to implement and use the TarsosDSP.

What I have done already:

  1. I downloaded the latest TarsosDSP ja and put it into the app/libs directory of my project (beatGen).

  2. in teh build.gradle (app) I added the following line:

dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
}

SO i can import all necessary classes from TarsosDSP

I just wanted to output 1 respectively 2 sine tone(s), first via the built in loudspeaker and later via Bluetooth. I want to enter a frequency1 and a amplitude1 for the first tone and additionally I want to enter a frequenca2 and a amplitude2 for the second tone. So i need to use 4x editView. I also want to use 2 switches to enable/disable each tone. So either I can hear no tone, first or second tone or both tones to the same time.

But it is so difficult to find an example how to use the classes, methods of TarsosDSP. Could anybody provide a simple code for generating and outputting a sine tone, starting and stopping it? I even tried chatGPT ( I know I should no, but what shall I do...), but nothing works. And I do not want to Use AudioTrack. The quality is bad. I tried this already.

Hope somebody could help me with a code snippet.

0

There are 0 best solutions below