whats wrong in the following?
1 次查看(过去 30 天)
显示 更早的评论
[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
回答(1 个)
madhan ravi
2019-1-10
编辑:madhan ravi
2019-1-10
Try changing the working directory or run as administrator it is clear from the message that file permission is denied.
21 个评论
VINAYAK KARANDIKAR
2019-1-10
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!!!
VINAYAK KARANDIKAR
2019-1-10
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
2019-1-10
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
2019-1-10
But man, that error no longer appears. Only i cannot hear anything when i play the audio now.
Walter Roberson
2019-1-10
which release are you using and which operating system ? You should probably be switching to audiowrite()
VINAYAK KARANDIKAR
2019-1-10
@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
2019-1-10
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
2019-1-10
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.
VINAYAK KARANDIKAR
2019-1-10
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?
Walter Roberson
2019-1-12
That file has a sample frequency of 900001 which is beyond the capabilities of my hardware to play.
VINAYAK KARANDIKAR
2019-1-12
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
2019-1-13
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
2019-1-13
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
2019-1-13
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.
Walter Roberson
2019-1-13
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
2019-1-13
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)