# Migrating from Flutter Sound

## Migration from Flutter Sound to Sounds

Sounds was originally a fork of the Flutter Sounds project however there is very little code left from the original Flutter Sounds project.

The following guide provides some general advice on migrating your project from Flutter Sound to Sounds.

### Playback

In the Sounds package the `ShadePlayer` and `FlutterSoundPlayer` have been deprecated in favour of a single class `SoundPlayer`.

`SoundPlayer` now has two constructors:

Code that previously used `TrackPlayer` should now call the `SoundPlayer.withShadeUI()` constructor.

Code that used the `FlutterSoundPlayer` should now call the `SoundPlayer.noUI()` constructor.

The equivalent method names on the `FlutterSoundPlayer` class have also been shortened.

Example changes:

`FlutterSoundPlayer.startPlayer()` -> `SoundPlayer.play()`&#x20;

`FlutterSoundPlayer.pausePlayer()` -> `SoundPlayer.pause()`&#x20;

`FlutterSoundPlayer.stopPlayer()` -> `SoundPlayer.stop()`

The new `play` methods replaces both `startPlayer(uri)` and `startPlayerFromBuffer()` and now takes a `Track`.

### subscription

In the `Sounds` the original `SoundPlayer` subscription model is now been unified into a single stream via:

```
var Stream<PlaybackDisposition> = SoundPlayer.noUI().dispositionStream(interval);
```

The result is a stream of `PlaybackDisposition`s which includes both the audio's duration (length) and current position.

### Recording

The `FlutterSoundRecorder` has been replaced with `SoundRecorder`. Changes to the recorder a similar to the changes made to the player.

### Types

Types and enums now consistently use camelCase.

e.g. `t_PLAYER_STATE.IS_STOPPED -> PlayerState.isStopped`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bsutton.gitbook.io/sounds/etc/migrating-from-flutter-sound.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
