Hi all,
May i have your advise on the relation between the Native sampled sound value and Mapped sampled sound value???
How is actually the native sound is mapped to the range of [-1, + 1] ?
If it is a simple division, I should divide the native value by?
Thank you.
|
|
0
|
|
|
|
Reply
|
st
|
1/9/2011 4:58:04 PM |
|
"st " <cell_st@hotmail.com> wrote in message <igcpes$q7$1@fred.mathworks.com>...
> Hi all,
>
> May i have your advise on the relation between the Native sampled sound value and Mapped sampled sound value???
>
> How is actually the native sound is mapped to the range of [-1, + 1] ?
> If it is a simple division, I should divide the native value by?
>
> Thank you.
If it is simple division, then you should divide the values by their maximum, right?
e.g:
>> new_x = x./max(abs(x));
If you're playing a sound, I think you can use soundsc() and MATLAB will automatically scale the vector for you and play it.
|
|
0
|
|
|
|
Reply
|
Husam
|
1/9/2011 5:10:20 PM
|
|
"st " <cell_st@hotmail.com> wrote in message <igcpes$q7$1@fred.mathworks.com>...
> Hi all,
>
> May i have your advise on the relation between the Native sampled sound value and Mapped sampled sound value???
>
> How is actually the native sound is mapped to the range of [-1, + 1] ?
> If it is a simple division, I should divide the native value by?
>
> Thank you.
I don't know how it's mapped, just how you can put any sound inside those limits:
AdjustedSound=Sound/max(abs(Sound))
|
|
0
|
|
|
|
Reply
|
Paulo
|
1/9/2011 5:10:21 PM
|
|
"st " <cell_st@hotmail.com> wrote in message <igcpes$q7$1@fred.mathworks.com>...
> Hi all,
>
> May i have your advise on the relation between the Native sampled sound value and Mapped sampled sound value???
>
> How is actually the native sound is mapped to the range of [-1, + 1] ?
> If it is a simple division, I should divide the native value by?
>
> Thank you.
better and faster way
AdjustedSound=[0 length(Sound)]; %prealocation, much faster like this
MaxVal=max(abs(Sound)); %find value of the peak
AdjustedSound=Sound/MaxVal; %get ajusted value [1 -1]
|
|
0
|
|
|
|
Reply
|
Paulo
|
1/9/2011 5:15:05 PM
|
|
"Paulo Silva" <paulojmdsilva@gmail.com> wrote in message <igcqep$2ul$1@fred.mathworks.com>...
> "st " <cell_st@hotmail.com> wrote in message <igcpes$q7$1@fred.mathworks.com>...
> > Hi all,
> >
> > May i have your advise on the relation between the Native sampled sound value and Mapped sampled sound value???
> >
> > How is actually the native sound is mapped to the range of [-1, + 1] ?
> > If it is a simple division, I should divide the native value by?
> >
> > Thank you.
>
> better and faster way
>
> AdjustedSound=[0 length(Sound)]; %prealocation, much faster like this
> MaxVal=max(abs(Sound)); %find value of the peak
> AdjustedSound=Sound/MaxVal; %get ajusted value [1 -1]
Don't use the Sound like I did, use another variable because Sound is an already built in function from matlab, the final division with ./ instead of / might be faster
|
|
0
|
|
|
|
Reply
|
Paulo
|
1/9/2011 5:22:05 PM
|
|
"Paulo Silva" <paulojmdsilva@gmail.com> wrote in message
> AdjustedSound=[0 length(Sound)]; %prealocation, much faster like this
> MaxVal=max(abs(Sound)); %find value of the peak
> AdjustedSound=Sound/MaxVal; %get ajusted value [1 -1]
I don't think that's faster. The first line isn't preallocation either, where I think you meant to say
> AdjustedSound = zeros(size(Sound)); %prealocation, much faster like this
Preallocation is used when you want to fill a vector/matrix with elements inside a loop or through multiple steps. When you're doing that, updating the vector/matrix with a new size each time you insert new elements inside it slows down execution because each time you update the matrix, it is declared again with a new size (changing reserved memory) and then is updated. So you preallocate by specifying its size beforehand and then proceeding to fill it up without changing its size in the loop or through further steps.
What you just did is reserve memory for AdjustedSound before filling it up, as a zero matrix. But you can similarly reserve it and fill it up with Sound/MaxVal just the same, without slowing down anything. I hope I got that across in an understandable manner.
|
|
0
|
|
|
|
Reply
|
Husam
|
1/9/2011 5:34:04 PM
|
|
"Husam Aldahiyat" wrote in message <igcric$ceu$1@fred.mathworks.com>...
> "Paulo Silva" <paulojmdsilva@gmail.com> wrote in message
> > AdjustedSound=[0 length(Sound)]; %prealocation, much faster like this
> > MaxVal=max(abs(Sound)); %find value of the peak
> > AdjustedSound=Sound/MaxVal; %get ajusted value [1 -1]
>
> I don't think that's faster. The first line isn't preallocation either, where I think you meant to say
>
> > AdjustedSound = zeros(size(Sound)); %prealocation, much faster like this
>
> Preallocation is used when you want to fill a vector/matrix with elements inside a loop or through multiple steps. When you're doing that, updating the vector/matrix with a new size each time you insert new elements inside it slows down execution because each time you update the matrix, it is declared again with a new size (changing reserved memory) and then is updated. So you preallocate by specifying its size beforehand and then proceeding to fill it up without changing its size in the loop or through further steps.
>
> What you just did is reserve memory for AdjustedSound before filling it up, as a zero matrix. But you can similarly reserve it and fill it up with Sound/MaxVal just the same, without slowing down anything. I hope I got that across in an understandable manner.
I know what preallocation is but it was a stupid mistake on that part of the code, got distracted by something lol , thank you for the explanation and for correcting the code :) much appreciated :)
|
|
0
|
|
|
|
Reply
|
Paulo
|
1/9/2011 5:49:04 PM
|
|
Husam Aldahiyat you are right there was no need to preallocate, my bad
What about the division with ./ or with / ? I tested and didn't noticed much difference, can you or someone explain what is the best practice in this case?
|
|
0
|
|
|
|
Reply
|
Paulo
|
1/9/2011 6:14:04 PM
|
|
On 09/01/11 10:58 AM, st wrote:
> May i have your advise on the relation between the Native sampled sound
> value and Mapped sampled sound value???
>
> How is actually the native sound is mapped to the range of [-1, + 1] ?
> If it is a simple division, I should divide the native value by?
Sorry, that transformation is undocumented, and Mathworks has not
responded to informal requests for clarification. I have not submitted a
technical case for the matter, though.
Nearly all of the native formats have the property of enumerating 2^N
possible values, for some positive integer N, but because the [-1, +1]
value range goes from negative one _exactly_ to positive one _exactly_,
the transformed range encompasses 2^N + 1 possible values. The mechanism
for mapping between 2^N and 2^N + 1 is unknown and *cannot* be exactly
reversible in a binary floating point system.
|
|
0
|
|
|
|
Reply
|
I
|
1/10/2011 2:36:57 AM
|
|
|
8 Replies
190 Views
(page loaded in 0.031 seconds)
Similiar Articles: How to plot isolines from sampled data? - comp.soft-sys.matlab ...Mapping sampled sound data to the range of [-1,+1] - comp.soft-sys ... How to plot isolines from sampled data? - comp.soft-sys.matlab ... How to plot isolines from sampled ... "every", "x range is invalid" - comp.graphics.apps.gnuplot ...Mapping sampled sound data to the range of [-1,+1] - comp.soft-sys ... plotting isoline... - comp.soft-sys.matlab "every", "x range is invalid" - comp.graphics ... How to find relation between 2 matrices - comp.soft-sys.matlab ...I am currently doing an experiment in signal processing, and am stuck with a simple doubt. I wanted to know how to find the relationship between 2 ma... I just made a stupid mistake - comp.cad.solidworksMapping sampled sound data to the range of [-1,+1] - comp.soft-sys ... I just made a stupid mistake - comp.cad.solidworks Mapping sampled sound data to the range of [-1,+1 ... Generate noise with specific crest factor - comp.dsp... and get a vector with range [-1,+1 ... and -1 (crest factor = 1) 2. insert a single randomly placed sample ... if they make it sound ... times larger than your toy data, and ... Up/ down-sample - comp.soft-sys.matlabRead the sample data of filein1 into an array ... for the double-length version to sound the same, you need to go from sine(((1:N ... any of those harmonics are in the range ... Find the median value of an array. - comp.lang.fortran1) Estimate a range around its value using a small, fixed sample. ... It doesn't sound familiar, but I ... or even most, sets of input data ... Frequency/tone generator in java tia sal22 - comp.lang.java ...... java.util.*; import javax.sound.sampled ... Volume out of range 0.0 - 1.0"); byte[] buf = new byte[(int)SAMPLE_RATE * msecs ... Random map generation - comp ... Frequency Resolution of the DFT - comp.dspThe sampled data is stored in a large array call ... It doesn't sound like one, though. If it is be ... use the std. deviation corresponding to the range spanned by 1 ... The best MP3 VBR bitrate choice when encoding audio? - comp ...... editor, I see for 8-bit > only 1 byte is used (per sample ... won't get you any more signal range. Further, most sound ... or the conversion of digital data to analog sound to ... Sampling (signal processing) - Wikipedia, the free encyclopediaError due to other non-linear effects of the mapping of ... audio covering the entire 20–20,000 Hz range of ... acoustic events, audio waveforms are typically sampled at 44.1 ... Analog-to-digital converter - Wikipedia, the free encyclopedia... ADC (e.g. 12 or 16 bits) and mapping its ... example, a 2 kHz sine wave being sampled at 1 ... ADCs where each ADC samples data every M:th cycle of the effective sample clock. 7/22/2012 9:04:37 PM
|