Low quality audio file when trying to record using media and file

Hello everyone,
I’m trying to record audio in android using media ( https://ionicframework.com/docs/native/media )
but the recorded audio has very low quality with noise when I play it back
Here is my code:

import { Component } from '@angular/core';
import { Media, MediaObject } from '@ionic-native/media/ngx';
import { File } from '@ionic-native/file/ngx';
import { Platform } from '@ionic/angular';

  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
export class HomePage {

  filePath: string;
  recordedAudio: MediaObject;
  recording: Boolean = false;
    private media: Media,
    private file: File,
    public platform: Platform
  ) { }

  startRecord() {
    if (this.platform.is('android')) {

      this.filePath = this.file.externalRootDirectory + 'my_file.3gp';
      this.file.createFile(this.file.externalRootDirectory, 'my_file.3gp', true).then(() => {
        this.recordedAudio = this.media.create(this.file.externalRootDirectory.replace(/^file:\/\//, '') + 'my_file.3gp');
        window.setTimeout(() => this.recordedAudio.stopRecord(), 50000);
    this.recording = true;

  stopRecord() {
    if (this.platform.is('android')) {


  playSelectedTrack() {
    // use AudioProvider to control selected track 
    if (this.platform.is('android')) {

  pauseSelectedTrack() {
    // use AudioProvider to control selected track 
    if (this.platform.is('android')) {

Sorry in advance as i am new here but one my friend told me the solution
like this :

This might be because of audio encoding. 3gp always sounds bad. Try m4a or mp3 . m4a works in few android phones and has better quality.

This is from Cordova Github Repo: Android devices record audio in AAC ADTS file format. The specified file should end with a .aac extension.

This will surely help you in your problem.

1 Like