You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
whats wrong in the following?
1 view (last 30 days)
Show older comments
[y, Fs] = audioread('Track48.wav');
y1 = y(:,1); y2 = y(:,2);
Y = [y1 y2];
wavwrite(Y ,Fs, 'newfile.wav');
% %audiowrite('newfile.wav', Y ,Fs);
........................................................................................
Error on running:
Error using wavwrite>OpenWaveWrite (line 170)
Unable to open file. Reason: Permission denied
Error in wavwrite (line 96)
fid = OpenWaveWrite(wavefile);
Error in Test2 (line 16)
wavwrite(Y ,Fs, 'newfile.wav');
Thanks a lot
Answers (1)
madhan ravi
on 10 Jan 2019
Edited: madhan ravi
on 10 Jan 2019
Try changing the working directory or run as administrator it is clear from the message that file permission is denied.
21 Comments
VINAYAK KARANDIKAR
on 10 Jan 2019
The working directory is the same as the one in which the MATLAB file is located. Everything is alright there. The problem is with the code, i think!!!
madhan ravi
on 10 Jan 2019
Try with audiowrite() instead of wavwrite() , perhaps?
VINAYAK KARANDIKAR
on 10 Jan 2019
No, i restarted the computer and now i get better results while testing the larger code, of which i had sent only a snippet. Nevertheless, i think there is a problem with the audio files itself. If i send them here, can someone tell me if they know how to hear them? Maybee someone can give me their email address, the files are too large to even compress them?
Thanks
Walter Roberson
on 10 Jan 2019
no that error can only ever mean that you are not authorised to create the file at that location or that you are not authorised to overwrite an existing file at that location . It can never mean there is a problem in the content of the file .
If the code works for a bit but then fails then one possibility is that you or the code changed to a different directory .
VINAYAK KARANDIKAR
on 10 Jan 2019
But man, that error no longer appears. Only i cannot hear anything when i play the audio now.
Walter Roberson
on 10 Jan 2019
which release are you using and which operating system ? You should probably be switching to audiowrite()
VINAYAK KARANDIKAR
on 10 Jan 2019
@Walter Roberson: I use 2013b MATLAB on Windows 10. I have used audio write function as well. Its commented in my code above, as you can see. I was expermenting with various permutations and combinations. Thanks
Walter Roberson
on 10 Jan 2019
audiowrite('newfile.wav', Y ,Fs);
should work.
Walter Roberson
on 10 Jan 2019
Try
[y, Fs] = audioread('Track48.wav');
audiowrite('newfile.wav', y, Fs);
and see if there is any difference in what you hear between the two using an external player.
VINAYAK KARANDIKAR
on 10 Jan 2019
Hey, this works fine with 'track48.wav' but not with 'SDRSharp_20171103_160212Z_97990kHz_IQ.wav'
I think there is something wrong with the latter audio wav file only.
Walter Roberson
on 10 Jan 2019
Perhaps post a Dropbox or Google Drive link to a copy of it?
VINAYAK KARANDIKAR
on 10 Jan 2019
Hey here is the link: https://drive.google.com/open?id=1z71VFMaRHrsIuQVBLmiqq_aLBhewrJZS
Let me know what you have been able to find out and do?
VINAYAK KARANDIKAR
on 12 Jan 2019
Hello? Anyone with a response to my audio that i shared?
Thanks
Walter Roberson
on 12 Jan 2019
That file has a sample frequency of 900001 which is beyond the capabilities of my hardware to play.
VINAYAK KARANDIKAR
on 12 Jan 2019
Exactly. Something is wrong with this file. I will get back to my file provider about this. Thanks a lot. I think we can close this discussion here?
Walter Roberson
on 13 Jan 2019
Based on the file name, it looks like it might be from a scientific instrument that was sampling at 97990kHz (nearly 1 GHz), and that it is possibly in quadrature mode. I am not currently convinced that it is intended to be "sound" in the human range.
... Though if it is quadrature encoded, it does not appear to have constellations.
If you use the 'native' mode for audioread(), and look at min() and max() of the data, it looks like it does not span the full range like human sound would be likely to. It looks like it is close to symmetric around 0 with a full span that just might be 2^14*3/2 or possibly 24000 .
Ah, look at that. Filename is SDRSharp_20170415_070322Z_97990kHz_IQ.wav and SDRSharp is the name of a Software Defined Radio program. You are not dealing with audio.
VINAYAK KARANDIKAR
on 13 Jan 2019
If i am not dealing with audio, then what is the nature of the signal according to you?
And how do i use MATLAB to process it?
Basically i am supposed to implement a Digital FM Stereo Receiver in MATLAB to process this signal(the wav file i sent here)
Thanks
Walter Roberson
on 13 Jan 2019
The file is samples of radio frequency transmissions. Storing it in a .wav was convenient to the people who created it, but that does not mean that it was audio in the human sense. It is just data recordings.
The data was recorded with the program SDR# (SDRSharp)
audioinfo() reports that it is 16 bits per sample, and examining the data I see differences in value at the int16 level as small as 1, but the top bit does not seem to be used. This suggests that it really is 16 bits, rather than 12 bits stuffed into 16. However, if you look at histogram in more detail, it looks likely that the samples are in bins of width 2^8 (256) at the int16 level, as if there were roughly 91 frequency bins that are 256 apart and that for whatever reason, values are distributed around those centers instead of being exactly those centers (perhaps for phase reasons, perhaps for signal edge transition reasons, perhaps for noise reasons.) But if you
[data,fs] = audioread('SDRSharp_20170415_070322Z_97990kHz_IQ.wav', 'native');
N = 8; histogram(floor(data(:)/(2^N)),-2^(14-N):2^(14-N)-1)
then you do get a nice smooth bimodal distribution with the peaks near +/- 3072 (and distinctly non-trivial counts between.) This is not a binary encoding.
You mentioned FM: frequency modulation around centers 256 apart could plausibly account for the bin shapes.
The file name hints at 97.9 MHz, which is plausible for FM Channel 250 https://en.wikipedia.org/wiki/List_of_channel_numbers_assigned_to_FM_frequencies_in_North_America for non-digital FM radio, but the file name also hints at 97.99 MHz which could be "98.0 MHz" which could be from Europe or Africa (in North America, only odd frequencies are used.)
I am getting a bit lost following the technical description of how FM encodes stereo.
Atch, I just realized that in part I have been mentally confusing frequency vs amplitude. The histograms I am referring to above are about amplitude. You need to do a frequency analysis.
VINAYAK KARANDIKAR
on 13 Jan 2019
Check the attachement. Thanks
Walter Roberson
on 13 Jan 2019
Introduced in R2014b
You can use hist() instead of histogram() for this purpose.
Next time please fill out the Product / Release fields in your question so that we do not give you answers that are not suitable for your old release.
VINAYAK KARANDIKAR
on 13 Jan 2019
Alright, thanks.
So basically my question is answered: Its not an audio file, i won't hear a human sound.
Next i have to design a FM receiver.
Does the material in the above link, particularly the decoder diagram suffice for this task(FM Receiver design in MATLAB), in your opinion?
Thanks
See Also
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)