|
On Dec 8, 11:43=A0pm, Adam Chapman
<adam.chap...@student.manchester.ac.uk> wrote:
> On Dec 8, 7:30=A0pm, Adam Chapman
>
>
>
>
>
> <adam.chap...@student.manchester.ac.uk> wrote:
> > Hi,
>
> > This is the first time I've tried to obtain data from a soundcard, or
> > even use the data aquisition toolbox. Basically. Whilst playing music
> > on Itunes or windows media player, I ran the following code to get and
> > plot 20 seconds of audio data:
>
> > ai =3D analoginput('winsound');
> > Fs=3D8000;
> > time=3D20;
> > set(ai,'SamplesPerTrigger',Fs*time)
> > addchannel(ai, 1);
> > tic; start(ai); toc
> > pause(time)
> > data =3D getdata(ai);
> > data=3Ddata/max(data);
>
> > stop(ai)
> > pause(5)
> > sound(data, Fs)
>
> > plot((1:length(data))/Fs,data)
>
> > I put a picture of the output athttp://personalpages.manchester.ac.uk/s=
tudent/Adam.Chapman/soundcard_...
>
> > As you can see, every now and again the data seems to oscilate around
> > -1. I would have thought that the data couldn't take values <-1,
> > because the "addchannel" command shows:
>
> > Index: =A0ChannelName: =A0HwChannel:
> > =A0 =A01 =A0 =A0 =A0 'Mono' =A0 =A0 =A0 =A0 =A0 =A0 1
>
> > InputRange: =A0SensorRange: =A0UnitsRange: =A0Units:
> > [-1 1] =A0 =A0 =A0 =A0 =A0 =A0[-1 1] =A0 =A0 =A0 =A0 =A0 =A0 =A0 [-1 1]=
=A0 =A0 =A0 =A0 =A0 'Volts'
>
> > Can anybody see something that I've done wrong? I wouldn't think it's
> > a hardware problem, as the sound from my speakers is fine.
>
> > Thanks for any help offered,
> > Adam
>
> I've just ran the same code with speakers outputting no sound at all
> and still get the noise. The data I aquired before did have the music
> data in it, although when playing back it was distorted by this funny
> noise signal.
>
> Here's what I get from right-clicking the object "ai" in my workspace
> and selecting "display hardware info":
>
> =A0 =A0AdaptorName: 'winsound'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Bits: 16
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Coupling: {'AC Coupled'}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DeviceName: 'Microphone (SoundMAX Inte=
grated'
> =A0 =A0 =A0 =A0 =A0 =A0 DifferentialIDs: []
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Gains: []
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ID: '0'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 InputRanges: [-1 1]
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 MaxSampleRate: 96000
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 MinSampleRate: 5000
> =A0 =A0 =A0 =A0 =A0 =A0 =A0NativeDataType: 'int16'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Polarity: {'Bipolar'}
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0SampleType: 'SimultaneousSample'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0SingleEndedIDs: [1 2]
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 SubsystemType: 'AnalogInput'
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 TotalChannels: 2
> =A0 =A0 VendorDriverDescription: 'Windows Multimedia Driver'
> =A0 =A0 =A0 =A0 VendorDriverVersion: '6.0'
>
> I'm not sure about the fact that the device name is "microphone",
> maybe that's default for an audio device. Also I dont know the
> hardware info is aquired from the device drivers or if they are merely
> default values.
>
> I've also put online the data plot with no sound at:http://personalpages.=
manchester.ac.uk/student/Adam.Chapman/no_sound_p...
> Also plotted the data in uint16 format after seeing above the native
> data type for the sound card is uint16. Again, not sure if this is
> actual or default.
>
> Hope this is useful
> Adam- Hide quoted text -
>
> - Show quoted text -
The large jumps to -1 appear to occur when int16(data)~-0. Could I
just add 1 to any data?
Im so confused, as I can't see any reason why this is happening!
|