Matlab audioread & audiowrite problem

Discussion in 'Programmer's Corner' started by Noy Uzrad, May 14, 2017.

  1. Noy Uzrad

    Thread Starter New Member

    May 14, 2017
    4
    0
    hi

    I have a double data-type array.
    when I write it into wav audio file using audiowrite, and later read it using audioread, i get different values from the original array.
    they are both double, but still, values are different.

    any ideas?
     
  2. MrChips

    Moderator

    Oct 2, 2009
    17,119
    5,294
    Can you post your MATLAB code?
     
    Noy Uzrad likes this.
  3. Noy Uzrad

    Thread Starter New Member

    May 14, 2017
    4
    0
    the values in wmed_signal1 and eval_signal_en are very close, but still differ.
    I need them too be exactly the same
     
  4. MrChips

    Moderator

    Oct 2, 2009
    17,119
    5,294
    Can you cut and paste the code as simple text?
     
  5. Noy Uzrad

    Thread Starter New Member

    May 14, 2017
    4
    0
    audiowrite('wmed_signal1.wav' , wmed_signal1, Fs);

    eval_signal_en = audioread('wmed_signal1.wav')';
     
  6. MrChips

    Moderator

    Oct 2, 2009
    17,119
    5,294
    Apparently audioread and audiowrite are using different formats or is doing some signal processing to the data.
    What is your sampling frequency Fs?
    Do you still have wavread and wavwrite on your version of MATLAB?
     
  7. Noy Uzrad

    Thread Starter New Member

    May 14, 2017
    4
    0
    OK fellows I had figured it out.
    I had to add the arguments ('BitsPerSample', 64) to audiowrite function.

    Thank you for your replys
     
  8. John_2016

    Member

    Nov 23, 2016
    55
    5
    Hi Noy Uzrad

    you are missing the actual 'send-to-speakers' command

    sound(y,Fs)

    the audioread command only loads from the audio file to MATLAB workspace, it doesn't actually play it.

    The reproduction of the audio file requires Fs to be specified, that is precisely the 2nd input field of command sound.

    regards

    John BG
     
  9. MrChips

    Moderator

    Oct 2, 2009
    17,119
    5,294
    Nice of you to contribute your MATLAB expertise.
    Please do not Post Reply to old threads, especially when the problem has been solved and the TS is long gone.
     
Loading...