SKKbySSK / coast_audio

Real-Time audio processing library written in Dart.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When I compiled the apk for Android, `NativeDecoder` was not found

Nayuta403 opened this issue · comments

Sorry to interrupt.

Running the music_player on Android fails, indicating that work.kscafe.coast_audio_native_codec.NativeDecoder does not exist
image
I wonder if this NativeDecoder class is generated by some instruction

@Nayuta403
Oops, can you try switching to feature/refactor branch instead?
This branch has one example Flutter app which can play music.

@SKKbySSK
Thanks, this problem no longer exists, but there are no examples of fft usage in the examples. In fact, I mainly want to see the use of fft here, there are other materials can refer to ?

@Nayuta403
FFT is not supported by this package yet.
But you can combine this package and other fft libraries to run FFT. (such as https://pub.dev/packages/fftea)

This program will run the FFT on 440 Hz sine wave

// define the audio format with 48khz sample rate and stereo channels.
final format = AudioFormat(sampleRate: 48000, channels: 1, sampleFormat: SampleFormat.int16);

// create a sine wave function node with 440hz frequency.
final functionNode = FunctionNode(
  function: const SineFunction(),
  frequency: 440,
);

AllocatedAudioFrames(length: 1024, format: format).acquireBuffer((buffer) {
  // read the audio data from the function node to the buffer.
  functionNode.outputBus.read(buffer);

  // floatList contains sine wave audio data.
  final floatList = buffer.asFloat32ListView();

  // Run FFT on the floatList here
  final fft = FFT(floatList.length);
  final freq = fft.realFft(floatList);
});

@SKKbySSK Thank you very much for the information you provide. Maybe I can run it based on the refactor branch first, and refer to the content of the main branch for related use.