GithubHelp home page GithubHelp logo

Comments (8)

SKKbySSK avatar SKKbySSK commented on June 13, 2024

@MaayanBogin
Thanks for reporting issue.
It looks like the version 0.0.5 of coast_audio introduced this breaking changes.

If you are not going to use the WavAudioDecoder class, you can downgrade your coast_audio dependency to 0.0.4 to fix the problem.

from coast_audio.

MaayanBogin avatar MaayanBogin commented on June 13, 2024

@SKKbySSK
Thanks for the quick response!
I'm only importing flutter_coast_audio_miniaudio: ^0.0.4, is there a version that is depended on a older version of coast_audio?

Edit: Tried 0.03 and it didn't work, Is there a workaround from changing the pubspace.yaml?

from coast_audio.

MaayanBogin avatar MaayanBogin commented on June 13, 2024

@SKKbySSK

Hello again! Hate to bug about this again but I cant seem to get it to work, Also it seems that flutter_coast_audio_miniaudio 0.0.4 is already dependant on coast_audio: ^0.0.4 and flutter_coast_audio_miniaudio: ^0.0.4

edit: When I try to just use coast_audio: ^0.0.4 and coast_audio_miniaudio: ^0.0.4 I still encounter the error, when using flutter_coast_audio_miniaudio and getting the error ma_bridge is mentioned, maybe somthing with its installation? I tried using WavAudioDecoder but id rather decode the mp3 audio

Is there a version of flutter_coast_audio_miniaudio that i can use that wont give me the The method 'setString' isn't defined for the class 'Array<Char>'. error?

from coast_audio.

SKKbySSK avatar SKKbySSK commented on June 13, 2024

@MaayanBogin
When you write ^ to the dependency, it will be resolved as a version range in >=0.0.4 <1.0.0. (reference)
Can you write coast_audio: 0.0.4 instead of ^0.0.4?

from coast_audio.

MaayanBogin avatar MaayanBogin commented on June 13, 2024

@SKKbySSK Thanks for the response but I am officially really confused,
I tried coast_audio: 0.0.4 , returned the same error, but its telling me I dont need the lib because of import flutter_coast_audio_miniaudio.dart';? so I dont need to import coast_audio(?)

Im not sure what lib to import anymore from all the repos pointing at smth else. Here are my imports
import 'dart:async';
import 'dart:ffi' as ffi;
import 'dart:io';
import 'dart:math' as math;
import 'dart:typed_data';
import 'package:fftea/fftea.dart'
//import 'package:coast_audio/coast_audio.dart'; *Note this is not used
import 'package:flutter_coast_audio_miniaudio/flutter_coast_audio_miniaudio.dart';

Here is the relevant code regarding the decoding

final dataSource = AudioFileDataSource(file: file, mode: FileMode.read);
    // Determine the output format (assuming you know the format)
    final outputFormat =
        AudioFormat(sampleRate: 44100, channels: 1); // Adjust as needed
    // Create a buffer size
    final bufferSize = 4096;

    // Use ffi to allocate memory for the buffer
    final pBuffer = memory.allocator.allocate<ffi.Uint8>(bufferSize);

    // Create a MabAudioDecoder
     final decoder =
        MabAudioDecoder(dataSource: dataSource, outputFormat: outputFormat);
     
    //final decoder = WavAudioDecoder(dataSource: dataSource);  **Not used for now 
    final audioData = <double>[];

    // Decode audio data in chunks
    while (true) {
      final decodeResult = await decoder.decode(
        destination: AudioBuffer(
          pBuffer: pBuffer,
          sizeInBytes: bufferSize,
          sizeInFrames: bufferSize ~/ outputFormat.channels,
          format: outputFormat,
          memory: memory, // Pass the memory instance
        ),
      );

      // Check if decoding is finished
      if (decodeResult.isEnd) {
        break;
      }

      // Convert the decoded data in memory to a Dart List<double>
      for (var i = 0; i < decodeResult.frames * outputFormat.channels; i++) {
        final byte = pBuffer.elementAt(i).value;
        audioData.add(byte.toDouble());
      }
    }

Little side note : At this point I'm starting to get really confused, I'm not sure what to import and what statements to call, I simply need to decode mp3 audio data so i can do spectrum analyzation using fft, I'm sorry this is taking so long to resolve and I'm sure better developers would get through this quickly but I cant seem to get MabAudioDecoder or any MabAudio to be called while using flutter_coast_audio_miniaudio because it gives me the "'setString' isn't defined" error but when I try to use coast_audio there simply is no way to decode mp3

please help me :')

from coast_audio.

aveia avatar aveia commented on June 13, 2024

@MaayanBogin you don't need the import 'package:coast_audio/coast_audio.dart' statement in the source files; just add coast_audio: 0.0.4 to your pubspec.yaml (but keep flutter_coast_audio_miniaudio there too) so that flutter doesn't try to update the transitive dependency on coast_audio to 0.0.5 and everything should work.

from coast_audio.

MaayanBogin avatar MaayanBogin commented on June 13, 2024

Hello :) do you have plans on addressing this issue with flutter_coast_audio_miniaudio?

from coast_audio.

SKKbySSK avatar SKKbySSK commented on June 13, 2024

@MaayanBogin
There is a plan for the next stable release.
flutter_coast_audio_miniaudio and coast_audio_miniaudio will be integrated to the coast_audio package.
(and it will introduces some breaking changes)

It should be released soon.

from coast_audio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.